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
Field name clash in some MAVLink messages #243
Comments
This also appears to affect Java as well - see https://groups.google.com/g/mavlink/c/9cRgGSRzCLw/m/x9TDaLAiCAAJ @peterbarker For the java case (at least) they solved the problem by modifying the generated code for the id case. Is it worth thinking about doing this automatically for a couple of key field names - like id and name? |
@hamishwillee I think ideally we remove Sadly, that's a significant change and likely to break a lot of stuff. I believe we upped and broke the API for Java - that's less an option for the python bindings given their widespread use. We could probably start towards moving people off using The message ID should always we available with BTW, the problem is getting worse over time: where we move the data to I don't know. Fundamentally you can't use class attributes to store information about the message and also use the fieldnames as attributes on instances of the class. I expect we'll choose to just prepend underscores where we aren't storing the data elsewhere), so e.g. While this is all rather messy - but its been this way for a very long time :-) |
@peterbarker Thanks very much. The only thing I know for sure is that we should either fix this or explicitly state that we're not going to; not just leave it as an open issue. Prepending underscores for the general attributes of the message like id makes sense to me. But as there doesn't appear to be any non-breaking solution I'm more concerned about agreeing a deprecation plan. Will be lead by you. Can you talk to @tridge about what his preferred solution might be? |
On Wed, 13 Jan 2021, Hamish Willee wrote:
@peterbarker Thanks very much. The only thing I know for sure is that we should either fix this or explicitly state that we're not going to; not just
leave it as an open issue.
I'm not sure that's always the case.
Sometimes something isn't worth attacking until you hit some other major
related problem, and tips it over the edge to "has to be done now"....
In this case we should at least work out how we'll do it when it comes to
it.
|
I think we should rename the fields to have an _ prefix |
OK. So @peterbarker I'll keep an eye on this to see if you decide to fix this and what the roll out/mitigation plan is. |
On Tue, 19 Jan 2021, Hamish Willee wrote:
OK. So @peterbarker I'll keep an eye on this to see if you decide to fix this and what the roll out/mitigation plan is.
@amilcarlucas put his hand up to make these changes.
I expect there are going to be some wails of anguish as we up-and-kill a
whole bunch of semi-broken things.....
|
Great. @amilcarlucas Any movement on this? |
No, not yet. Basically I need to do:
but I have not done it yet :( |
Nope :( not that simple. |
In
mavgen_python.py
, all generated MAVLink message types have two class attributes,id
andname
, expressing the MAVLink message type.However, these class attributes clash with the MAVLink messages with fields called
id
andname
!Indeed:
LOG_ENTRY
,LOG_REQUEST_DATA
,LOG_DATA
,DISTANCE_SENSOR
,BATTERY_STATUS
,COLLISION
have anid
field;DEBUG_VECT
,NAMED_VALUE_FLOAT
,NAMED_VALUE_INT
,UAVCAN_NODE_INFO
,DEBUG_FLOAT_ARRAY
have aname
field.This name clash can cause problems in code depending on the semantics of the
name
andid
attribute. Example:The text was updated successfully, but these errors were encountered: