Skip to content

Changes to support new tacho driver updates #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 8, 2016

Conversation

rhempel
Copy link
Member

@rhempel rhempel commented Mar 6, 2016

  • Eliminate speed_regulation_enabled attribute
  • Add max_speed attribute
  • Add count_per_m attribute for linear motors
  • Add fullt_travel_count attribute linear motors
  • Add subclasses for all known motor types
  • Change the speed_regulation_pid parameters to speed_pid
  • Add a paragraph to explain when attributes are handled.
  • See Can't change speed_sp anymore while motor is running ev3dev#558
  • Fix line endings without commas

- Eliminate speed_regulation_enabled attribute
- Add max_speed attribute
- Add count_per_m attribute for linear motors
- Add fullt_travel_count attribute linear motors
- Add subclasses for all known motor types
- Change the speed_regulation_pid parameters to speed_pid

- Add a paragraph to explain when attributes are handled.
- See ev3dev/ev3dev#558

- Fix line endings without commas
@@ -362,7 +359,40 @@
],
"inheritance": "motor"
},
"dcMotor": {
"nxtMotor": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do something like we did for specialSensorTypes for these, because they should be able to be completely automatically generated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

],
"docsLink": "http://www.ev3dev.org/docs/drivers/tacho-motor-class/",
"systemClassName": "tacho-motor",
"systemDeviceNameConvention": "motor{0}",
"systemDeviceNameConvention": "*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a workaround for the fact that we have two types of motors - the Firgellis have a device name of linear* while all others are motor* - if you instantiate using ev3dev.Motor and then change the driver type to a linear motor, the device name changes to linear*.

You can always instantiate the right motor type and get the more precise motor name

@@ -344,6 +346,7 @@
},
"largeMotor": {
"friendlyName": "Large Motor",
"systemDeviceNameConvention": "motor{0}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to this PR, but looks like we have a mix of two mask styles: * and {0}. May be we need to choose one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree -- we should normalize on a way of specifying this information and stick with it. I'll need to take a look at the underlying device code in my JS lib to refresh my memory on how I do it, but I think I currently transform it into a regex. That would probably be a good format to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In python this gets translated to file system mask, so * may be used directly. {0} is also not a problem though, because it coincidentally is the string format marker in python (as in 'motor{0}'.format('*')).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WasabiFan - I will defer to your judgement on this - I agree with pick one and stick with it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say we normalize to * -- it's a universally understood symbol for a wildcard and single characters are simpler in general.

@jabrena
Copy link
Contributor

jabrena commented Mar 7, 2016

Good morning, how many weeks to release a new version to be effect the changes in motor class?

@WasabiFan
Copy link
Member

@rhempel Can you update the spec version number and supported kernel version? I think the spec version deserves incrementing the major.

@rhempel
Copy link
Member Author

rhempel commented Mar 7, 2016

Will do - chicken and egg - I need to know also the next kernel cycle version :-)

@rhempel
Copy link
Member Author

rhempel commented Mar 8, 2016

@WasabiFan - the version in my branch looks like this:

    "meta": {
        "version": "0.9.3-pre",
        "specRevision": 2,
        "supportedKernel": "v3.16.7-ckt16-7-ev3dev-ev3"

The version in develop looks like this:

    "meta": {
        "version": "1.0.0",
        "supportedKernel": "v3.16.7-ckt21-9-ev3dev"

The proposed new version will be

    "meta": {
        "version": "1.0.0",
        "supportedKernel": "v3.16.7-ckt21-10-ev3dev"

And if we do a non-breaking revision after that, we just add a

        "specRevision": ?,

line, OK?

@WasabiFan
Copy link
Member

As long as we plan to tag an ev3dev-lang release after these changes are released, I'm fine with that.

@rhempel
Copy link
Member Author

rhempel commented Mar 8, 2016

@WasabiFan,I was thinking about this after my discussion with @dlech and probably the right thing to do is make the supportedKernel a regex, like this:

"supportedKernel": ".*-10-.*-ev3dev"

That way it's independent of the target board kernel and depends only on our updates to the drivers...

@WasabiFan
Copy link
Member

That makes sense. Feel free to make that change.

@dlech
Copy link
Member

dlech commented Mar 8, 2016

Regex would actually be [\w\-\.]+\-10\-ev3dev-[\w\-\.]+

Anything between the 10 and ev3dev is for development releases only and can probably be omitted.

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

I thought the kernel version string had to end in -ev3dev to be recognized as an ev3dev kernel?

And this re does match:

print(re.match('.*\-10\-ev3dev.*', "v3.16.7-ckt21-10-ev3dev"))

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

Here's a slightly better regex that actually matches the kernel string I have:

import re
print(re.match('[\w\-\.]+\-10\-[\w\-\.]*ev3dev[\w\-\.]*', '3.16.7-ckt21-10-rc1-ev3dev'))
print(re.match('[\w\-\.]+\-10\-[\w\-\.]*ev3dev[\w\-\.]*', '3.16.7-ckt21-10-rc1-ev3dev-ev3-rhempel-ev3+'))

@dlech
Copy link
Member

dlech commented Mar 9, 2016

Nope, EV3 hardware ends in -ev3, RPi1 hardware ends in -rpi, RPi2 hardware ends in -rpi2 and Beaglebone ends in -bb.org. These are called kernel "flavors" and are used by the flash-kernel utility to indicate that a kernel is installable on a particular hardware platform.

The ev3dev is just for us human beings.

@dlech
Copy link
Member

dlech commented Mar 9, 2016

Does this regex have to actually match against uname -r on a running machine?

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

No, it does not have to match, but it's a clue that you can use to figure out why your script isn't working when we change attributes :-)

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

I was just trying to figure out some way to make that string useful across all the kernel strings that we might support

@dlech
Copy link
Member

dlech commented Mar 9, 2016

If it is not used programmatically, then why not make it human readable like <upstream version>-10-ev3dev-<flavor>?

@WasabiFan
Copy link
Member

Honestly, I think it would make sense to add an isPlatformSupported function that would use this regex to compare against the kernel version.

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

What if the kernel verison changed with no changes required for spec.json?

@WasabiFan
Copy link
Member

Then the support method returns false, saying that it is an untested platform. If we have tested it and it is supported, we publish a new version.

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

I'm in favour now of @dlech's suggestion of a human readable expression - the language binding can easily replace the known text with the appropriate matching pattern in case it's not compatible with standard regexen. I'll add a section for optional release candidate like this:

<upstream version>-10-<optional text>ev3dev-<flavor>

unless we can convince @dlech to make <optional text> like rc1 part of the <flavor> string :-)

@dlech
Copy link
Member

dlech commented Mar 9, 2016

There will never be an official release with -rcX or any other "optional text". Only if you build your own kernel from git will you have -rcX. And technically, -rcX and a few other strings are treated specially in kernel versions. So, the -rcX is actually part of the number 10. As in 10-rc1 < 10-rc2 < 10.

So, no, I can't move "optional text" because it would change how version numbers are compared and it doesn't seem appropriate to have it in the spec anyway unless the spec is targeting a pre-release version, in which case you would specify 10-rc1 explicitly.

@rhempel
Copy link
Member Author

rhempel commented Mar 9, 2016

OK, how about <upstream version>-<ev3dev version>-ev3dev-<flavor> - that way we can handle release candidates during development is we have a function like @WasabiFan suggests to check kernel compatibility.

And we can have a list of compatible s in the meta data.

Sorry if I'm dragging this out, but I deal with checking hardware and firmware compatibility regularly at work, and it's a mess if you get it wrong.

@dlech
Copy link
Member

dlech commented Mar 9, 2016

👍

- Added an easily matched text string to allow for a more complex
  regexp to be used to match kernel variants across supported
  platform
- Added a list of kernel variants that are compatible with the
  current json.spec
@rhempel
Copy link
Member Author

rhempel commented Mar 10, 2016

@WasabiFan and @dlech, I've added the support for allowing kernel compatibility to be checked. The strings are easily identified to allow for binding-specific string matching, and we have an array of compatible kernel variants that the binding can iterate through to test for compatibility :-)

@WasabiFan
Copy link
Member

I'm not sure that I understand. What's the point of the pattern if we also have an array of compatible kernel strings?

@rhempel
Copy link
Member Author

rhempel commented Mar 11, 2016

The pattern is there because it lets the binding easily substitute patterns for the upstream version and the flavour, and iterate through the supported kernel versions. I see your point about just listing supported kernel variant strings. The patterns allow the binding to know where to find the important xx-yyy-ev3dev in the kernel name in a language independent way.

This becomes important when we support different upstream kernels and the flavours include EV3, rPi, BB, etc

@WasabiFan
Copy link
Member

What's the plan for this? Merge it once the new drivers are released?

@WasabiFan WasabiFan mentioned this pull request Mar 26, 2016
4 tasks
@dlech
Copy link
Member

dlech commented Apr 12, 2016

Drivers have been released so you can proceed with this pull request.

@dlech
Copy link
Member

dlech commented Apr 12, 2016

Additional changes needed are

  • Removal of encoder_polarity attribute (tacho motor class)
  • Rename of stop_command to stop_action (both tacho motor class and dc motor class)
  • Rename of stop_commands to stop_actions (both tacho motor class and dc motor class)

@rhempel
Copy link
Member Author

rhempel commented May 8, 2016

I'm going to merge this as-is, and open a new PR for the breaking changes to the new kernel that @dlech mentions above.

@rhempel rhempel merged commit 20d4401 into develop May 8, 2016
@WasabiFan WasabiFan deleted the feature-new-tacho-driver-attributes branch September 15, 2016 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants