I'm working on a project using FreePIE to fly RC aircraft. It's going pretty well, but I've run into a snag regarding trim. In the code below, Joystick 1 is aileron/elevator, joystick 2 is throttle, joystick 3 is rudder, and joystick 4 trims aileron, elevator, and rudder.
It more or less works, but with two not so desirable side effects.from System import Int16
if starting:
joystick[1].setRange(0, 2048)
joystick[2].setRange(0, 2048)
joystick[3].setRange(0, 2048)
joystick[4].setRange(0, 2048)
x = Cyclic.getY(joystick[4].x /2 -512 + joystick[1].x)
y = Cyclic.getY(joystick[4].y /2 -512 + joystick[1].y)
z = Rudder.getY(joystick[4].z /2 -512 + joystick[3].zRotation)
vJoy[0].x = filters.mapRange(x, 0, 2048, -Int16.MaxValue, Int16.MaxValue)
vJoy[0].y = filters.mapRange(y, 0, 2048, -Int16.MaxValue, Int16.MaxValue)
vJoy[0].z = filters.mapRange(z, 0, 2048, -Int16.MaxValue, Int16.MaxValue)
vJoy[0].rx = joystick[2].z
vJoy[0].ry = joystick[2].zRotation
1) With this method, if I trim in one direction, I can never fully go in the other direction.
2) Because I'm using curves, once I have trimmed, I'm no longer in the center of the curve, and one direction will be more 'aggressive' than the other.
Is it possible to have trim without running into one or both problems? If so, would anyone know how to go about doing so?