![]() |
Roboid Control for C++
|
A thing is the primitive building block.
#include <Thing.h>
Public Types | |
| enum class | Type { Undetermined , Switch , DistanceSensor , DirectionalSensor , TemperatureSensor , ControlledMotor , UncontrolledMotor , Servo , Roboid , Humanoid , ExternalSensor } |
| Predefined thing types. | |
Public Member Functions | |
| Thing (Type thingType=Type::Undetermined) | |
| Create a new thing of the given type. | |
| Thing (unsigned char thingType) | |
| Create a new thing of the give type. | |
| Thing (RemoteParticipant *participant, unsigned char networkId, unsigned char thingId, Type thingType=Type::Undetermined) | |
| Create a new thing for the given participant. | |
| Thing * | FindThing (const char *name) |
| Find a thing by name. | |
| virtual void | SetParent (Thing *parent) |
| Sets the parent Thing. | |
| void | SetParent (Thing *root, const char *name) |
| Thing * | GetParent () |
| Gets the parent Thing. | |
| 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 recursive=false) |
| Get a child by thing Id. | |
| Thing * | GetChildByIndex (unsigned char ix) |
| Get a child by index. | |
| void | SetPosition (Spherical16 position) |
| Set the position of the thing. | |
| Spherical16 | GetPosition () |
| Get the position of the thing. | |
| void | SetOrientation (SwingTwist16 orientation) |
| Set the orientation of the thing. | |
| SwingTwist16 | GetOrientation () |
| Get the orientation of the thing. | |
| virtual Spherical16 | GetLinearVelocity () |
| Get the linear velocity of the thing. | |
| virtual Spherical16 | GetAngularVelocity () |
| Get the angular velocity of the thing. | |
| void | Terminate () |
| Terminated things are no longer updated. | |
| void | SetModel (const char *url) |
| Sets the location from where the 3D model of this Thing can be loaded from. | |
| virtual void | Update (unsigned long currentTimeMs) |
| Updates the state of the thing. | |
| virtual void | GenerateBinary (char *buffer, unsigned char *ix) |
| Function used to generate binary data for this thing. | |
| virtual void | ProcessBinary (char *bytes) |
Public Attributes | |
| RemoteParticipant * | participant |
| unsigned char | networkId = 0 |
| unsigned char | id = 0 |
| The ID of the thing. | |
| unsigned char | type = 0 |
| The type of Thing. | |
| unsigned char | childCount = 0 |
| The number of children. | |
| const char * | name = nullptr |
| The name of the thing. | |
| const char * | modelUrl = nullptr |
| An URL pointing to the location where a model of the thing can be found. | |
| float | modelScale = 1 |
| The scale of the model (deprecated I think) | |
| float | scale = 1 |
| The scale of the thing (deprecated I think) | |
| bool | positionUpdated = false |
| boolean indicating if the position was updated | |
| bool | orientationUpdated = false |
| boolean indicating if the orientation was updated | |
| Spherical16 | linearVelocity |
| Spherical16 | angularVelocity |
Protected Attributes | |
| Thing * | parent = nullptr |
| Thing ** | children = nullptr |
| Spherical16 | position |
| The position in local space. | |
| SwingTwist16 | orientation |
| The orientation in local space. | |
| Thing::Thing | ( | Type | thingType = Type::Undetermined | ) |
Create a new thing of the given type.
| thingType | The predefined type of thing |
| Thing::Thing | ( | unsigned char | thingType | ) |
Create a new thing of the give type.
| thingType | The custom type of the thing |
| Thing::Thing | ( | RemoteParticipant * | participant, |
| unsigned char | networkId, | ||
| unsigned char | thingId, | ||
| Type | thingType = Type::Undetermined |
||
| ) |
Create a new thing for the given participant.
| participant | The participant for which this thing is created |
| networkId | The network ID of the thing |
| thingId | The ID of the thing |
| thingType | The type of thing |
| Thing * Thing::FindThing | ( | const char * | name | ) |
Find a thing by name.
| name | Rhe name of the thing |
|
virtual |
|
virtual |
Remove the given thing as a child of this thing.
| child | The child to remove |
| Thing * Thing::GetChild | ( | unsigned char | id, |
| bool | recursive = false |
||
| ) |
Get a child by thing Id.
| id | The thing ID to find |
| recursive | Look recursively through all descendants |
| Thing * Thing::GetChildByIndex | ( | unsigned char | ix | ) |
Get a child by index.
| ix | The child index |
| void Thing::SetPosition | ( | Spherical16 | position | ) |
Set the position of the thing.
| position | The new position in local space, in meters |
| Spherical16 Thing::GetPosition | ( | ) |
Get the position of the thing.
| void Thing::SetOrientation | ( | SwingTwist16 | orientation | ) |
Set the orientation of the thing.
| orientation | The new orientation in local space |
| SwingTwist16 Thing::GetOrientation | ( | ) |
Get the orientation of the thing.
|
virtual |
Get the linear velocity of the thing.
|
virtual |
Get the angular velocity of the thing.
| void Thing::SetModel | ( | const char * | url | ) |
Sets the location from where the 3D model of this Thing can be loaded from.
| url | The url of the model |
|
inlinevirtual |
Updates the state of the thing.
| currentTimeMs | The current clock time in milliseconds |
|
virtual |
Function used to generate binary data for this thing.
| buffer | The byte array for thw binary data |
| ix | The starting position for writing the binary data |
Reimplemented in Passer::RoboidControl::TemperatureSensor.
|
virtual |
| bytes | The binary data |
Reimplemented in Passer::RoboidControl::TemperatureSensor.
|
protected |
The position in local space.
|
protected |
The orientation in local space.