Command denied: set_rate_attitude()

Hey guys,

I am trying to get the roll, pitch and yaw angle of my connected pixhawk using mavsdk.
I have written a short script that connects with the pixhawk over usb and then set the rate of attitude to 1Hz:

const Telemetry::Result set_rate_result_attitude = telemetry->set_rate_attitude(1.0); // Attitude
if (set_rate_result_attitude != Telemetry::Result::SUCCESS) {
<< “Attitude->Setting rate failed:” << Telemetry::result_str(set_rate_result_attitude)
<< NORMAL_CONSOLE_TEXT << std::endl;

After that I set up a callback for the attitude:

 // Set up callback to monitor Attitude
telemetry->attitude_euler_angle_async([](Telemetry::EulerAngle euler_angle) {
    std::cout << "Angle Information" << std::endl
        << "\t Pitch: " << euler_angle.roll_deg << std::endl
        << "\t Roll: " << euler_angle.pitch_deg << std::endl
        << "\t Yaw: " << euler_angle.yaw_deg << std::endl;

However, everytime I run the code the console output is:
Attitude->Setting rate failed: Command denied

When I connect the pixhawk with QGroundControl or MissionPlanner and after that run my code (without powering off my pixhawk) I get the attitude values without any problems.

QGroundControl and MissionPlanner must somehow activate something what I am missing. What can that be? What am I missing? Where can I get more documentation about mavsdk? I have tried to read everything on mavsdk but I haven´t found any “preconditions” for attitude or the other properties.

Please help.

Dear Ernsten.

I had the same problem in these days. I don’t know if you’re still interested, but for others, I believe this is a bug in the MAVSDK.

I solved by modifying the set_rate_attitude function in the telemetry_imp.cpp source and recompiling it. It uses the wrong MAVLINK_MSG_ID, i.e., MAVLINK_MSG_ID_ATTITUDE_QUATERION=31.

By using MAVLINK_MSG_ID_ATTITUDE (that is =30) the problem is solved, i.e.:

p, li { white-space: pre-wrap; }

Telemetry::Result TelemetryImpl::set_rate_attitude(double rate_hz)


return telemetry_result_from_command_result(

_parent->set_msg_rate(MAVLINK_MSG_ID_ATTITUDE, rate_hz)); //BUG FIX

I hope it helps.


I have the same problem.
MAVSDK version: v1.4.3

I don’t understand something or am I missing something ? There is no set_rate_attitude_quaternion function, only a set_rate_attitude. When one sets the attitude rate, does the flight controller send all the attitude messages, ie quaterion and Euler or does the flight controller know that the client only listens for quaternion or Euler, for example.

Dear linuxgay,

please, have a look to this topic Telemetry.set_rate_attitude() seems to have no effect · Issue #1569 · mavlink/MAVSDK · GitHub.
Which flight controller are you using? Unfortunately I’m using Ardupilot, as so I have to change/adapt the MAVSDK that is mostly intended for PX4.