diff --git a/app/raspberry_pi/src/car/system/CarSystem.cpp b/app/raspberry_pi/src/car/system/CarSystem.cpp index d80b76d3..db6e6449 100644 --- a/app/raspberry_pi/src/car/system/CarSystem.cpp +++ b/app/raspberry_pi/src/car/system/CarSystem.cpp @@ -19,6 +19,7 @@ namespace car::system { this->messaging_system->initialize(); this->lidar_device->initialize(); + this->movement_system->initialize(); this->messaging_system->speed_command_signal.connect([this](const SpeedCommand speed_command) { this->setRearWheelsSpeed(speed_command); }); diff --git a/app/raspberry_pi/src/car/system/movement/controller/CarWheelController.cxx b/app/raspberry_pi/src/car/system/movement/controller/CarWheelController.cxx index ea3b4326..4a1e700b 100644 --- a/app/raspberry_pi/src/car/system/movement/controller/CarWheelController.cxx +++ b/app/raspberry_pi/src/car/system/movement/controller/CarWheelController.cxx @@ -27,10 +27,14 @@ namespace car::system::movement::controller static constexpr int MIN_PULSE_WIDTH = 900; static constexpr int MAX_PULSE_WIDTH = 2100; static constexpr int FREQUENCY = 50; + + static constexpr int BUS_NUMBER = 1; + class CarWheelController : public AbstractWheelController { public: CarWheelController() { + this->pwm = std::make_shared(); this->rear_left_wheel = std::make_unique( this->pwm, std::make_unique(Motor_A, PWM_A) @@ -52,7 +56,7 @@ namespace car::system::movement::controller ~CarWheelController() {}; void initialize() override { - this->pwm->init(1, 0x40); + this->pwm->init(BUS_NUMBER, 0x40); std::this_thread::sleep_for(std::chrono::milliseconds(100)); this->pwm->setPWMFreq(FREQUENCY); std::this_thread::sleep_for(std::chrono::milliseconds(1000));