# Trajectory Following via acceleration setpoints, which controller to use?

Hi,
I’m developing a visual-inertial localization and navigation method and using rotors simulator and its integrated position controller, together with mav_trajectory_generation ROS package, which allows to build smooth trajectories. In order to follow the trajectory I use rotors position controller, which allows me to set a position/velocity/acceleration setpoint, which then outputs a resulting output acceleration vector to be sent to the vehicle. I’m now attempting experiments using PX4 drone and I’m wondering if it is possible to to the same, by sending an acceleration setpoint. I understand that PX4 is able to receive the setpoint but I understand this is somehow interpreted as a thrust + orientation, which I do not really understand (are you assuming |acceleration| = k * thrust?). How is vehicle mass handled here?
On the other hand, I could maybe convert this to an orientation + thrust myself (given I know my vehicle mass) and send it as a raw attitude target. What would be the best approach?
Note that I only need the drone to follow the acceleration setpoint since I’m closing position and velocity loop on my own.

Thanks!

@v01d

1. There is no need to know the vehicle mass. The thrust command mavros receives is normalized thrust [0, 1] which doesn’t need mass information. You just need to tune the scale of the thrust commands correctly on your quad if you are calculating thrust in newtons

2. Quadrotor dynamics are differentially flat, which means if you define a desired acceleration, the thrust and orientation is fully defined. (With arbirary yaw angles) Therefore, simply providing acceleration setpoints are enough to control the quad. Just send the acceleration setpoints to mavros, and the controller will do everything else for you

3. If you want to have your own controller, it is quite straight forward to implement a geometric controller. You can read this paper for more information.This video is an implementation of a geometric controller of myself and works okay. I am sending thrust command and angular velocity commands. Desired acceleration is simply calculated using a PD controller