-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add rover message to common.xml #1032
Conversation
The WHEEL_DISTANCE is the first of a set of rover messages intended to allow easier integration of ground vehicles.
I think this part of the description of |
message_definitions/v1.0/common.xml
Outdated
<description>Cumulative distances traveled by each wheel (forward rotations increase these values, backward - decrease).</description> | ||
<field type="uint64_t" name="time_usec" units="us">Timestamp (synced to UNIX time or since system boot)</field> | ||
<field type="uint8_t" name="count">Number of wheels reported</field> | ||
<field type="float[16]" name="distance" units="m">Distance traveled by each wheel. The distance wraps around after 100'000m, so 99'999 + 1m becomes 1m and -99'999 - 1m becomes -1m. This is necessary as floating point numbers have finite precision and the encoder would otherwise start to loose precision over time. The first wheel is the front left, 2nd is the front right, and then row-by-row.</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove local thousand's markers: e.g. 100'000m
becomes 100000m
. Everyone can infer the range without the markers, but to a non-native they look horrible
@pavloblindnology How is the wheel mapping then done? The reason I ask is that setting this will avoid weird errors for users of the message in the future. |
message_definitions/v1.0/common.xml
Outdated
<description>Cumulative distances traveled by each wheel (forward rotations increase these values, backward - decrease).</description> | ||
<field type="uint64_t" name="time_usec" units="us">Timestamp (synced to UNIX time or since system boot)</field> | ||
<field type="uint8_t" name="count">Number of wheels reported</field> | ||
<field type="float[16]" name="distance" units="m">Distance traveled by each wheel. The distance wraps around after 100'000m, so 99'999 + 1m becomes 1m and -99'999 - 1m becomes -1m. This is necessary as floating point numbers have finite precision and the encoder would otherwise start to loose precision over time. The first wheel is the front left, 2nd is the front right, and then row-by-row.</field> | ||
<field type="float[16]" name="distance" units="m">Distance traveled by each wheel. The distance wraps around after 100000m, so 99'999 + 1m becomes 1m and -99999 - 1m becomes -1m. This is necessary as floating point numbers have finite precision and the encoder would otherwise start to loose precision over time. The first wheel is the front left, 2nd is the front right, and then row-by-row.</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
99'999 to 99999
@pavloblindnology @LorenzMeier Outside of this immediate discussion, can we have a call sometime to discuss more general ideas around Rover and MAVLink. For example, frame types, providing great integration with other robotics libraries (e.g. ROS), etc? This could be done in a dev call, or probably even better in a specific meeting. FYI there is an RFC in progress that may be relevant https://github.com/mavlink/rfcs/blob/2b5bc9dbea620fc15e8e3a241168850297b3d8ff/text/0002-local-frames-revision.md |
Typo fix, will be squashed.
@pavloblindnology I forgot to answer on the wrap-around of the number: It seems a prudent thing to do to not run into this later on. You're not going to run into this any time soon, but at least the spec lays out clear suggestions how things should be done. |
message_definitions/v1.0/common.xml
Outdated
<description>Cumulative distances traveled by each wheel (forward rotations increase these values, backward - decrease).</description> | ||
<field type="uint64_t" name="time_usec" units="us">Timestamp (synced to UNIX time or since system boot)</field> | ||
<field type="uint8_t" name="count">Number of wheels reported</field> | ||
<field type="float[16]" name="distance" units="m">Distance traveled by each wheel. The distance wraps around after 100000m, so 99999 + 1m becomes 1m and -99999 - 1m becomes -1m. This is necessary as floating point numbers have finite precision and the encoder would otherwise start to loose precision over time. The first wheel is the front left, 2nd is the front right, and then row-by-row.</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LorenzMeier
Where using the words "should" and "must" is better for defining a standard.
Perhaps:
Distance traveled by each wheel. The distance must wrap around after 100000m ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavloblindnology How is the wheel mapping then done? The reason I ask is that setting this will avoid weird errors for users of the message in the future.
Mapping is done experimentally by rotating each wheel and seeing which distance
array value is changing and then by specifying displacement for each wheel in corresponding mavros plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LorenzMeier Any comments in response to #1032 (comment) ?
Based on that post and this thread, IMO:
-
we (you) should update to doubles (or whatever). @pavloblindnology is OK with this, and in any case will be no worse off with this (and other systems need not have his system's limitation so this will be useful).
-
"The first wheel is the front left, 2nd is the front right, and then row-by-row."
- Just to be clear, can you confirm that the reason this does not work is that the mapping of encoders to vehicle wheels is not necessarily 1:1 or predictable. So you might have a 4 wheel vehicle, but only report 1 or 2 wheels (and which wheels is up to you)?
- If so, I agree, we definitely cannot do it this way. To do this we'd need to know how many wheels are present, which ones have assigned encoders and the geometry (which we might have from the vehicle type). Possible, but a lot more data to send. Doubt it is worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Just to be clear, can you confirm that the reason this does not work is that the mapping of encoders to vehicle wheels is not necessarily 1:1 or predictable. So you might have a 4 wheel vehicle, but only report 1 or 2 wheels (and which wheels is up to you)?
- If so, I agree, we definitely cannot do it this way. To do this we'd need to know how many wheels are present, which ones have assigned encoders and the geometry (which we might have from the vehicle type). Possible, but a lot more data to send. Doubt it is worth it.
Yes, absolutely. It's up to user to decide how many, at which wheels and in what order to install encoders. E.g., Ardupilot Rover firmware uses up to two encoders (link) with the next prescription in case of two-wheeled config:
Connect motor encoder’s A and B outputs to the flight controller (i.e. Pixhawk’s) AUX OUT 3,4,5 and 6 pins. Normally 3,4 should be used for the left motor’s encoder, 5,6 for the right’s.
This means that the left wheel is reported through the 1st value of distance
array and the right through the 2nd. But it's up to user to guarantee this. And user is free to change the config on his own in case he uses his own firmware or uses the wheel distances in mavros plugin, etc.
message_definitions/v1.0/common.xml
Outdated
<!-- Rover specific messages --> | ||
<message id="9000" name="WHEEL_DISTANCE"> | ||
<description>Cumulative distances traveled by each wheel (forward rotations increase these values, backward - decrease).</description> | ||
<field type="uint64_t" name="time_usec" units="us">Timestamp (synced to UNIX time or since system boot)</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LorenzMeier in the source ArduPilot issue I suggested that we might change name="time_usec"
to name="time"
(or name="timestamp"
).
@amilcarlucas Suggested here ArduPilot#55 (comment) that it should be kept the same for consistency and code simplicity reasons.
Don't know if you have an opinion.
Had a chat to @auturgy about this. Wrapping provides clear guidance to what the autopilot should do, but this doesn't help the consumer of the message if this is exceeded. IF it is likely that 100km could be exceeded in future and there are alternatives, we should not constrain to this. |
Well, with my current configuration, wrapping of int32 encoder tick counter in Ardupilot leads to a distance limit of ~75km which is even less than 100km, while 1 tick measures ~3e-5m (= 75km / 2147483647) - accuracy not achievable by float, though I'm not sure it's needed. |
Given this message gets probably consumed by an onboard computer, is bandwidth a real concern here? I can tell from experience that the loss of precision with float will come back to haunt us as it’s going to affect absolute precision. I’m ok changing the wheel assignment to a recommendation, but please be aware that it means you loose compatibility. |
Yes, message is consumed by on-board computer. If there is no tough limitations on bandwidth then i'm ok with changing floats to doubles. Though, again, with my current configuration int32 encoder tick counter is the limiter, and not the floats.
Well, some robots (like my current configuration for example) just don't have any encoders at front wheels, or have single one at some other wheel, so any assignment like |
@LorenzMeier Any comments in response to #1032 (comment) ? |
@LorenzMeier @pavloblindnology
Will we ever need more than 16 wheels? If not, does anything else need to be done? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hamishwillee LGTM. Doubt I'll ever need more than 16 wheels. Usually they are used for odometry and 16 is more than enough to do it, even 2, 4 is enough for the most of applications.
message_definitions/v1.0/common.xml
Outdated
<description>Cumulative distances traveled by each wheel (forward rotations increase these values, backward - decrease).</description> | ||
<field type="uint64_t" name="time_usec" units="us">Timestamp (synced to UNIX time or since system boot)</field> | ||
<field type="uint8_t" name="count">Number of wheels reported</field> | ||
<field type="float[16]" name="distance" units="m">Distance traveled by each wheel. The distance wraps around after 100000m, so 99999 + 1m becomes 1m and -99999 - 1m becomes -1m. This is necessary as floating point numbers have finite precision and the encoder would otherwise start to loose precision over time. The first wheel is the front left, 2nd is the front right, and then row-by-row.</field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Just to be clear, can you confirm that the reason this does not work is that the mapping of encoders to vehicle wheels is not necessarily 1:1 or predictable. So you might have a 4 wheel vehicle, but only report 1 or 2 wheels (and which wheels is up to you)?
- If so, I agree, we definitely cannot do it this way. To do this we'd need to know how many wheels are present, which ones have assigned encoders and the geometry (which we might have from the vehicle type). Possible, but a lot more data to send. Doubt it is worth it.
Yes, absolutely. It's up to user to decide how many, at which wheels and in what order to install encoders. E.g., Ardupilot Rover firmware uses up to two encoders (link) with the next prescription in case of two-wheeled config:
Connect motor encoder’s A and B outputs to the flight controller (i.e. Pixhawk’s) AUX OUT 3,4,5 and 6 pins. Normally 3,4 should be used for the left motor’s encoder, 5,6 for the right’s.
This means that the left wheel is reported through the 1st value of distance
array and the right through the 2nd. But it's up to user to guarantee this. And user is free to change the config on his own in case he uses his own firmware or uses the wheel distances in mavros plugin, etc.
Thanks @pavloblindnology. I think this is good to go. @LorenzMeier @auturgy - we've all be around the loop on this a few times. I believe it does what is expected. If there are no comments by Monday I plan to push this in. |
@pavloblindnology since this is merged can you please rebase and update the MAVROS pull request so we can bring it in? Thanks! |
I also somewhat feel we need a party to celebrate getting this in :-) Thanks @pavloblindnology for your patience. |
@hamishwillee Thanks, but I'll consider the story ended when mavros and ardupilot parts are merged :) |
@TSC21 @hamishwillee Mavros and Ardupilot part has been updated. |
The WHEEL_DISTANCE is the first of a set of rover messages intended to allow easier integration of ground vehicles.