Advertisement
MustafaIsmail

Untitled

Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. x = 0.0
  2. y = 0.0
  3. r = 0.0
  4. n = (abs(x) + abs(y) + abs(r))/100.0
  5.  
  6. base_value = 305
  7. pwm_range = 165
  8.  
  9. front_right_thruster_value = base_value
  10. front_left_thruster_value  = base_value
  11. back_right_thruster_value  = base_value
  12. back_left_thruster_value   = base_value
  13.  
  14. if n != 0:
  15.     front_right_thruster_value = base_value + pwm_range*( float(x/-100) + float(y/100) + float(r/-100) ) * (1.0/n)
  16.     front_left_thruster_value  = base_value + pwm_range*( float(x/100)  + float(y/100) + float(r/100) ) * (1.0/n)
  17.     back_right_thruster_value  = base_value + pwm_range*( float(x/100)  + float(y/100) + float(r/-100) ) * (1.0/n)
  18.     back_left_thruster_value   = base_value + pwm_range*( float(x/-100) + float(y/100) + float(r/100) ) * (1.0/n)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement