-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
common: allow negative temperatures for ESC_INFO message #1663
Conversation
@julianoes @MaEtUgR FYI |
So this changes ESC temperature information in WIP message from range
|
@hamishwillee 's comments/queries should be addressed. |
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.
A bitfield as an extension might achieve the same intent, defaulting to 0 as a positive temp - ie [0000] - which should then be trimmed. I believe that this would make this a non breaking change. Whilst it is WIP, and hence breaking changes permitted, my understanding is that this is implemented in the wild, ie PX4 stable releases (https://github.com/PX4/PX4-Autopilot/blob/9e4a04f58ab655c5129c0349c69cf70f472a3c51/src/modules/mavlink/mavlink_messages.cpp#L74), so regardless of our intent here in MAVLink, it can't be trivially broken.
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.
@cmic0 I re-read my notes from the devcall. They indicate that there is only very weak justification for negative temperatures, and that despite the fact that this is WIP, that it is already in a released version of PX4 and ROS. The proposal is therefore a breaking change.
The dev call essentially said:
- If you're going to do this, a mavlink 2 extension of a bitfield is one way you can do it compatibly - ie map bits with value 11 to indicate values in the temperature array represent negative value. You might alternatively have a separate array for negative temperatures, though that would be less efficient, particularly if we extend this again later.
- Contact the original author and ROS to let them know/discuss impacts.
Personally, on further consideration, I am somewhat opposed to this change. If we add a bit field we significantly increase the complexity of the implementation for users for a use case for which we have no compelling justification. I don't think it is worth it.
On the other hand, if you are willing to manage a breaking change to the temperature field - which will require the agreement/management of the affected parties - then it is worth it to have a single field that is simple to implement and understand.
Hope that makes sense. Either way the first step is to talk to ROS and the original author. It might be this could be made as a breaking change and we suck up the hassle - if there are only a few users "in practice". After all, that is why WIP exists.
FYI @auturgy @julianoes
I think in general having a field definition for temperature which not supports negative temperatures is wrong. I had a look at the lower lever protocols adopted for ESC communication like UAVCAN (v0) and DSHOT and they both support negative temperatures, so with the current message definition (and the PX4 implementation) we're just truncating relevant information. Looking further ahead, knowing the exact temperature of the ESCs/Motors can be really important in applications where fuel/gas engines are being used on the vehicle.
I do agree on this path. In terms of breaking change i will keep care of updating the PX4 side as well. @RicardoM17 seems that you were one of the adopters of this message for your MAVROS offboard control, were you maybe aware of other projects adopting 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.
Hi @cmic0 .
In the original PR (#1322 ) adding negative temperatures was discussed. I believe that the main conclusion was that for a first implementation using only positive temperatures was good enough, but it was also something that could be revisited in the future (like now). I was also leaning towards including this but the discussion was already too long so it was merged as is.
From our side this won't break the workflow we implemented (though I'm no longer in that project). I was also not aware of any other projects using it, so it shouldn't be a problem for that. Up to this point I approve all of these changes.
That being said I can add one suggestion. Since you are changing from uint8
to int16
to allow for the negative range we might want to consider changing it in a way that it also increases resolution which was something that was also discussed at some point. With an int16
representing degC we will be using around 0.5% of the range at best which seems like a huge waste to me.
The ardupilot had a similar implementation using 1/10 or 1/100 of a unit instead (I believe for voltage). This can easily fit in a int16
for example.
Also if this does move forward let me know so that I can make the changes to update this on the MAVROS side.
56f6843
to
c52dfc3
Compare
Based on the messages above I've just updated this PR to have the temperature field defined as int16, furthermore i also added as extension the In both the cases i am using the cDegC unit to achieve +/- 327 to 2 decimal places as @hamishwillee suggested. Thoughts? |
@auturgy You OK with the design of the new message? I know you don't use it in ArduPilot, but "would you be OK with it if you did"? |
I'd like to see an argument for including the motor temperature in this message rather than separate it out: mainly because it will rarely be used and adds an array that can't be trimmed. |
Yes - will be corrected.
Good point - will fix.
Fine for me - once we're settled on the specification i'll open a PR on PX4 side before merging here.
To maybe address @auturgy observation, I could define the temperature as for other MAVLink types where the field is populated with 0 if PS: also added |
c52dfc3
to
079bc39
Compare
That would actually not allow trimming unless the An (undesirable) option would be a configuration field that states the temperature is motor or ESC. So on occasion you could send this with motor temp Or another message for the motor temperature, when you discover that you actually need it. As suggested by @auturgy @auturgy This is the low rate message, which is already quite large. I don't argue that we generally don't want bigger messages, but is this really such an issue?
Excellent idea whatever else we do here. |
I’d prefer a separate message, and I’d prefer that the failure flag not mention ESC: just MOTOR_FAILURE_OVERTEMP
That would generalise for motors not driven by an ESC, and removes the scope creep from this particular PR.
Regards,
James
… On 11 Aug 2021, at 5:06 pm, Hamish Willee ***@***.***> wrote:
To maybe address @auturgy observation, I could define the temperature as for other MAVLink types where the field is populated with 0 if motor_temperature is not provided, and fill with 0.01C if the motor is actually at 0C. This should enable message trimming, thoughts?
That would actually not allow trimming unless the motor_temperature was indeed an extension field - because the ordering of the fields pushes smallest ones last, and these are what get trimmed. And we don't want it to be an extension field because extension fields are the only ones checked for compatibility. Also because as soon as you further extend the trimming doesn't happen.
An (undesirable) option would be a configuration field that states the temperature is motor or ESC. So on occasion you could send this with motor temp <field type="uint8_t" name="temp_type" instance="true">If 0, the temperature is ESC temp, if 1, it is motor temp.</field>
Or another message for the motor temperature, when you discover that you actually need it. As suggested by @auturgy
@auturgy This is the low rate message, which is already quite large. I don't argue that we generally don't want bigger messages, but is this really such an issue?
PS: also added ESC_FAILURE_MOTOR_OVER_TEMPERATURE to ESC_FAILURE_FLAGS
Excellent idea whatever else we do here.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@cmic0 Let's motor temperature be removed to a separate message then. @auturgy Not sure about MOTOR_FAILURE_OVERTEMP. If we move motor temperature out then failures in the motor should move out too. Arguably you could keep ESC_FAILURE_MOTOR_OVER_TEMPERATURE though to reflect it is an ESC failure cause by motor failure [don't know if this is a useful distinction]. |
I haven’t dug into those flags, but motors and ESC’s are different things - if they’re being conflated, it’s wrong.
… On 12 Aug 2021, at 8:27 am, Hamish Willee ***@***.***> wrote:
@cmic0 Let's motor temperature be removed to a separate message then.
@auturgy Not sure about MOTOR_FAILURE_OVERTEMP. If we move motor temperature out then failures in the motor should move out too. Arguably you could keep ESC_FAILURE_MOTOR_OVER_TEMPERATURE though to reflect it is an ESC failure cause by motor failure [don't know if this is a useful distinction].
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@auturgy The other flags are fine. My argument was that the proposal to rename the new flag from The implied question is "does ESC_FAILURE_MOTOR_OVER_TEMPERATURE" also conflate them. I think it does, so probably the best thing is as you have proposed create a new message that covers motor faults - and here I am assuming we're talking electric motors controlled by ESC, not motors "generally". |
As discussed in dev call with @cmic0 . The plan is to
The argument for this approach is future proofing. ESC used extensively now, but approach might change. Generic motor message might be sufficient for many users and we can perhaps in future layer specific motor types on top. Hope that matches your recollection Claudio! |
Perfectly resumed @hamishwillee :-), you were faster in typing the summary! |
Signed-off-by: Claudio Micheli <claudio@auterion.com>
01a3bfb
to
6a80172
Compare
@RicardoM17 i've opened the PR on PX4 side to align with those changes, let me know if you want to go ahead in making the PR for mavros or if I should do it 👍 |
Sounds good Claudio. I can take care of the changes in mavros 💪 |
Thanks @cmic0 and @RicardoM17 . This is what was agreed in dev call so I will merge. FYI @auturgy Note @cmic0 hoping to see that follow up motor information message at some point! FYI As discussed, we are happy not to remove this WIP at this point, but we will want to sometime. |
It's on the list, if i recall correctly i even have the branch ready, got probably sidetracked before pushing to create a PR for discussing it :-)! Thanks for the support @hamishwillee @auturgy @RicardoM17! |
…1663) Signed-off-by: Claudio Micheli <claudio@auterion.com>
This PR changes the temperature range of ESC_INFO to allow negative temperatures.