diff --git a/controller/fw/embed/src/main.cpp b/controller/fw/embed/src/main.cpp index c7640d8..b342add 100644 --- a/controller/fw/embed/src/main.cpp +++ b/controller/fw/embed/src/main.cpp @@ -52,7 +52,7 @@ void setup_foc(MagneticSensorAS5045 *encoder, BLDCMotor *motor, driver->pwm_frequency = 20000; driver->voltage_power_supply = 24; driver->voltage_limit = 24; - driver->init(); + driver->init(); current_sense->linkDriver(driver); current_sense->init(); @@ -61,23 +61,23 @@ void setup_foc(MagneticSensorAS5045 *encoder, BLDCMotor *motor, motor->linkDriver(driver); motor->linkCurrentSense(current_sense); motor->useMonitoring(Serial); - motor->monitor_downsample = 5000; // default 0 + motor->monitor_downsample = 5000; // default 0 motor->controller = MotionControlType::angle; motor->torque_controller = TorqueControlType::voltage; motor->foc_modulation = FOCModulationType::SpaceVectorPWM; - //PID start + // PID start motor->PID_velocity.P = 0.75; motor->PID_velocity.I = 20; - motor->LPF_velocity.Tf = 0.005; - motor->P_angle.P = 0.5 ; - motor->LPF_angle.Tf = 0.001; - //PID end + motor->LPF_velocity.Tf = 0.005; + motor->P_angle.P = 0.5; + motor->LPF_angle.Tf = 0.001; + // PID end - motor->velocity_limit = 40; // Ограничение по скорости вращения rad/s (382 rpm) + motor->velocity_limit = 40; // Ограничение по скорости вращения rad/s (382 rpm) motor->voltage_limit = 24; motor->current_limit = 0.5; - + motor->sensor_direction = Direction::CCW; motor->init(); motor->initFOC(); @@ -176,7 +176,7 @@ void setup() { Can.setBaudRate(1000000); TIM_TypeDef *Instance = TIM2; HardwareTimer *SendTimer = new HardwareTimer(Instance); - SendTimer->setOverflow(100, HERTZ_FORMAT); // 50 Hz + SendTimer->setOverflow(100, HERTZ_FORMAT); // 50 Hz SendTimer->attachInterrupt(send_data); SendTimer->resume(); setup_foc(&encoder, &motor, &driver, ¤t_sense, &command, doMotor);