def setup_mixers(self, rover, type): if self.board_type is 'navio': logging.info("Setting up Ackermann car") throttle_driver = NavioPWM( config.ackermann_car_navio.throttle_channel, invert=config.ackermann_car_navio.throttle_channel_invert, left_pulse=config.ackermann_car_navio.throttle_stopped_pwm, right_pulse=config.ackermann_car_navio.throttle_forward_pwm) steering_driver = NavioPWM( config.ackermann_car_navio.steering_channel, invert=config.ackermann_car_navio.steering_channel_invert, left_pulse=config.ackermann_car_navio.throttle_left_pwm, right_pulse=config.ackermann_car_navio.throttle_right_pwm) rover.mixer = AckermannSteeringMixer( steering_driver=steering_driver, throttle_driver=throttle_driver) elif self.board_type is 'navio2': if type == 'differential': logging.info("Setting up differential car") left_driver = NAVIO2PWM(config.differential_car.left_channel) right_driver = NAVIO2PWM(config.differential_car.right_channel) rover.mixer = DifferentialSteeringMixer( left_driver=left_driver, right_driver=right_driver) else: logging.info("Setting up Ackermann car") throttle_driver = NAVIO2PWM( config.ackermann_car.throttle_channel) steering_driver = NAVIO2PWM( config.ackermann_car.steering_channel) rover.mixer = AckermannSteeringMixer( steering_driver=steering_driver, throttle_driver=throttle_driver) elif self.board_type is 'adafruit': logging.info("Setting up differential car") left_driver = Adafruit_MotorHAT( config.differential_car.left_channel + 1) right_driver = Adafruit_MotorHAT( config.differential_car.right_channel + 1) rover.mixer = DifferentialSteeringMixer(left_driver=left_driver, right_driver=right_driver) else: logging.error("No drivers found - exiting") sys.exit()
def setUp(self): vehicle = Rover() vehicle.auto_pilots = [TestPilot()] vehicle.auto_pilot_index = 0 ds = TestDriver() dt = TestDriver() mx = AckermannSteeringMixer(throttle_driver=dt, steering_driver=ds) vehicle.mixer = mx vehicle.recorder = DummyRecorder() vehicle.vision_sensor = TestCamera() vehicle.indicator = DummyIndicator() self.vehicle = vehicle
def setup_mixers(self, rover): if self.board_type is 'navio': logging.info("Found NAVIO2 HAT - Setting up Ackermann car") throttle_driver = NAVIO2PWM(2) steering_driver = NAVIO2PWM(0) rover.mixer = AckermannSteeringMixer( steering_driver=steering_driver, throttle_driver=throttle_driver) elif self.board_type is 'adafruit': logging.info( "Found Adafruit Motor HAT - Setting up differential car") left_driver = Adafruit_MotorHAT(config.LEFT_MOTOR_TERMINAL) right_driver = Adafruit_MotorHAT(config.RIGHT_MOTOR_TERMINAL) rover.mixer = DifferentialSteeringMixer(left_driver=left_driver, right_driver=right_driver) else: logging.error("No drivers found - exiting") sys.exit()