Joystick. How to add XX offset angle to X Y for 12 degree offset

Ill admit im not the best to explain but the main focus was on Y for now but i did mention if the table could then just be set to X too to compensate the whole system.

I found a reference on how the real stick hardware is set up with the sensors. This is essentially what i wish to achieve using software. Note only the sensors are rotated

Im a bit unsure on how accurate it really needs to be but perhaps a 5:1 would be fine. Im sure that's something that can be improved later on if needed.

Seems like he is.

OK, so you need a real 2D rotation, still EZ, no trig as the angle is fixed.

Play with this:
/* please put some text you'll search for one day here */

const float sintheta = sin(-12 * PI / 180);
const float costheta = cos(-12 * PI / 180);

float x, y;

float newX, newY;

void setup()

// set some x y vales here, whatevs

 	x = 13.2;
  	y = 14.6;

// do the maths

	newX = x * costheta - y * sintheta;
	newY = x * sintheta + y * costheta;

// and print the results here to see if


void loop()



don't know what 5:1 means in terms of accuracy

i was asking if you also wanted to compensate for the y value?

i think rotation to compensate for a pilot moving a stick at a slight angle because he pulls toward his shoulder is overkill and unnecessary. (certainly based on my experience).

This is what the OP has asked for, we have delivered.

I don't have much stick time on the F16. :expressionless:

While I was doing what I should be still earlier, I realized there may be one more step, as the 2D rotation is about the origin. Again, the OP asserts that stick centered will be 0.0 by 0.0, so there is no need for a translation to move the axis of rotation.


Thank you ill have a look.

"there is a 12 degree rotation offset (Rotating everything) within the FLCS software on the f16" Actually i got this wrong. Its not in the software its in the HW setup as show in the picture. the FLCS software has other options

To answer Gcjr. It may be overkill but i am going for the realism. I also need to compensate for the Y value yes.

sorry i over looked that.

is there any reason the stick can't just be rotated?

In short realism

For all commercial sticks i know of you would need a strong adapter to go in between and also an extension cable to sit in the adapter. You'd need to modify quite a bit. Technically you could just drill 4 new holes on this one but i think it would weaken the structure to much in the center. The grip should not have any angular offset

Its also for other people that wish to DIY or fix the same stick later. There's 2 or three version of more commercial f16 sticks out there and they do have this software angle adjust. Then you have the choice if you wish to use it or not.

Besides realism, what then, if you just rotated the joystick IRL, would be the role for a microprocessor and some high school maths? :wink:


not sure i understand this realism issue.

i suggested rotating the stick because if what you want is realistically handled in a real plane then there must be a way for the pilot to adjust to his body.

i'm comfortable flying gliders with either hand. if i didn't learn to properly position the stick horizontally, the plane would have a roll bias.

Its realistic in the way it is how the f16 is. And well us purist want to have it set exactly as it is in the real plane. Every center mounted stick i have however has a rotated handle (which is the case for the majority of planes) for better ergonomics and i do fly with a perfectly centered pull on these.

are you saying the stick in an f-16 is rotated -12 deg?

The stick isnt angled at all but the force sensors in the base is at 12 degrees offset

is that true for other jet fighters, other military or commercial aircraft?

As far as i know its only the f16 that has this configuration

777 has provided a solution.

you may be interested in Black Magic and Gremlins: Analog Flight Simulations from the Dryden Publications. there was also discussion of the the initial use of the aircraft simulator in Wingless Flight

Thank you that looks cool. ill have a read!

And thank you so much for your help. I've learned a lot from it. I might need to make a lookup table in the end too in case the Ardunio micro dont like to do these things.

pretty sure the arduino can do the math

there's no trig function calls except when setting the angle

Ah i see. Appreciate it!

Ill see if i can get it sorted in the next day or two then

Right. If it was to be variable, you'd call the trig functions with the angle; if the angle is changed infrequently you could just recackulate the constants, in which case they'd need to be plain floats, ironically.

If the angle was changing rapidly and you found youself running into time issues from the trig calls, then a lookup table or good enough quadratic approximation should be considered.


Hey guys!

This seems to be working excellent! Main credit to Alto777 here but both of you have been immense help!

I got a minor issue and i think it might be some minor misunderstanding with center assumed to be 0,0? Since center is generally 512 1024 2048 and so on depending on how many bits of resolution is there a more clever way to compensate than testing numbers (not 1:1 it seems ) and adding it to the end result ? That would be very helpful when changing resolution

This also may have an unwanted effect on the actual angle or is it fine to just add + 248 at the end of the angle calculation?

  newY =  XcombinedValue * sintheta + YcombinedValue * costheta + 248; // added + 248 here to compensate for center. I can also add these at Joystick.setYAxis(newY + 248)
  newX =  XcombinedValue * costheta - YcombinedValue * sintheta - 199 ;
// Set joystick Axis