PX4 1.14 actuator_controls topic replacement

I am upgrading some legacy code from PX4 1.11 to 1.14 and a lot of changes to the mixer/control allocation system have broken our custom module.

Previously, we would set actuator positions with:

#include <uORB/topics/actuator_controls.h>
...
uORB::Publication<actuator_controls_s>	_actuator_controls_1_pub{ORB_ID(actuator_controls_1)};
uORB::Publication<actuator_controls_s>	_actuator_controls_2_pub{ORB_ID(actuator_controls_2)};
...
// Publish control values to servos and motors
actuator_controls_s contr; // Flaps
actuator_controls_s contr2; // Motors

if (drover_mode) {
	contr2.control[5] = drover_yaw;
	contr2.control[6] = drover_throttle;

	contr.control[4] = flap1_value;
	contr.control[5] = flap2_value;
	contr.control[7] = flap3_value;
	contr.control[6] = flap4_value;
} else if (_armed) {
	contr2.control[5] = actuator_controls_0.control[2];
	contr2.control[6] = actuator_controls_0.control[3];

	contr.control[4] = flap1_value;
	contr.control[5] = flap2_value;
	contr.control[7] = flap3_value;
	contr.control[6] = flap4_value;
} else {
	contr2.control[5] = 0;
	contr2.control[6] = 0;

	contr.control[4] = 0;
	contr.control[5] = 0;
	contr.control[7] = 0;
	contr.control[6] = 0;
}
contr.timestamp = hrt_absolute_time();
contr2.timestamp = hrt_absolute_time();

_actuator_controls_1_pub.publish(contr);
_actuator_controls_2_pub.publish(contr2);

but I see the actuator controls topic has now been replaced. How would you go about achieving a similar goal to the actuator_controls topic in 1.14?

1 Like

Did you figure it out @Aidan ? I need to implement a piece of code which was originally written using actuator_controls_0

Please read the v1.14 release notes, which include an upgrade guide covering this topic.