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

Plane: Support a set of offboard MAVLink guided controls with rates #13637

Merged
merged 2 commits into from
May 20, 2020

Conversation

davidbuzz
Copy link
Collaborator

Depends on ArduPilot/mavlink#109

This creates extra GUIDED commands for a companion computer to autonomously control not just heading, speed and altitude, but specifically the RATE at which the vehicle 'slews' toward each of it's targets.
These commands have zero effect on a standard vehicle until such time as it is put in GUIDED and also any of these new mavlink command/s are used by a companion computer. Changing vehicle mode to any other mode even briefly reverts to standard behaviour, including standard GUIDED behaviour.
Using any single packet (eg heading) will cause the other behaviour/s (speed and alt) to be left as per normal GUIDED behaviour, but using all three gives full and 3d dynamic control of the vehicle envelope.

@davidbuzz
Copy link
Collaborator Author

davidbuzz commented Feb 21, 2020

Note/s this code (with only slight variations ) has been extensively flown over the last 18months on a number of different branches, starting from 3.8.5, and including 3.9.7 and 4.0-beta1. it's also been simmed a lot too.

@@ -287,6 +326,36 @@ void Plane::Log_Write_Vehicle_Startup_Messages()
gps.Write_AP_Logger_Log_Startup_messages();
}

/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Anything wrong with the existing log_MAVLink_Command?

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.

The mavlink interface should be created in terms of the existing messages, rather than creating new ones.

ArduPlane/defines.h Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
@peterbarker
Copy link
Contributor

To be clear; MAV_CMD_DO_CHANGE_SPEED could get a .acceleration in m/s/s, that sort of thing.

Copy link
Contributor

@WickedShell WickedShell left a comment

Choose a reason for hiding this comment

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

There are a lot of style things that need to be fixed up, and debug prints that need to be removed here, it's actually making a bit hard to review in detail because of that.

ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/Parameters.cpp Show resolved Hide resolved
ArduPlane/Plane.h Show resolved Hide resolved
ArduPlane/Log.cpp Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/Attitude.cpp Outdated Show resolved Hide resolved
@khancyr
Copy link
Contributor

khancyr commented Feb 21, 2020

Interesting, but I don't see the advantages of those messages agains SET_POSITIONS one's in body_frame. They are already able to do this and more with a single interface

@peterbarker
Copy link
Contributor

@khancyr Note these are commands, not messages. Commands give you direct feedback on success/failure.

We do have commands which I believe can be stretched to add the rate parameters - thus my comments here.

@davidbuzz

This comment has been minimized.

@davidbuzz davidbuzz self-assigned this Mar 4, 2020
@davidbuzz davidbuzz force-pushed the offboard-guided-mode-features branch 4 times, most recently from 34b05ab to b70c32c Compare May 12, 2020 22:10
@davidbuzz
Copy link
Collaborator Author

I've just finished flying this latest code around in the sim in GUIDED and sending it the appropriate MAV_CMD_GUIDED_CHANGE_SPEED , MAV_CMD_GUIDED_CHANGE_HEADING, and MAV_CMD_GUIDED_CHANGE_ALTITUDE, and entering/exiting from this with GUIDED and leaving GUIDED mode, and all the expected new behaviours for these are working.

@davidbuzz davidbuzz force-pushed the offboard-guided-mode-features branch from b70c32c to 037bbbd Compare May 12, 2020 23:14
@davidbuzz
Copy link
Collaborator Author

davidbuzz commented May 12, 2020

latest push includes fixes so it builds under HAL_MINIMIZE_FEATURES, hopefully this will get CI to pass. Also now fixed fabs() to fabsf() to avoid double maths.

@davidbuzz davidbuzz force-pushed the offboard-guided-mode-features branch 5 times, most recently from 47bd71e to 6b9c4da Compare May 14, 2020 05:49
@davidbuzz
Copy link
Collaborator Author

davidbuzz commented May 14, 2020

Latest version makes logging more consistent with existing layouts, and fixes a bug i briefly had that crashed sitl due to it doing extra checks on the formatting layout/s of packets, and it now passes test.QuadPlane.LoggerDocumentation CI test. Oh, i've also just extensively re-flown this in sitl triggering all the COMMAND_INT packet types that it uses, and checked they are all logging correctly and displaying their FMTs corrrectly.

ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/GCS_Mavlink.cpp Outdated Show resolved Hide resolved
ArduPlane/navigation.cpp Outdated Show resolved Hide resolved
ArduPlane/navigation.cpp Outdated Show resolved Hide resolved
ArduPlane/system.cpp Outdated Show resolved Hide resolved
ArduPlane/system.cpp Outdated Show resolved Hide resolved
ArduPlane/system.cpp Outdated Show resolved Hide resolved
@davidbuzz davidbuzz force-pushed the offboard-guided-mode-features branch from 6b9c4da to 1327333 Compare May 15, 2020 06:29
ArduPlane/Log.cpp Outdated Show resolved Hide resolved
@davidbuzz davidbuzz force-pushed the offboard-guided-mode-features branch 3 times, most recently from 3cecf1d to 66b044d Compare May 16, 2020 05:23
@davidbuzz davidbuzz requested a review from tridge May 18, 2020 00:50
@tridge tridge force-pushed the offboard-guided-mode-features branch from 66b044d to 9046f05 Compare May 20, 2020 02:04
@tridge
Copy link
Contributor

tridge commented May 20, 2020

I've rebased, fixed the conflict and fixed the submodule update
ok to merge once CI passes

@tridge tridge merged commit cca1a5d into ArduPilot:master May 20, 2020
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.

5 participants