PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.58k stars 13.56k forks source link

[Bug] Manual throttle cut when publishing direct actuator controls #24032

Open qtweng opened 6 days ago

qtweng commented 6 days ago

Describe the bug

On the new PX4 uxrce interface, when publishing consistent stream of OffboardControlMode in direct actuator control mode, ActuatorServos, and ActuatorMotors to a Fixed-Wing. Whenever trying to take off in manual mode, as airspeed goes positive, manual throttle is somehow being affected and is getting cut. Verified that it has something to do with vehicles in motion as manual mode can full throttle just fine if aircraft is held down. But when running with the aircraft in hand and throttling with RC causes throttle to oscillate between 1 and 0. This only occurs when an onboard companion computer is communicating with PX4.

To Reproduce

  1. Run PX4 on fixed wing and connect a companion computer using ROS2 uxrce agent
  2. Have ROS2 publishing consistent message to OffboardControlMode, ActuatorServos, and ActuatorMotors
  3. Try to takeoff (or throttle when moving vehicle) in manual mode

Expected behavior

As a stream of OffboardControlMode and the respective Actuator messages must be active when switching to offboard mode. They are required in the background even in other modes, but should not affect other modes.

Screenshot / Media

No response

Flight Log

https://logs.px4.io/plot_app?log=0957a02e-497a-465d-aa68-9dbd69ed181e

Software Version

PX4 1.15.2

Flight controller

Cube Orange Plus

Vehicle type

Fixed Wing

How are the different components wired up (including port information)

No response

Additional context

No response

qtweng commented 6 days ago

https://logs.px4.io/plot_app?log=26a6c52a-d79d-45fa-af19-aa769c393194 Another flight log of the same scenario without positive airspeed.

qtweng commented 4 days ago

Upon further investigation, it appears that it is caused by publication to ActuatorMotors and ActuatorsServos in Manual Mode. It looks like those offboard messages work at a lower level than manual mode which passes through the mixer.

This may just be a documentation fix. Only an active OffboardControlMode signal is required for offboard mode to be toggled. ActuatorMotors and ActuatorServos should not be publishing until offboard mode is active.

beniaminopozzan commented 3 days ago

@qtweng unfortunetely there is not low level handling or routing when publishing setpoints (pos, vel, attitude, rates, thrust/torque, direct). This is a know issue with the only workaround as follows: You publish OffboardControlMode messages but no setpoints. you switch to offboard and only after confirming that you switched you start publishing setpoints (Atuator Motors and ActuatorServos in your case).

You have to be quite fast in detecting offboard mode switch and start publishing setpoints because PX4 will have publish nothing in between. Consider adding a failsafe mechanism in the ROS 2 side that stops the OffboardControlMode publisher so that PX4 can trigger the Offboard control lost failsafe and recover.