GCS_MAVLink_Copter: implement yaw control in guided do_reposition#32814
Open
tedtasman wants to merge 1 commit intoArduPilot:masterfrom
Open
GCS_MAVLink_Copter: implement yaw control in guided do_reposition#32814tedtasman wants to merge 1 commit intoArduPilot:masterfrom
tedtasman wants to merge 1 commit intoArduPilot:masterfrom
Conversation
Author
|
For reference, here is the test mission I used: await controller.set_mode("GUIDED")
await controller.set_message_interval(MAVMessage.GLOBAL_POSITION_INT, 500_000)
await controller.arm()
await controller.takeoff(0, 20)
await asyncio.sleep(5)
coord_1 = Coordinate(latitude_deg=-35.362139, longitude_deg=149.1638792, altitude_m=30, heading_deg=180)
await controller.send_reposition(coord_1)
await controller.wait_for_position_reached(coord_1, 20, 60)
coord_2 = Coordinate(latitude_deg=-35.362139, longitude_deg=149.1638792, altitude_m=10, heading_deg=45)
await controller.send_reposition(coord_2, relative_yaw=True)
await controller.wait_for_position_reached(coord_2, 20, 60) |
handle_command_int_do_reposition now unpacks param4 to get target yaw from MAV_CMD_DO_REPOSITION packet. Also checks the MAV_DO_REPOSITION_FLAGS_RELATIVE_YAW bit in param2
1a9389d to
74fb554
Compare
Contributor
|
Nice! Good work. Would you consider taking the test your wrote and adding that to the pull request? In the autotest suite (Tools/autotest/arducopter.py), you can use functions like From inspection, the code change looks good. |
peterbarker
requested changes
Apr 18, 2026
Contributor
peterbarker
left a comment
There was a problem hiding this comment.
Please add an autotest or two showing this working.
If ArduPilot starts to support this then ground control stations will start to send it.
Older ArduPilot simply won't follow the extra arguments (rather than rejecting the command)..... could be a problem in certain circumstances. Just noting it here, I don't think it's a show-stopper for this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handle_command_int_do_reposition now unpacks param4 to get target yaw from MAV_CMD_DO_REPOSITION packet. Also checks the MAV_DO_REPOSITION_FLAGS_RELATIVE_YAW bit in param2
Classification & Testing (check all that apply and add your own)
Description
logs.zip
Attached are two logs for the same commands, pre.BIN and post.BIN, before and after the change respectively. The commands send the copter to one position with a yaw of 180º (pi in radians) with relative_yaw=0. The second command sends the copter to the same position at a lower altitude, with relative_yaw=1 and yaw of 45º (pi/4). Without the change, the copter does not follow the requested angles. With the change it does.
Before:

After:
