Skip to content

Commit

Permalink
fixing handling of attitude setpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAntener committed Mar 15, 2015
1 parent 030a96a commit 6f22cd0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/platforms/ros/nodes/mavlink/mavlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,19 @@ void Mavlink::handle_msg_set_attitude_target(const mavlink_message_t *mmsg)
*/

att_sp.timestamp = get_time_micros();
mavlink_quaternion_to_euler(set_attitude_target.q, &att_sp.roll_body, &att_sp.pitch_body,
&att_sp.yaw_body);
mavlink_quaternion_to_dcm(set_attitude_target.q, (float(*)[3])att_sp.R_body.data());
att_sp.R_valid = true;
if (!ignore_attitude) {
mavlink_quaternion_to_euler(set_attitude_target.q, &att_sp.roll_body, &att_sp.pitch_body,
&att_sp.yaw_body);
mavlink_quaternion_to_dcm(set_attitude_target.q, (float(*)[3])att_sp.R_body.data());
att_sp.R_valid = true;
}


if (!offboard_control_mode.ignore_thrust) {
att_sp.thrust = set_attitude_target.thrust;
}

if (!offboard_control_mode.ignore_attitude) {
if (!ignore_attitude) {
for (ssize_t i = 0; i < 4; i++) {
att_sp.q_d[i] = set_attitude_target.q[i];
}
Expand Down

0 comments on commit 6f22cd0

Please sign in to comment.