Recording thrust and torque setpoints ROS2

I am currently working on doing some system identification for a custom UAV I have built and I need data to do so, specifically my inputs and outputs of the system. Inputs being the thrust and torque setpoints, outputs being position and attitude.

I am flying my UAV using offboard control with ROS2 foxy and the uXRCE_dds_client with an onboard companion computer and a Vicon system for GPS. This offboard control code is publishing to the vehicle_attitude_setpoint topic.

I can easily record the values for thrust setpoint since I am writing to them directly, as well as position and attitude thanks to the vicon. But recording what PX4’s generic attitude controller is setting the torque setpoint to is a mystery to me.

Is there any way for me to see and record the torque setpoint?

Hi @R_mcc !

You have to record vehicle_torque_setpoint
This topic is not one of the defaul ones so you need to add it manually, see

for instructions.

Compile and then flash!


Yes, I know I can enable the vehicle_torque_setpoint topic through the dds_topics.yaml file when building my px4 version, however it appears I can only enable them as topics px4 will subscribe to not publish to.

What I would like to do is this:

  1. Send my vehicle_attitude_setpoint command to my flight controller via publishing to the /fmu/in/vehicle_attitude_setpoint topic.

  2. Record the vehicle_thrust_setpoint and vehicle_torque_setpoint that the flight controller has turned my vehicle_attitude_setpoint command into.

Assuming I understand the way PX4 and its setpoints work? I am under the impression that at the end ALL setpoints become thrust and torque setpoints, which are then converted into PWM signals for the motors.

I am attempting to do some system identification on a vehicle I have built, and I think having the thrust and torque setpoints generated from my attitude setpoint will help me.


Or better yet, is it possible for me to record the PWM signal being sent to each motor? This would be the best way for me to do my analysis!

You have to add it to the list of publishers, i.e. under publications:.

That should be actuator_outputs (the output of the low lever mixer) or actuator_motors (the output of the control_allocator module)

1 Like

This worked, PX4 is publishing data now! I thought I had tried this before and it hadn’t worked, very strange!

actuator_outputs and actuator_motors are publishing as well! Thank you so much, this is very helpful!

I have encountered another problem however, the uXRCE-dds-client appears to be remaking all published/subscribed topics at irregular intervals? This is causing pauses in the data stream that will be problematic when I am doing offboard control. This did not happen before I had added the new topics to the build. Should I open a new thread for this issue?

That’s great!!

Are you using serial connection?
Try to increase the baudrate and to remove all the unused topics to the bridge.

I am connected over serial. I can’t seem to increase the baud rate any higher than 921600, I see there are more options above it in QGroundControl but when setting it higher the dds agent and client don’t seem to connect.

Regardless, after removing all the topics I wasn’t using from the bridge I have managed to get a stable connection, but only when using one of the actuator_outputs or actuator_motors topics. When using both I have the same issue as before, though luckily I think I only need one of them.

For reference here are all the topics I was having PX4 publish to:


In regards to hardware I am using a Holybro Kakuteh H7 connected to an Odroid XU4 via serial.

If anyone is reading this thread in the future I did find this alternative solution to the instability issue: Microdds_client disconnects with mRo Control Zero H7 · Issue #20843 · PX4/PX4-Autopilot · GitHub
I didn’t attempt it as I only needed the one topic, and felt this would lead to more problems for me in the future, but maybe it will help.

Thanks so much @Benja !

1 Like