Converting LX,LY,RX,RY Values to PPM Outputs

Hello all, ;D

I seek help regarding how I can take input values such as serial readings of 2 joysticks and converting those to PPM outputs (specifically throttle, pitch, yaw, roll) for my quadcopter. My flight board requires 4 inputs, (Throttle, pitch, yaw, roll) and I am interfacing a PS2 controller as my Tx. I successfully receive consistent values from the controller buttons and joysticks. I am working with Bill Porter's PS2X library to interface. The segment of code that reads the joysticks is ..

if(ps2x.Button(PSB_L1) || ps2x.Button(PSB_R1)) { 
      Serial.print("Stick Values:");
      Serial.print(ps2x.Analog(PSS_LY), DEC);   
      Serial.print(ps2x.Analog(PSS_LX), DEC); 
      Serial.print(ps2x.Analog(PSS_RY), DEC); 
      Serial.println(ps2x.Analog(PSS_RX), DEC); 

So my question is, how can I take these values and successfully map the joysticks to output as (ThrottlePin 2, PitchPin 4, YawPin 5, & RollPin6)?

Thanks in advanced to all who took the time to read through.

PS Below is the sketch I am using to read the PS2 controller data. I encourage you all to check it out.

PS2X_ReadPS2Values.ino (4.71 KB)

What range of values are received from the functions ? You might want to map() them to 0 to 180 and use them in servo.Write() to control the ECSs

Or for more precision, map them to 1000 to 2000 and use them in servo.writeMilliseconds().