 |
SimpleFOClibrary
2.1
|
Go to the documentation of this file.
8 #include "../time_utils.h"
9 #include "../foc_utils.h"
10 #include "../defaults.h"
12 #include "../lowpass_filter.h"
16 #define _MON_TARGET 0b1000000 // monitor target value
17 #define _MON_VOLT_Q 0b0100000 // monitor voltage q value
18 #define _MON_VOLT_D 0b0010000 // monitor voltage d value
19 #define _MON_CURR_Q 0b0001000 // monitor current q value - if measured
20 #define _MON_CURR_D 0b0000100 // monitor current d value - if measured
21 #define _MON_VEL 0b0000010 // monitor velocity value
22 #define _MON_ANGLE 0b0000001 // monitor angle value
216 unsigned int monitor_cnt = 0 ;
#define DEF_PID_CURR_D
default PID controller D value
float current_sp
target current ( q current )
LowPassFilter LPF_angle
parameter determining the angle low pass filter configuration
float zero_electric_angle
absolute zero electric angle - if available
@ voltage
Torque control using voltage.
float voltage_limit
Voltage limitting variable - global limit.
PIDController PID_current_d
parameter determining the d current PID config
@ angle
Position/angle motion control.
float electrical_angle
current electrical angle
float shaft_velocity_sp
current target velocity
@ velocity
Velocity motion control.
#define DEF_PID_VEL_P
default PID controller P value
virtual int initFOC(float zero_electric_offset=NOT_SET, Direction sensor_direction=Direction::CW)=0
LowPassFilter LPF_current_d
parameter determining the current Low pass filter configuration
#define DEF_MON_DOWNSMAPLE
default monitor downsample
#define DEF_PID_CURR_I
default PID controller I value
#define DEF_P_ANGLE_P
default P controller P value
int8_t enabled
enabled or disabled motor flag
float shaft_velocity
current motor velocity
FOCModulationType foc_modulation
parameter derterniming modulation algorithm
float shaft_angle
current motor angle
float target
current target value - depends of the controller
float phase_resistance
motor phase resistance
TorqueControlType torque_controller
parameter determining the torque control type
#define DEF_VEL_LIM
angle velocity limit default
int sensor_direction
if sensor_direction == Direction::CCW then direction will be flipped to CW
PIDController PID_current_q
parameter determining the q current PID config
@ foc_current
torque control using dq currents
@ SinePWM
Sinusoidal PWM modulation.
@ SpaceVectorPWM
Space vector modulation method.
#define DEF_POWER_SUPPLY
default power supply voltage
#define DEF_PID_VEL_I
default PID controller I value
DQCurrent_s current
current d and q current measured
@ dc_current
Torque control using DC current (one current magnitude)
#define DEF_PID_CURR_P
default PID controller P value
float current_limit
Current limitting variable - global limit.
void linkCurrentSense(CurrentSense *current_sense)
#define DEF_CURR_FILTER_Tf
default currnet filter time constant
unsigned int motion_cnt
counting variable for downsampling for move commad
PIDController P_angle
parameter determining the position PID configuration
virtual void move(float target=NOT_SET)=0
float sensor_offset
user defined sensor zero offset
#define DEF_MOTION_DOWNSMAPLE
default motion downsample - disable
DQVoltage_s voltage
current d and q voltage set to the motor
uint8_t monitor_variables
Bit array holding the map of variables the user wants to monitor.
int8_t modulation_centered
flag (1) centered modulation around driver limit /2 or (0) pulled to 0
LowPassFilter LPF_velocity
parameter determining the velocity Low pass filter configuration
CurrentSense * current_sense
MotionControlType controller
parameter determining the control loop to be used
unsigned int monitor_downsample
show monitor outputs each monitor_downsample calls
int pole_pairs
motor pole pairs number
#define DEF_PID_VEL_D
default PID controller D value
Print * monitor_port
Serial terminal variable if provided.
void useMonitoring(Print &serial)
LowPassFilter LPF_current_q
parameter determining the current Low pass filter configuration
float voltage_sensor_align
sensor and motor align voltage parameter
#define DEF_PID_VEL_LIMIT
default PID controller voltage limit
PIDController PID_velocity
parameter determining the velocity PID configuration
void linkSensor(Sensor *sensor)
float velocity_limit
Velocity limitting variable - global limit.
unsigned int motion_downsample
parameter defining the ratio of downsampling for move commad
#define DEF_PID_VEL_RAMP
default PID controller voltage ramp value
float velocity_index_search
target velocity for index search
#define DEF_PID_CURR_RAMP
default PID controller voltage ramp value
float shaft_angle_sp
current target angle