Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Controller Class Reference
This class implements a controller that regulates the speed of the two motors of the ROME2 mobile robot. More...
#include <Controller.h>
Public Member Functions | |
Controller (PwmOut &pwmLeft, PwmOut &pwmRight, EncoderCounter &counterLeft, EncoderCounter &counterRight) | |
Creates and initialises the robot controller. | |
virtual | ~Controller () |
Deletes this Controller object. | |
void | setTranslationalVelocity (float velocity) |
Sets the desired translational velocity of the robot. | |
void | setRotationalVelocity (float velocity) |
Sets the desired rotational velocity of the robot. | |
float | getActualTranslationalVelocity () |
Gets the actual translational velocity of the robot. | |
float | getActualRotationalVelocity () |
Gets the actual rotational velocity of the robot. | |
void | setDesiredSpeedLeft (float desiredSpeedLeft) |
Sets the desired speed of the left motor. | |
void | setDesiredSpeedRight (float desiredSpeedRight) |
Sets the desired speed of the right motor. | |
float | getActualSpeedLeft () |
Gets the actual speed of the left motor. | |
float | getActualSpeedRight () |
Gets the actual speed of the right motor. |
Detailed Description
This class implements a controller that regulates the speed of the two motors of the ROME2 mobile robot.
Definition at line 20 of file Controller.h.
Constructor & Destructor Documentation
Controller | ( | PwmOut & | pwmLeft, |
PwmOut & | pwmRight, | ||
EncoderCounter & | counterLeft, | ||
EncoderCounter & | counterRight | ||
) |
Creates and initialises the robot controller.
- Parameters:
-
pwmLeft a reference to the pwm output for the left motor. pwmRight a reference to the pwm output for the right motor. counterLeft a reference to the encoder counter of the left motor. counterRight a reference to the encoder counter of the right motor.
Definition at line 30 of file Controller.cpp.
~Controller | ( | ) | [virtual] |
Deletes this Controller object.
Definition at line 78 of file Controller.cpp.
Member Function Documentation
float getActualRotationalVelocity | ( | ) |
Gets the actual rotational velocity of the robot.
- Returns:
- the actual rotational velocity, given in [rad/s].
Definition at line 114 of file Controller.cpp.
float getActualSpeedLeft | ( | ) |
Gets the actual speed of the left motor.
- Returns:
- the actual speed given in [rpm].
Definition at line 141 of file Controller.cpp.
float getActualSpeedRight | ( | ) |
Gets the actual speed of the right motor.
- Returns:
- the actual speed given in [rpm].
Definition at line 150 of file Controller.cpp.
float getActualTranslationalVelocity | ( | ) |
Gets the actual translational velocity of the robot.
- Returns:
- the actual translational velocity, given in [m/s].
Definition at line 105 of file Controller.cpp.
void setDesiredSpeedLeft | ( | float | desiredSpeedLeft ) |
Sets the desired speed of the left motor.
- Parameters:
-
desiredSpeedLeft desired speed given in [rpm].
Definition at line 123 of file Controller.cpp.
void setDesiredSpeedRight | ( | float | desiredSpeedRight ) |
Sets the desired speed of the right motor.
- Parameters:
-
desiredSpeedRight desired speed given in [rpm].
Definition at line 132 of file Controller.cpp.
void setRotationalVelocity | ( | float | velocity ) |
Sets the desired rotational velocity of the robot.
- Parameters:
-
velocity the desired rotational velocity, given in [rad/s].
Definition at line 96 of file Controller.cpp.
void setTranslationalVelocity | ( | float | velocity ) |
Sets the desired translational velocity of the robot.
- Parameters:
-
velocity the desired translational velocity, given in [m/s].
Definition at line 87 of file Controller.cpp.
Generated on Sat Jul 23 2022 17:01:00 by
