# Mapping Joystick Inputs to Quadcopter

hope you are all doing well.

We are doing a project where a quadcopter is controlled by an ordinary joystick. We have constructed the Control Algorithm and the joystick to move the quadcopter in accordance with the joystick inputs (roll, pitch, yaw_speed, z_speed).

However, I have some questions on my mind.

Right now, we designed a linear controller, where the roll and pitch inputs are saturated within +/- 20 degrees. Therefore, the joystick directly gives roll and pitch reference angles. For the yaw angle, we read joystick as the yaw_velocity. Then we integrate it to have the reference yaw angle. We use thrust input from the joystick as the velocity in z-axis. Is this a logical mapping from the joystick to the quadcopter for linear control? Is there any (kind of) universal mapping for linear control?

The second part of the project contains non-linear control of the quadcopter, where we aim to have the quadcopter do 360 spins. In order to achieve that, how should we map the joystick inputs? Should we read all of them as roll, pitch, yaw velocities?

My final question is: Or mapping these values to the body frame (p, q, r, and w) is a more preferred way?

Edit: Since I received no answers, I wanted to up the question (I will not be doing that continuosly, this is the first and last time I do that).

• A universal control like a neural network? If controlling an UAV is so easy, many other teams would have implemented such a reward based system in the past. Sep 2 '21 at 18:40

## 1 Answer

Let me preface this by saying I've never done quadcopter controls before.

With a vehicle, the gas pedal doesn't control speed or position, it controls torque. For a quadcopter, the equivalent would be the horizontal forces. The roll/pitch angles would be an input to the horizontal force, but thrust is also an input and the relationship is nonlinear: $$F_{horizontal} = Tsin(\theta)$$.

If you want to have the joystick inputs map directly to the roll/pitch angles then I'm sure that's fine and you'll definitely get results, but I think a more elegant way to do it would be to have the joysticks map to the horizontal force and let your controller calculate the appropriate roll/pitch angles. In doing it this way your horizontal response becomes linear - double the joystick motion produces double the acceleration - and also becomes thrust-independent, in that you get the same planar performance while changing altitude as you do at constant altitude.

Mapping to velocity probably makes the most sense for altitude control.

• That definitely sounds more efficient than what I did earlier. Will definitely try that, thank you! Sep 3 '21 at 8:32