SimpleFOClibrary 2.4.0
Loading...
Searching...
No Matches
FOCMotor.h File Reference
#include "Arduino.h"
#include "Sensor.h"
#include "CurrentSense.h"
#include "../time_utils.h"
#include "../foc_utils.h"
#include "../defaults.h"
#include "../pid.h"
#include "../lowpass_filter.h"
Include dependency graph for FOCMotor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FOCMotor
 

Macros

#define MOT_ERR   "ERR-MOT:"
 
#define MOT_WARN   "WARN-MOT:"
 
#define MOT_DEBUG   "MOT:"
 
#define SIMPLEFOC_MOTOR_WARN(msg, ...)
 
#define SIMPLEFOC_MOTOR_ERROR(msg, ...)
 
#define SIMPLEFOC_MOTOR_DEBUG(msg, ...)
 
#define _MON_TARGET   0b1000000
 
#define _MON_VOLT_Q   0b0100000
 
#define _MON_VOLT_D   0b0010000
 
#define _MON_CURR_Q   0b0001000
 
#define _MON_CURR_D   0b0000100
 
#define _MON_VEL   0b0000010
 
#define _MON_ANGLE   0b0000001
 

Enumerations

enum  MotionControlType : uint8_t {
  torque = 0x00 , velocity = 0x01 , angle = 0x02 , velocity_openloop = 0x03 ,
  angle_openloop = 0x04 , angle_nocascade = 0x05 , custom = 0x06
}
 
enum  TorqueControlType : uint8_t { voltage = 0x00 , dc_current = 0x01 , foc_current = 0x02 , estimated_current = 0x03 }
 
enum  FOCModulationType : uint8_t { SinePWM = 0x00 , SpaceVectorPWM = 0x01 , Trapezoid_120 = 0x02 , Trapezoid_150 = 0x03 }
 
enum  FOCMotorStatus : uint8_t {
  motor_uninitialized = 0x00 , motor_initializing = 0x01 , motor_uncalibrated = 0x02 , motor_calibrating = 0x03 ,
  motor_ready = 0x04 , motor_error = 0x08 , motor_calib_failed = 0x0E , motor_init_failed = 0x0F
}
 

Macro Definition Documentation

◆ _MON_ANGLE

#define _MON_ANGLE   0b0000001

Definition at line 44 of file FOCMotor.h.

◆ _MON_CURR_D

#define _MON_CURR_D   0b0000100

Definition at line 42 of file FOCMotor.h.

◆ _MON_CURR_Q

#define _MON_CURR_Q   0b0001000

Definition at line 41 of file FOCMotor.h.

◆ _MON_TARGET

#define _MON_TARGET   0b1000000

Definition at line 38 of file FOCMotor.h.

◆ _MON_VEL

#define _MON_VEL   0b0000010

Definition at line 43 of file FOCMotor.h.

◆ _MON_VOLT_D

#define _MON_VOLT_D   0b0010000

Definition at line 40 of file FOCMotor.h.

◆ _MON_VOLT_Q

#define _MON_VOLT_Q   0b0100000

Definition at line 39 of file FOCMotor.h.

◆ MOT_DEBUG

#define MOT_DEBUG   "MOT:"

Definition at line 16 of file FOCMotor.h.

◆ MOT_ERR

#define MOT_ERR   "ERR-MOT:"

Definition at line 14 of file FOCMotor.h.

◆ MOT_WARN

#define MOT_WARN   "WARN-MOT:"

Definition at line 15 of file FOCMotor.h.

◆ SIMPLEFOC_MOTOR_DEBUG

#define SIMPLEFOC_MOTOR_DEBUG (   msg,
  ... 
)
Value:
SIMPLEFOC_DEBUG(msg, ##__VA_ARGS__)
#define MOT_DEBUG
Definition FOCMotor.h:16
static void print(const char *msg)

Definition at line 27 of file FOCMotor.h.

◆ SIMPLEFOC_MOTOR_ERROR

#define SIMPLEFOC_MOTOR_ERROR (   msg,
  ... 
)
Value:
SIMPLEFOC_DEBUG(msg, ##__VA_ARGS__)
#define MOT_ERR
Definition FOCMotor.h:14

Definition at line 23 of file FOCMotor.h.

◆ SIMPLEFOC_MOTOR_WARN

#define SIMPLEFOC_MOTOR_WARN (   msg,
  ... 
)
Value:
SIMPLEFOC_DEBUG(msg, ##__VA_ARGS__)
#define MOT_WARN
Definition FOCMotor.h:15

Definition at line 19 of file FOCMotor.h.

Enumeration Type Documentation

◆ FOCModulationType

enum FOCModulationType : uint8_t

FOC modulation type

Enumerator
SinePWM 

Sinusoidal PWM modulation.

SpaceVectorPWM 

Space vector modulation method.

Trapezoid_120 
Trapezoid_150 

Definition at line 72 of file FOCMotor.h.

◆ FOCMotorStatus

enum FOCMotorStatus : uint8_t
Enumerator
motor_uninitialized 

Motor is not yet initialized.

motor_initializing 

Motor intiialization is in progress.

motor_uncalibrated 

Motor is initialized, but not calibrated (open loop possible)

motor_calibrating 

Motor calibration in progress.

motor_ready 

Motor is initialized and calibrated (closed loop possible)

motor_error 

Motor is in error state (recoverable, e.g. overcurrent protection active)

motor_calib_failed 

Motor calibration failed (possibly recoverable)

motor_init_failed 

Motor initialization failed (not recoverable)

Definition at line 81 of file FOCMotor.h.

◆ MotionControlType

enum MotionControlType : uint8_t

Motion control type

Enumerator
torque 

Torque control.

velocity 

Velocity motion control.

angle 

Position/angle motion control.

velocity_openloop 
angle_openloop 
angle_nocascade 

Position/angle motion control without velocity cascade.

custom 

Custom control method - control method added by user.

Definition at line 49 of file FOCMotor.h.

◆ TorqueControlType

enum TorqueControlType : uint8_t

Motiron control type

Enumerator
voltage 

Torque control using voltage.

dc_current 

Torque control using DC current (one current magnitude)

foc_current 

torque control using dq currents

estimated_current 

torque control using estimated current (provided motor parameters)

Definition at line 62 of file FOCMotor.h.