![]() |
Roboid Control for C++ 0.4
|
Support for a DRV8833 motor controller.
#include <DRV8833.h>
Inherits RoboidControl::Motor.
Public Types | |
| enum class | Direction { Clockwise = 1 , CounterClockwise = -1 } |
| Motor turning direction. | |
Public Member Functions | |
| DRV8833Motor (DRV8833 *driver, unsigned char pinIn1, unsigned char pinIn2, bool reverse=false) | |
| Setup the DC motor. | |
| virtual void | SetTargetVelocity (float targetSpeed) override |
| virtual float | GetTargetVelocity () |
| int | GenerateBinary (char *bytes, unsigned char *ix) override |
| void | SetName (const char *name) |
| const char * | GetName () const |
| void | SetModel (const char *url) |
| Sets the location from where the 3D model of this Thing can be loaded from. | |
| void | SetParent (Thing *parent) |
| Sets the parent of this Thing. | |
| Thing * | GetParent () |
| Gets the parent of this Thing. | |
| bool | IsRoot () const |
| Check if this is a root thing. | |
| Thing * | GetChildByIndex (unsigned char ix) |
| Get a child by index. | |
| virtual void | AddChild (Thing *child) |
| Add a child Thing to this Thing. | |
| Thing * | RemoveChild (Thing *child) |
| Remove the given thing as a child of this thing. | |
| Thing * | GetChild (unsigned char id, bool recurse=false) |
| Get a child by thing Id. | |
| Thing * | FindChild (const char *name, bool recurse=true) |
| Find a thing by name. | |
| void | SetPosition (Spherical position) |
| Set the position of the thing. | |
| Spherical | GetPosition () |
| Get the position of the thing. | |
| void | SetOrientation (SwingTwist orientation) |
| Set the orientation of the thing. | |
| SwingTwist | GetOrientation () |
| Get the orientation of the thing. | |
| void | SetLinearVelocity (Spherical linearVelocity) |
| Set the linear velocity of the thing. | |
| virtual Spherical | GetLinearVelocity () |
| Get the linear velocity of the thing. | |
| virtual void | SetAngularVelocity (Spherical angularVelocity) |
| Set the angular velocity of the thing. | |
| virtual Spherical | GetAngularVelocity () |
| Get the angular velocity of the thing. | |
| virtual void | PrepareForUpdate () |
| virtual void | Update (bool recurse=false) |
| Updates the state of the thing. | |
| virtual void | ProcessBinary (char *bytes) |
| Function used to process binary data received for this thing. | |
Static Public Member Functions | |
| static void | CreateRoot (Participant *owner) |
| Create a root thing for a participant. | |
| static Thing * | LocalRoot () |
| The root thing for the local participant. | |
| static unsigned long | GetTimeMs () |
| Get the current time in milliseconds. | |
Public Attributes | |
| Direction | direction |
| The forward turning direction of the motor. | |
| bool | terminate = false |
| Terminated things are no longer updated. | |
| unsigned char | id = 0 |
| The ID of the thing. | |
| unsigned char | type = Type::Undetermined |
| The type of Thing This can be either a Thing::Type of a byte value for custom types. | |
| Participant * | owner = nullptr |
| The participant owning this thing. | |
| const char * | name = nullptr |
| The name of the thing. | |
| bool | nameChanged = false |
| const char * | modelUrl = nullptr |
| An URL pointing to the location where a model of the thing can be found. | |
| unsigned char | childCount = 0 |
| The number of children. | |
| bool | hierarchyChanged = true |
| Indicator that the hierarchy of the thing has changed. | |
| bool | positionUpdated = false |
| Boolean indicating that the thing has an updated position. | |
| bool | orientationUpdated = false |
| Boolean indicating the thing has an updated orientation. | |
| bool | linearVelocityUpdated = false |
| Boolean indicating the thing has an updated linear velocity. | |
| bool | angularVelocityUpdated = false |
| Boolean indicating the thing has an updated angular velocity. | |
Protected Attributes | |
| unsigned char | pinIn1 = 255 |
| unsigned char | pinIn2 = 255 |
| uint8_t | in1Ch |
| uint8_t | in2Ch |
| float | targetVelocity = 0 |
Static Protected Attributes | |
| static uint8_t | nextAvailablePwmChannel = 0 |
| RoboidControl::Arduino::DRV8833Motor::DRV8833Motor | ( | DRV8833 * | driver, |
| unsigned char | pinIn1, | ||
| unsigned char | pinIn2, | ||
| bool | reverse = false |
||
| ) |
Setup the DC motor.
| pinIn1 | the pin number for the in1 signal |
| pinIn2 | the pin number for the in2 signal |
| direction | the forward turning direction of the motor |
|
staticinherited |
Create a root thing for a participant.
| owner | The participant who will own this root thing |
|
staticinherited |
The root thing for the local participant.
|
inherited |
Sets the location from where the 3D model of this Thing can be loaded from.
| url | The url of the model |
|
inherited |
|
inherited |
|
inherited |
Check if this is a root thing.
|
inherited |
Get a child by index.
| ix | The child index |
|
virtualinherited |
Remove the given thing as a child of this thing.
| child | The child to remove |
|
inherited |
Get a child by thing Id.
| id | The thing ID to find |
| recurse | Look recursively through all descendants |
|
inherited |
Find a thing by name.
| name | The name of the thing |
| recurse | Look recursively through all descendants |
|
inherited |
Set the position of the thing.
| position | The new position in local space, in meters |
|
inherited |
Get the position of the thing.
|
inherited |
Set the orientation of the thing.
| orientation | The new orientation in local space |
|
inherited |
Get the orientation of the thing.
|
inherited |
Set the linear velocity of the thing.
| linearVelocity | The new linear velocity in local space, in meters per second |
|
virtualinherited |
Get the linear velocity of the thing.
|
virtualinherited |
Set the angular velocity of the thing.
| angularVelocity | the new angular velocity in local space |
|
virtualinherited |
Get the angular velocity of the thing.
|
virtualinherited |
Updates the state of the thing.
| recurse | When true, this will Update the descendants recursively |
Reimplemented in RoboidControl::ControlledMotor, RoboidControl::TouchSensor, RoboidControl::Arduino::DigitalInput, RoboidControl::Arduino::UltrasonicSensor, and RoboidControl::DifferentialDrive.
|
staticinherited |
Get the current time in milliseconds.
|
virtualinherited |
Function used to process binary data received for this thing.
| bytes | The binary data |
Reimplemented in RoboidControl::DigitalSensor, RoboidControl::RelativeEncoder, RoboidControl::TemperatureSensor, and RoboidControl::TouchSensor.