Getting setpoints and controllers outputs via MAVLink

Hi.

I would like to know if I can get setpoints (position, velocity, attitude, attitude rates), and the controllers outputs (e.g. output of the position controller, velocity controller, attitude controller, attitude rates controller) in real time via MAVLink streams. This would be very useful for some research I am doing regarding online and real-time control tuning.

@TSC21 any hints?

Thanks.

I believe this is already available. For example, https://mavlink.io/en/messages/common.html#ATTITUDE_TARGET

@Jaeyoung-Lim thanks!
I will check if I can get the following messages through MAVROS or MAVSDK.

  • ACTUATOR_CONTROL_TARGET
  • ATTITUDE_TARGET
  • POSITION_TARGET_LOCAL_NED

@Mzahana On mavrosm I am pretty sure you already have it except for the ACTUATOR_CONTROL_TARGET

@Jaeyoung-Lim thanks for the reply. I actually found out that mavros has them all including ACTUATOR_CONTROL_TARGET (https://github.com/mavlink/mavros/blob/master/mavros/src/plugins/actuator_control.cpp#L57)

I just need to figure out how to increase their publication rates as they currently seem to be limited to 10Hz (not sure if the limit is on px4 side or mavros side)

You can do this in Px4 src/modules/mavlink/mavlink_main.cpp starting from around Line nr 1506 there are different streams for every mode, so you can higher the update rate there

@Aleksejs Thanks for the information. I tried your suggestion and it worked, but rates were limited, not sure if there is a message-specific hrad-coded rate limit, or it depends on the communication link. For me, I am testing in SITL and I am not able to get more that 50Hz for ACTUATOR_CONTROL_TARGET, for example, although I set it, here, to 100Hz in.

Another way of changing stream rates is using the /mavros/set_message_interval MAVROS service, and it worked fine with me. The rate limit is still there, though.