Ya kno it

Dependencies:   PID QEI_adapted

Embed: (wiki syntax)

« Back to documentation index

Motor Class Reference

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:
PWMPin
DirectionPin
EncoderPin1
EncoderPin2
Homingswitch
controllerInterval

Definition at line 3 of file Motor.cpp.


Member Function Documentation

float GetPos (  )

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:
Therequired 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
PWMvalue
HomingPositionin 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:
Pvalue
Ti
Td

Definition at line 52 of file Motor.cpp.

void Stop (  )

Stops the motor.

Definition at line 68 of file Motor.cpp.