Command PWM directly from Pixhawk 5x using ROS2 messages over RTPS link

Hi
Is there a way to command PWM output from MAIN 1…4 directly using ROS 2 messages? I have RTPS link setup to exchange messages with Pixhawk over UDP. PX4-ROS2 bridge is also working.
I am using Raspberry Pi 4 model B as my high level controller and would like to run the full control logic on it. Unfortunately it has only 2 PWM outputs. I am using Pixhawk 5x as sensor integrator to get the sensor values (position, velocity, attitude and angular velocity) into Raspberry Pi 4 for the control logic.

Hello,

I haven’t tested this px4_msgs topic myself but you could try using ActuatorMotors.msg from this repo. You could also try normalizing your PWM values to command them since the output control is ranged from [-1, 1]. I am going to test this out myself when I get time.

Thanks for the suggestion @adk4davsys . I am trying it out in the coming days. Will let you know the results.

Hi @karanjotsingh010, were you able to get this working? Or did you find any other alternative?