![]() |
RoboidControl
|
A motor with speed control It uses a feedback loop from an encoder to regulate the speed The speed is measured in revolutions per second. More...
#include <ControlledMotor.h>
Public Types | |
| enum class | Direction { Clockwise = 1 , CounterClockwise = -1 } |
| Motor turning direction. More... | |
Public Member Functions | |
| ControlledMotor () | |
| ControlledMotor (Motor *motor, Encoder *encoder) | |
| void | Update (float currentTimeMs) override |
| virtual void | SetTargetSpeed (float speed) override |
| Set the target speed for the motor controller. | |
| virtual float | GetActualSpeed () override |
| Get the actual speed from the encoder. | |
| bool | Drive (float distance) |
| virtual float | GetTargetSpeed () |
| Get the current target speed of the motor. | |
| bool | IsMotor () |
| Check if the Thing is a Motor. | |
| bool | IsSensor () |
| Check if the Thing is a Sensor. | |
| void | SetParent (Thing *parent) |
| Thing * | GetParent () |
| void | AddChild (Thing *child) |
| Thing * | GetChild (unsigned char childIx) |
Static Public Member Functions | |
| static bool | CheckType (Thing *thing) |
Public Attributes | |
| float | velocity |
| float | pidP = 0.1F |
| float | pidD = 0.0F |
| float | pidI = 0.0F |
| Motor * | motor |
| Encoder * | encoder |
| Direction | direction = Direction::Clockwise |
| The forward turning direction of the motor. | |
| float | currentTargetSpeed = 0 |
| unsigned int | type |
| The type of Thing. | |
| Polar | position |
Static Public Attributes | |
| static const unsigned int | SwitchType = SensorType | (unsigned int)Type::Switch |
| The type of a switch sensor. | |
| static const unsigned int | DistanceSensorType |
| The type of a distance sensor. | |
| static const unsigned int | ControlledMotorType |
| The type of a controlled motor. | |
| static const unsigned int | UncontrolledMotorType |
| The type of an uncontrolled motor. | |
| static const unsigned int | ServoType = (unsigned int)Type::Servo |
| The type of an object received from the network. | |
| static const unsigned int | ExternalType = (unsigned int)Type::ExternalSensor |
Protected Types | |
| enum class | Type { Undetermined , Switch , DistanceSensor , ControlledMotor , UncontrolledMotor , Servo , ExternalSensor } |
| Basic Thing types. More... | |
Protected Attributes | |
| float | lastUpdateTime = 0 |
| float | lastError = 0 |
| float | actualSpeed |
| float | netDistance = 0 |
| float | startDistance = 0 |
| bool | driving = false |
| float | targetDistance = 0 |
| float | lastEncoderPosition = 0 |
| Thing * | parent = nullptr |
| unsigned char | childCount = 0 |
| Thing ** | children = nullptr |
Static Protected Attributes | |
| static const unsigned int | MotorType = 0x8000 |
| Bitmask for Motor type. | |
| static const unsigned int | SensorType = 0x4000 |
| Bitmap for Sensor type. | |
A motor with speed control It uses a feedback loop from an encoder to regulate the speed The speed is measured in revolutions per second.
|
stronginherited |
Motor turning direction.
| Enumerator | |
|---|---|
| Clockwise | |
| CounterClockwise | |
|
strongprotectedinherited |
Basic Thing types.
| Enumerator | |
|---|---|
| Undetermined | |
| Switch | |
| DistanceSensor | |
| ControlledMotor | |
| UncontrolledMotor | |
| Servo | |
| ExternalSensor | |
| ControlledMotor::ControlledMotor | ( | ) |
|
inlinestatic |
|
overridevirtual |
Reimplemented from Passer::RoboidControl::Motor.
|
overridevirtual |
Set the target speed for the motor controller.
| speed | the target in revolutions per second. |
Reimplemented from Passer::RoboidControl::Motor.
|
overridevirtual |
Get the actual speed from the encoder.
Reimplemented from Passer::RoboidControl::Motor.
| bool ControlledMotor::Drive | ( | float | distance | ) |
|
virtualinherited |
Get the current target speed of the motor.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
| float Passer::RoboidControl::ControlledMotor::velocity |
| float Passer::RoboidControl::ControlledMotor::pidP = 0.1F |
| float Passer::RoboidControl::ControlledMotor::pidD = 0.0F |
| float Passer::RoboidControl::ControlledMotor::pidI = 0.0F |
| Motor* Passer::RoboidControl::ControlledMotor::motor |
| Encoder* Passer::RoboidControl::ControlledMotor::encoder |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inherited |
The forward turning direction of the motor.
|
inherited |
|
inherited |
The type of Thing.
|
staticinherited |
The type of a switch sensor.
|
staticinherited |
The type of a distance sensor.
|
staticinherited |
The type of a controlled motor.
|
staticinherited |
The type of an uncontrolled motor.
|
staticinherited |
The type of an object received from the network.
|
staticinherited |
|
inherited |
|
staticprotectedinherited |
Bitmask for Motor type.
|
staticprotectedinherited |
Bitmap for Sensor type.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |