Platform details:
- PX4 v1.14
- Pixhawk v6x
- Ubuntu 22.04
- ROS2 Humble
Using the above software/hardware, our research group at UC Berkeley is attempting to control the motors on our quadcopter in offboard mode using a companion laptop. We want to control the specific PWM values or throttle percentages of the motors, control the length of time the motors run at that value, and we would like to be able to control individual motors.
Using QGC to manually control the motors, we can individually control any motor or all motors with full power accurately.
However, we cannot achieve this functionality otherwise. When running code, The motors do not run at the throttle percentage or PWM value we specify in the code, often running at a much slower speed than the value we specified in the code. They also will still run when we specify 0.0 or NaN or -1.0 input, which should not happen according to PX4 generic actuator control documentation. The motors all run at the exact same speed as one another every time, even when we specify different values for different actuators.
We have been rewriting and testing numerous versions of code based on the offboard_control.cpp code example file provided by the PX4 GitHub, but nothing has succeeded in controlling the motors as expected.
We have attempted to utilize ActuatorMotors messages, and VehicleCommand messages with VEHICLE_CMD_DO_SET_ACTUATOR as well as VEHICLE_CMD_DO_MOTOR_TEST. We have tried countless different parameter values for all of these functions, and have tried various values for target_system, target_component, source_system, and source_component in the publish_vehicle_command function. We have also tested various OffboardControlMode message parameter values, including setting msg.direct_actuator to true and everything else false. We have ensured that the topics “fmu/in/actuator_motors” and “fmu/in/actuator_servos” are listed under subscriptions in the dds_topics.yaml file. We have echoed the “fmu/out/vehicle_control_mode” topic and ensured that the control allocation flag is false. We tested setting AUX 1 - AUX 4 in QGC to “Motor X” as well as “Offboard Actuator Set X”. None of this has succeeded.
How do we control our motors/servos/actuators at specified inputs? And how do we do this for individual motors rather than all at once?