-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
RPYrT Support. Format checked. #10892
Conversation
} | ||
|
||
if (_v_control_mode.flag_control_yawrate_override_enabled) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
I'm not sure about this one. If I understand the change correctly aren't we going to have multiple rate setpoints publishing simultaneously? |
@dagar , I don't thnink so, as the yaw rate on the Attitude controller is essentially changed to the yaw rate coming from offboard - gets overriden. In simulation it checks out, primary tests also checked out (but some oscillation after about 15s around the setpoint, but this I have an idea on what might cause it. I plan to do some more flights this week and the next. If all checks out, I will pust logs and videos here. |
@dagar Finally made it to get some time for flight tests. Updated the first PR message with a folder to the logs. TL;DR: rpyt looks fine! |
@dagar I have more flight tests + working version merged with latest master v1.9 . Let me know if I should push it to this branch to be merged |
Discussed in the dev call. @Pedro-Roque rebases on 1.9 state/master and we take a look and do tests such that we can merge it. @julianoes looks for DK support. |
RPYrT Support. Format checked. Fixed small code that did nothing mc_att_ctrl: moved control_attitude routine for yawrate setpoints.
@Pedro-Roque Thanks for rebasing 😉 |
Thank you for helping on it! Updated log folder and PR description. Let me know if there is anything else I can help with EDIT: Just checked that there was some renaming on the mc_pos. Maybe it came from the rebase? Let me know if I should fix it. EDIT2: This is fine, the final version of the code contains the same function names as the master. |
@@ -833,8 +833,10 @@ MavlinkReceiver::handle_message_set_position_target_local_ned(mavlink_message_t | |||
/* yaw ignore flag mapps to ignore_attitude */ | |||
offboard_control_mode.ignore_attitude = (bool)(set_position_target_local_ned.type_mask & 0x400); | |||
/* yawrate ignore flag mapps to ignore_bodyrate */ | |||
offboard_control_mode.ignore_bodyrate = (bool)(set_position_target_local_ned.type_mask & 0x800); | |||
|
|||
// offboard_control_mode.ignore_bodyrate = (bool)(set_position_target_local_ned.type_mask & 0x800); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. also removed l.835
msg/offboard_control_mode.msg
Outdated
@@ -5,6 +5,9 @@ uint64 timestamp # time since system start (microseconds) | |||
bool ignore_thrust | |||
bool ignore_attitude | |||
bool ignore_bodyrate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove? Should be unused now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean ignore_bodyrate? Yes can check on that and remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Removed it and build checks out.
@@ -1383,13 +1401,22 @@ MavlinkReceiver::handle_message_set_attitude_target(mavlink_message_t *msg) | |||
|
|||
/* Publish attitude rate setpoint if bodyrate and thrust ignore bits are not set */ | |||
///XXX add support for ignoring individual axes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment now unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if unnecessary. I implemented Yawrate control, not for the other axis though. Still WIP
EDIT: moved the comment to the Commander, where additional support is needed.
@@ -834,9 +834,17 @@ MulticopterAttitudeControl::run() | |||
!_v_control_mode.flag_control_position_enabled) { | |||
generate_attitude_setpoint(attitude_dt, reset_yaw_sp); | |||
attitude_setpoint_generated = true; | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
This commit adds Roll Pitch Yawrate Thrust (RPYrT) setpoint control to the PX4 stack, enabling the UAV to follow specific yawrates sent from offboard. It also introduces individual body_rate flags, along the lines of mavros. Tested on a MoCap enabled flight arena in KTH Royal Institute of Technology, Stockholm. The MAV receives RPYrT setpoints from an external PID controller to stabilize around position setpoints. The UAV is also externally disturbed to assess the stability to external unmodeled events. Fixed Kabir comments. Removed deprecated ignore_bodyrate. Fixed integration test.
I created a copy to untangle the changes from existing commits on master: #12061 |
@MaEtUgR ok which pull request should I now review? |
I think the one that @MaEtUgR created, @julianoes . |
Test data / coverage
Tested in SITL and flight arena. Here goes a link to the folder with the logs:
https://drive.google.com/open?id=1Ja1JjI3Ggmw383kDTZMdCB0cr3Hd5gfp
Setpoints: All data exchange happens through a SiK Radio (433Mhz), which is way less than ideal for the rates at which we are controlling - I am publishing at 100Hz, but I am pretty sure it can't handle such rates. Iris vehicle with PX4-FMU_v2. These use LPE estimator (these tests were made November 2018). It looks good, except for some points in which the telemetry radio looses connection (makes the UAV drop), but it recovers from it pretty fine. Both position and attitude changes are tested. It seems that the LPE sometimes drops to 0.2m in Z - is there any param I am missing to set? I am running this on an arena with MoCap.
TestWithDisturbances: all data exchanged happends through a Mav-esp with custom firmware. The control frequency is 50Hz, while odometry is fed at 100Hz. Vehicle running Pixracer with the same changes present in this PR. The logs resamble 3 tests on a real UAV performed on a flight arena with Qualisys Mocap. RPYrT setpoints are externally given to the UAV via offboard mode by an in-house developed PID offboard controller, and external unmodeled disturbances are applied to the vehicles. The chain of control is: position setpoint --> PID controller (Offboard) --> RPYrT setpoint --> Attitude controller (onboard).
Describe problem solved by the proposed pull request
Essentially fixes the ignore_bodyrate for all axes, and adds functionality for single-axis only. At the moment, it targets just yawrate control mode.
Describe your preferred solution
Added offboard control mode yawrate, which ignores x and y rates, and uses the z rate as the setpoint for the rate controller. Roll and Pitch setpoints are still used for the attitude control to set the desired UAV attitude. At the moment, the yaw angle is kept to the same one that the UAV has (suggestions for this are welcome!)
Describe possible alternatives
Additional context
Flight tests show that RPYrT setpoints work as expected, as the UAV successfully converges to the right setpoints. Tested successfully in SITL as well.