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

Ardupilot mission handling and vehicle type checking #1562

Merged
merged 6 commits into from
Sep 23, 2021

Conversation

DaRavenox
Copy link
Contributor

Adds support to mission_raw to upload, start missions and clear missions when the autopilot is ArduPilot.

Further adds support to grab the vehicle type from the HEARTBEAT message, and to use this to determine what the correct mode command is for a ArduPilot vehicle, since this depends on the type.

Copy link
Collaborator

@JonasVautherin JonasVautherin left a comment

Choose a reason for hiding this comment

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

Nice! Just a nitpick for a switch 😇

_ap_mode = to_ap_mode_from_custom_mode<APRoverMode>(heartbeat.custom_mode);
break;
default:
_ap_mode = to_ap_mode_from_custom_mode<APCopterMode>(heartbeat.custom_mode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
_ap_mode = to_ap_mode_from_custom_mode<APCopterMode>(heartbeat.custom_mode);
_ap_mode = to_ap_mode_from_custom_mode<APCopterMode>(heartbeat.custom_mode);
break;

Auto_Rotate = 26,
Auto_RTL = 27,
Turtle = 28
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about moving these enums to a separate header file like https://github.com/mavlink/MAVSDK/blob/main/src/core/px4_custom_mode.h?

src/plugins/mission_raw/mission_raw_impl.cpp Show resolved Hide resolved
@@ -50,6 +50,52 @@ class SystemImpl : public Sender {
Stabilized,
};

// Enumeration representing the available modes for the Arudpilot rover autopilot.
enum class APRoverMode {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usually we try the convention to lowercase acronyms like so: ApRoverMode, however, I assume you copied them from somewhere, so then maybe it's better leave em as is.

@DaRavenox
Copy link
Contributor Author

Heya, sorry about the number of changes. Had a chat with Seb and we decided on hiding the ardupilot mode behind flight_mode, so now I translate back and forth from it.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Any objections @JonasVautherin? Nevermind.

@julianoes julianoes merged commit 5093510 into mavlink:main Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants