-
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 new PWM output message #926
Conversation
ce1d7b6
to
a7a35b6
Compare
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.
Do not add units in the description fields, it is redundant.
And ... it is non machine parseable.
And we want to encourage GCS to use the attribute field, right ?
This PR should also mark the old message as deprecated |
OK, I added the zero values text and removed the units from descriptions. Just FMI, can you confirm that
Doesn't that happen after we've started implementing it in Autopilots? |
Can everyone re-review and confirm they are happy for this to be merged? |
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.
I know we discussed on the call making this an array instead (which allows users to easily iterate over it). Was that rejected for some reason? (I don't recall if we locked in that we wanted it or not at this point)
message_definitions/v1.0/common.xml
Outdated
@@ -4774,5 +4774,25 @@ | |||
<field type="float[5]" name="delta" units="s">Bezier time horizon, set to NaN if velocity/acceleration should not be incorporated</field> | |||
<field type="float[5]" name="pos_yaw" units="rad">Yaw, set to NaN for unchanged</field> | |||
</message> | |||
<message id="340" name="PWM_OUTPUT_STATUS"> | |||
<description>The RAW values of the PWM outputs. Zero values indicate unused channels. The standard PPM modulation is as follows: 1000 microseconds: 0%, 2000 microseconds: 100%.</description> |
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.
This is describing PWM not PPM channels. The standard description also doesn't map to a lot of exsisting hardware or actuators, and I'd probably say it's worth just removing that part.
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.
How would you re-write 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.
I'd drop the entire sentence about standard PPM modulation. Probably not worth capitalzing the RAW
part in the first sentence either.
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.
Makes sense to me. Done in https://github.com/mavlink/mavlink/pull/926/files#diff-ceacc1e2390186650146a45be8fcb691
I don't recall the discussion. If this was last week, I wasn't there :-) FWIW it sounds like a good idea. Would unused (zero value) elements be truncated from the array? If so, that might well be another benefit. |
I was suggesting it during the call since it allows GCS's/AutoPilots to easily just iterate over the array (which you can technically do by casting right now, but that's a dirty hack that only happens to work at the moment because of the packing). The zero truncation would happen either way, the main advantage of using 0 for the no value is that it works well with any future extensions. |
@LorenzMeier @amilcarlucas You OK with turning the individual outputs into an array? I have no reason to doubt it will be easier for GCS to process. Otherwise this looks good to me. @amilcarlucas As above, I think deprecation happens at some future point after ArduPilot and PX4 have a chance to implement this. That was my understanding anyway. |
Why not make them all signed and add a format enum like UAVCAN? |
Since I don't know UAVCAN example you are talking about:
|
@magicrub Can you please respond to #926 (comment) - @LorenzMeier @amilcarlucas Thoughts on #926 (comment) |
I vote for an array. And no enum, use different message for % if needed. |
The UAVCAN msg I was referring to is equipment/actuator/Command which is which is of a single output:
And then that's in a variable sized array of equipment/actuator/ArrayCommand
This allows for mixed actuator output units with variable length and since the _id is in there you can send them out-of-order or partial packets with servos that update at different rates. However, I agree it's a lot of data and in MAVLink it likely won't be used to it's potential and will just slow down the link. Also what's missing is unit type of "RC PWM" or something that would represent that 1000-2000us PWM signal that this would typically be used for in the near/medium future. |
9c39180
to
f2b4c19
Compare
Sorry, accidental close! |
@magicrub - thanks for the suggestion and explanation. I tend to agree with @amilcarlucas that having multiple messages provides a "cleaner" definition -and it is certainly easier for GCS to parse. We do have some cases where we do use the enum approach, but they tend to be more for internal protocol messages that won't ever have to be exposed via the UI. That said, is it useful to expose the values as a percentage too? |
I have made this an array now.
My assumption is that numbers 1-8 map must map to MAIN and 9-16 map to AUX (if present) - and we should say that. Also that if Aux is not present that does not matter because the values will be 0 (truncated).
If either of these are true, then we would be better off with a field for the index of the affected port and an 8-value array. |
I think this is out of scope for us to be specifying in MAVLink. The output numbering should always be considered to be an attribute of what you are talking to. The concept of main/aux outputs is not something that should be documented here, particularly if it's just a dense array of outputs. I think this meaning will always have to be specific to the autopilot you are communicating with. 0 indicating unused works, but you have an overlap then that we also send 0 as outputs when we are sending no pulses on an otherwise valid channel, and we may start sending values later. If 0 simply means unused a GCS won't be able to differentiate between not sending pulses and not a valid channel. |
@WickedShell I'm OK with that. Still, this does assume a system with max 16 ports. Is it better to have 8 ports per message and have index for which array you're using?
I guess we could add an index for the max valid array index. Or we could use UINT16_MAX for unused - but that then means we can't take advantage of zero-byte truncation. Thoughts? |
Did we decide against adding a uint32 index to allow larger numbers of actuators? Otherwise looks as discussed? |
ccc7f5f
to
6fb2de7
Compare
This new message is streamlined and ensures correct timestamping. It also has improved wording to not be specific to servos. Remove units from descriptions Specify that zero values indicate unused channels. Remove "standard modulation text" PWM_OUTPUT_STATUS: Move to unused ID Outputs as array Update common.xml Update message 375 after discussion on dev call.
6fb2de7
to
ff1abd2
Compare
Replaced by #1148 |
This new message is streamlined and ensures correct timestamping. It also has improved wording to not be specific to servos.
It fixes #153 (comment)
Please comment on the fields and make suggestions for improvements.