We are trying to control a Pixhawk 4 mini externally using an companion computer (Raspberry Pi CM4). We communicate with the Pixhawk using UART and we are using the microRTPS-bridge.
We are having some problems getting the drone into “offboard” mode.
When we try to set the drone into “offboard” mode via ROS 2, nothing happens.
When we try to set the drone into “offboard” mode via QGroundControl or a radio we get “offboard rejected” error.
What we have done
- Written ROS 2 packages based on the “offboard control” example.
- Simulated the system in Gazebo using the “software in the loop” simulation from PX4-Autopilot repo.
- Setting everything up on the real drone and checked that the “trajectory_setpoint” messages reaches the Pixhawk using the command “listener trajectory_setpoint” in the pixhawk shell (via QGroundControl).
What we know
- The code should work, by simulating in Gazebo.
- Pixhawk receives a constant stream of setpoints, 20Hz.
We have used hours on this and do not know why it does not work.
One single time, we actually were able to set the Pixhawk into “offboard” mode from QGroundControl, and then when changing setpoint to z=-5.0, the motors increased speed. But, did not work before or after. Seems random that it worked that one time.
By listening to the “trajectory setpoint” topic on the Pixhawk from the Pixhawk-shell, it sometime seems like there is some other application also publishing setpoint data. Could this potentially mess with the “constant stream of setpoint” requirement?
Any suggestions are appreciated, thanks