You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
941 B
32 lines
941 B
#ifndef motor_control_h
|
|
#define motor_control_h
|
|
|
|
#include "../common/shared_structs.h"
|
|
|
|
#define MOTOR_PWM_FREQ 500 // PWM frequency in Hz
|
|
|
|
#define MOTOR_CONTROL_PERIOD_MS 100 // Period of the motor control loop
|
|
|
|
#define MAX_DUTY_RAMP 10.0 // max change in duty per second - where 1.0 is full duty
|
|
|
|
#define MIN_DUTY 0.10 // min duty for each motor
|
|
#define MAX_DUTY 0.55 // max duty for each motor - Needs to be below 0.33 to avoid overlapping the three motor phases
|
|
|
|
#define DEFAULT_KP 0.0
|
|
#define DEFAULT_KI 5.0
|
|
#define DEFAULT_KD 0.0
|
|
#define DEFAULT_OP_OFFSET 0.0
|
|
|
|
void set_motor_control(motor_id_t motor_id, motor_control_t new_control);
|
|
|
|
void set_motor_params(motor_id_t motor_id, motor_parameters_t new_params);
|
|
|
|
motor_control_t get_motor_control(motor_id_t motor_id);
|
|
|
|
motor_parameters_t get_motor_parameters(motor_id_t motor_id);
|
|
|
|
float get_motor_duty(motor_id_t motor_id);
|
|
|
|
void motor_control_setup(void);
|
|
|
|
#endif |