Unexpected Vertical Acceleration and Climb When Switching from Position Control to Acceleration Control (Pixracer, MAVROS, Offboard Mode)

I am using a Pixracer flight controller and controlling my drone via a Python script in Offboard mode. I send control commands using the mavros/setpoint_raw/local topic.

Before switching to acceleration control, the drone is in position control mode (still using setpoint_raw/local).
When I switch from position control to acceleration control, there is a probability that the drone suddenly experiences an unexpected vertical acceleration and starts climbing rapidly.

Implementation Details

  • Both position control and acceleration control are sent via mavros/setpoint_raw/local.
  • In position control mode, I set the type_mask to use position setpoints.
  • In acceleration control mode, I set the type_mask to use acceleration setpoints.

Questions

  1. Is there any known issue with switching between position control and acceleration control in setpoint_raw/local?
  2. Does PX4 apply any internal transitions or interpolations when switching control types that could cause this behavior?
  3. What is the best way to ensure a smooth transition from position control to acceleration control?

Any insights or suggestions would be greatly appreciated!

1 Like