Skip to content
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

Added mission type to MAVLink mission_count message #1207

Merged
merged 1 commit into from
May 15, 2020

Conversation

hdino
Copy link

@hdino hdino commented May 14, 2020

This pull request fixes the following bug:

While uploading the waypoints to the UAS, a mission_count message is sent. The struct mavlink_mission_count_t has a field mission_type, which was not set and therefore had a random value (so in most cases 0). You can find the possible values in MAVLink's common.h. I set it to MAV_MISSION_TYPE_MISSION.

Best,
Dino

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

Good find @hdino

This is a particularly troubling patch given the number of mavlink2 extensions that are now in use out there.

valgrind may find these, but adopting a pattern which reliably initialised the message on the stack would be a better approach.

@hdino
Copy link
Author

hdino commented May 14, 2020

@peterbarker Indeed! I guess the best way would be if the MAVLink C++ types had a constructor that takes values for all message fields as parameters. Then it's impossible to miss one (as long as the default constructor isn't used...).

@peterbarker
Copy link
Contributor

peterbarker commented May 14, 2020 via email

@hdino
Copy link
Author

hdino commented May 15, 2020

Yes, the C++ bindings are basically the same as the C bindings. I use them in my projects because then the MAVLink stuff doesn't flood the global namespace. However, they don't provide constructors other than the default one. So I suggest asking the pymavlink developers what they think about adding an additional value constructor.

Currently, some MAVLink types are initialized with memset(0), but 0 is probably not the value you want.

Do you have another idea, how the messages could be reliably initialised?

@Arne-W Arne-W merged commit f4b39d8 into ArduPilot:master May 15, 2020
@Arne-W
Copy link
Contributor

Arne-W commented May 15, 2020

I just can repeat peter - good finding! Thanks for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants