5 #include "../include/Robot.h" 17 this->leftMotorAdapter =
new MotorAdapter(pwmServoHat, LEFT_MOTOR_FORWARD_PIN, LEFT_MOTOR_BACKWARD_PIN);
18 this->rightMotorAdapter =
new MotorAdapter(pwmServoHat, RIGHT_MOTOR_FORWARD_PIN, RIGHT_MOTOR_BACKWARD_PIN);
19 this->leftEncoderAdapter =
new EncoderAdapter(LEFT_ENCODER_PIN_A, LEFT_ENCODER_PIN_B, ENCODER_TICKS_PER_REVOLUTION, H_LEFT_ENCODER);
20 this->rightEncoderAdapter =
new EncoderAdapter(RIGHT_ENCODER_PIN_A, RIGHT_ENCODER_PIN_B, ENCODER_TICKS_PER_REVOLUTION, H_RIGHT_ENCODER);
32 this->communicator->
registerHardware(H_RIGHT_MOTOR, this->rightMotorAdapter);
33 this->communicator->
registerHardware(H_LEFT_ENCODER, this->leftEncoderAdapter);
34 this->communicator->
registerHardware(H_RIGHT_ENCODER, this->rightEncoderAdapter);
37 sensorManager->
addSensor(H_LEFT_ENCODER, this->leftEncoderSensor);
38 sensorManager->
addSensor(H_RIGHT_ENCODER, this->rightEncoderSensor);
41 this->rightEncoderAdapter->start();
42 this->leftEncoderAdapter->start();
45 this->communicator->start();
55 int duration_ms = 10000;
56 double rotationRate = 2 * 3.14159 / (duration_ms / 1000.0);
60 this->leftEncoderSensor,
61 this->rightEncoderSensor,
virtual void addSensor(Hardware hardware, ISensor *sensor)=0
void registerHardware(Hardware hardware, IHardwareInterface *interface)
bool runCommand(Command *command)