parameters: (pwm)
docstring: control quadcopter
docstring_summary: control quadcopter
docstring_tokens: control quadcopter
function: def control_quad(pwm):
      '''control quadcopter'''
      motor_dir = [ 1, 1, -1, -1 ]
      motor_order = [ 0, 1, 2, 3 ]
  
      motors = pwm[0:4]
      motor_speed = [ 0 ] * 4
      for m in range(len(motors)):
          motor_speed[motor_order[m]] = constrain(motors[m] - 1000.0, 0, 1000) * motor_dir[motor_order[m]]
  
      robot.set_propeller_velocities(motor_speed)
function_tokens: def control_quad ( pwm ) : motor_dir = [ 1 , 1 , - 1 , - 1 ] motor_order = [ 0 , 1 , 2 , 3 ] motors = pwm [ 0 : 4 ] motor_speed = [ 0 ] * 4 for m in range ( len ( motors ) ) : motor_speed [ motor_order [ m ] ] = constrain ( motors [ m ] - 1000.0 , 0 , 1000 ) * motor_dir [ motor_order [ m ] ] robot . set_propeller_velocities ( motor_speed )