def handle_chassis_inputs(self, joystick: wpilib.Joystick, gamepad: wpilib.XboxController) -> None: throttle = scale_value(joystick.getThrottle(), 1, -1, 0.1, 1) vx = 3 * throttle * rescale_js(-joystick.getY(), 0.1) vz = 3 * throttle * rescale_js(-joystick.getTwist(), 0.1) self.chassis.drive(vx, vz) if joystick.getRawButtonPressed(3): # TODO reset heading pass
def handle_chassis_inputs(self, joystick: wpilib.Joystick, gamepad: wpilib.XboxController) -> None: throttle = scale_value(joystick.getThrottle(), 1, -1, 0.1, 1) vx = 3 * throttle * rescale_js(-joystick.getY(), 0.1) vz = 3 * throttle * rescale_js(-joystick.getTwist(), 0.1) self.chassis.drive(vx, vz) if joystick.getRawButtonPressed(3): self.chassis.reset_odometry( geometry.Pose2d(-3, 0, geometry.Rotation2d( math.pi))) # the starting position on the field self.target_estimator.reset()
def handle_chassis_inputs(self, joystick: wpilib.Joystick) -> None: throttle = scale_value(joystick.getThrottle(), 1, -1, 0, 1) vx = 3 * throttle * rescale_js(-joystick.getY(), 0.1) vz = 3 * throttle * rescale_js(-joystick.getTwist(), 0.1) self.chassis.drive(vx, vz)