Posted by Matt Berube at 1/16/2001 7:48 AM EST
Engineer on team #49, Delphi Knights, from Buena Vista High School and Delphi Automotive.
In Reply to: Well, no sleep for a while
Posted by Nick on 1/15/2001 10:24 PM EST:
: I'm already insane with programming the gyro sensor. By any chance what so ever is there PBASIC code to change the joysticks inputs to parametric or am I at least on the right track?
You might want to take some time to try to understand this then try to plot it in something like Excel or Matlab. I don't understand why it works but it will give you an output that roughly corresponds to the angle of the joystick. I wish I understood it better myself. Feel free to e-mail me at
matthew.berube@delphiato.com if you have specific questions.
' Steer
Rear_Steer_Output = 127
'set dead band in center only
if (p1_y>124 and p1_y124 and p1_x127 and p1_x127) then mode9steer3:
Rear_Steer_Output = ((1127-(((127*(P1_x-127))/SQR((P1_x-127)*(P1_x-127)+((127-P1_y)*(127-P1_y)*2))))) MIN 1000 MAX 1254) - 1000
mode9steer3:
if not(p1_y>127 and p1_x>127) then mode9steer4:
Rear_Steer_Output = ((1127+(((127*(P1_x-127))/SQR( (P1_x-127)*(P1_x-127)+((P1_y-127)*(P1_y-127)*2) ) ))) MIN 1000 MAX 1254) - 1000
mode9steer4:
(ps)
this is kinda hard to read. It basically is breaking the joystick up into 4 quadrants and the equation for the output is : X / ( X^2 + Y^2)^0.5
Matt B.
T49