Combining Rotational and Transitional Thruster Movement in ROV Code
I am currently working on an ROV project. The ROV body is a cube with 4 thrusters mounted at 45 degree angles on each corner. The ROV takes input from an XBOX controller. The left joystick controls transitional (front, back, left, right) movement and the right joystick's x-axis controls rotation (clockwise and counter-clockwise). The input must then be translated into positive (forward) or negative (backward) thrust for each thruster.
While I can manage calculations for each individually, I run into a problem when I attempt to compose the two. Each calculation returns an array of doubles between -1 and 1 that represent thruster values. Averages do not work and I feel there is a more elegant solution than just testing if one of the arrays contains all zeros. Any input would be much appreciated and I would be more than glad to answer any questions you may have.