(self, event)
Update command based on event readings.
Update command based on event readings.
Update command based on event readings .
def update_command(self, event):
    """Update command based on event readings."""
    if event.ev_type == 'Key' and event.code == 'BTN_TL':
      self._lb_pressed = bool(event.state)
    elif event.ev_type == 'Key' and event.code == 'BTN_TR':
      self._rb_pressed = bool(event.state)
    elif event.ev_type == 'Absolute' and event.code == 'ABS_X':
      # Left Joystick L/R axis
      self.vy = _interpolate(-event.state, MAX_ABS_RX, self._vel_scale_y)
    elif event.ev_type == 'Absolute' and event.code == 'ABS_Y':
      # Left Joystick F/B axis; need to flip sign for consistency
      self.vx = _interpolate(-event.state, MAX_ABS_RY, self._vel_scale_x)
    elif event.ev_type == 'Absolute' and event.code == 'ABS_RX':
      self.wz = _interpolate(event.state, MAX_ABS_RX, self._vel_scale_rot)

    if self._lb_pressed and self._rb_pressed:
      self.estop_flagged = True
      self.vx, self.vy, self.wz = 0., 0., 0.
def update_command ( self , event ) : if event . ev_type == 'Key' and event . code == 'BTN_TL' : self . _lb_pressed = bool ( event . state ) elif event . ev_type == 'Key' and event . code == 'BTN_TR' : self . _rb_pressed = bool ( event . state ) elif event . ev_type == 'Absolute' and event . code == 'ABS_X' : # Left Joystick L/R axis self . vy = _interpolate ( - event . state , MAX_ABS_RX , self . _vel_scale_y ) elif event . ev_type == 'Absolute' and event . code == 'ABS_Y' : # Left Joystick F/B axis; need to flip sign for consistency self . vx = _interpolate ( - event . state , MAX_ABS_RY , self . _vel_scale_x ) elif event . ev_type == 'Absolute' and event . code == 'ABS_RX' : self . wz = _interpolate ( event . state , MAX_ABS_RX , self . _vel_scale_rot ) if self . _lb_pressed and self . _rb_pressed : self . estop_flagged = True self . vx , self . vy , self . wz = 0. , 0. , 0.