PID motor controll for the biorobotics project.
Dependents: PID_example Motor_calibration Demo_mode Demo_mode ... more
Diff: motor.h
- Revision:
- 14:e5fc69651b1d
- Parent:
- 13:9be1857401f8
--- a/motor.h Thu Nov 01 12:55:32 2018 +0000 +++ b/motor.h Mon Nov 05 16:03:11 2018 +0000 @@ -1,4 +1,4 @@ -#pragma once +#pragma once // Include only once #include "mbed.h" #include "FastPWM.h" @@ -10,8 +10,8 @@ // Amount of motor encoder pulses per rotation. When using X4 encoding. const int PULSES_PER_ROTATION = 6533; -const double MOTOR_THRESHOLD_RPS = 0.1; // Rad/s under which we send 0 to the motor, to prevent it from jittering around. -const double MOTOR_STALL_PWM = 0.45; // PWM fraction above which the motor starts to move. +const double MOTOR_THRESHOLD_RPS = 0.1; // Motor speed fraction under which we send 0 to the motor, to prevent it from jittering around. +const double MOTOR_STALL_PWM = 0.45; // PWM fraction above which the motor starts to move (below it motor will start to stall). class Motor { /// Rotates a motor to a given angle using PID control.