Ya kno it
Dependencies:
PID
QEI_adapted
« Back to documentation index
Motor Class Reference
Motorclass Used to control Servo motors.
More...
#include <Motor.h >
Public Member Functions
Motor (PinName PWM, PinName Direction, PinName Enc1, PinName Enc2, PinName HomingSW, float interval)
Motor class declaration.
void GotoPos (float Rad)
GotoPos function This function Sends the motor to the requested Position.
float GetPos ()
Outputs the current motor position in radians, while keeping the gear ratio into account.
void Homing (bool direction, float PWM, float HomingPos)
Homes the motor with the homing pin.
void SetPID (float P, float Ti, float Td)
Set the Pid values.
void SetGearRatio (float GearRatio)
Set the motor gear ratio.
void SetInputLimits (float Imin, float Imax)
Set the inputlimits, or the allowed Position.
void SetOutputLimits (float Omin, float Omax)
Set the output Limits of the PWM.
void Stop ()
Stops the motor.
Detailed Description
Motorclass Used to control Servo motors.
Definition at line 7 of file Motor.h .
Constructor & Destructor Documentation
Motor
(
PinName
PWM ,
PinName
Direction ,
PinName
Enc1 ,
PinName
Enc2 ,
PinName
HomingSW ,
float
interval
)
Motor class declaration.
Parameters:
PWM Pin
Direction Pin
Encoder Pin1
Encoder Pin2
Homingswitch
controller Interval
Definition at line 3 of file Motor.cpp .
Member Function Documentation
Outputs the current motor position in radians, while keeping the gear ratio into account.
Definition at line 36 of file Motor.cpp .
void GotoPos
(
float
Rad )
GotoPos function This function Sends the motor to the requested Position.
This Function needs to be called repeadedly since it also triggers one tick of the PID controller
Parameters:
The required Position in radians
Definition at line 14 of file Motor.cpp .
void Homing
(
bool
direction ,
float
PWM ,
float
HomingPos
)
Homes the motor with the homing pin.
Parameters:
Direction
PWM value
HomingPosition in radians
Definition at line 41 of file Motor.cpp .
void SetGearRatio
(
float
GearRatio )
Set the motor gear ratio.
Definition at line 56 of file Motor.cpp .
void SetInputLimits
(
float
Imin ,
float
Imax
)
Set the inputlimits, or the allowed Position.
Parameters:
InputMinimum
InputMaximum
Definition at line 60 of file Motor.cpp .
void SetOutputLimits
(
float
Omin ,
float
Omax
)
Set the output Limits of the PWM.
Parameters:
OutputMinimum
OutputMaximum
Definition at line 64 of file Motor.cpp .
void SetPID
(
float
P ,
float
Ti ,
float
Td
)
Set the Pid values.
Parameters:
Definition at line 52 of file Motor.cpp .
Stops the motor.
Definition at line 68 of file Motor.cpp .