7#include "LinearAlgebra/Spherical.h"
8#include "LinearAlgebra/SwingTwist.h"
10namespace RoboidControl {
15#define THING_STORE_SIZE 256
23 enum Type :
unsigned char {
46 Thing(
unsigned char thingType = Type::Undetermined);
54 unsigned char thingType = Type::Undetermined,
55 unsigned char thingId = 0);
63 Thing(
Thing* parent,
unsigned char thingType = 0,
unsigned char thingId = 0);
71#pragma region Properties
80 unsigned char type = Type::Undetermined;
83 const char*
name =
nullptr;
86 void SetName(
const char*
name);
87 const char* GetName()
const;
88 bool nameChanged =
false;
103#pragma endregion Properties
105#pragma region Hierarchy
146 Thing* parent =
nullptr;
147 Thing** children =
nullptr;
149#pragma endregion Hierarchy
199 SwingTwist orientation;
202 Spherical linearVelocity;
204 Spherical angularVelocity;
206#pragma endregion Pose
216 void Update(
bool recursive =
false);
222 virtual void Update(
unsigned long currentTimeMs,
bool recurse =
false);
224 static void UpdateThings(
unsigned long currentTimeMs);
226#pragma endregion Update
A thing which can move itself using a differential drive system.
Definition DifferentialDrive.h:10
A participant is a device which manages things. It can communicate with other participant to synchron...
Definition Participant.h:52
A temperature sensor.
Definition TemperatureSensor.h:8
A thing is the primitive building block.
Definition Thing.h:20
virtual Spherical GetLinearVelocity()
Get the linear velocity of the thing.
Definition Thing.cpp:203
bool angularVelocityUpdated
Boolean indicating the thing has an updated angular velocity.
Definition Thing.h:189
void SetModel(const char *url)
Sets the location from where the 3D model of this Thing can be loaded from.
Definition Thing.cpp:63
void SetPosition(Spherical position)
Set the position of the thing.
Definition Thing.cpp:179
virtual void SetParent(Thing *parent)
Sets the parent of this Thing.
Definition Thing.cpp:69
Thing * GetChildByIndex(unsigned char ix)
Get a child by index.
Definition Thing.cpp:90
SwingTwist GetOrientation()
Get the orientation of the thing.
Definition Thing.cpp:192
void SetOrientation(SwingTwist orientation)
Set the orientation of the thing.
Definition Thing.cpp:187
virtual void AddChild(Thing *child)
Add a child Thing to this Thing.
Definition Thing.cpp:94
float modelScale
The scale of the model (deprecated I think)
Definition Thing.h:101
Spherical GetPosition()
Get the position of the thing.
Definition Thing.cpp:183
Thing * GetParent()
Gets the parent of this Thing.
Definition Thing.cpp:86
bool linearVelocityUpdated
Boolean indicating the thing has an updated linear velocity.
Definition Thing.h:180
void Update(bool recursive=false)
Updates the state of the thing.
Definition Thing.cpp:233
bool terminate
Terminated things are no longer updated.
Definition Thing.h:69
virtual void ProcessBinary(char *bytes)
Function used to process binary data received for this thing.
Definition Thing.cpp:268
virtual void SetAngularVelocity(Spherical angularVelocity)
Set the angular velocity of the thing.
Definition Thing.cpp:207
void SetLinearVelocity(Spherical linearVelocity)
Set the linear velocity of the thing.
Definition Thing.cpp:196
bool hierarchyChanged
Indicator that the hierarchy of the thing has changed.
Definition Thing.h:143
virtual Spherical GetAngularVelocity()
Get the angular velocity of the thing.
Definition Thing.cpp:214
bool positionUpdated
Boolean indicating that the thing has an updated position.
Definition Thing.h:161
const char * name
The name of the thing.
Definition Thing.h:83
Thing * RemoveChild(Thing *child)
Remove the given thing as a child of this thing.
Definition Thing.cpp:117
Thing * GetChild(unsigned char id, bool recurse=false)
Get a child by thing Id.
Definition Thing.cpp:142
bool orientationUpdated
Boolean indicating the thing has an updated orientation.
Definition Thing.h:170
static unsigned long GetTimeMs()
Get the current time in milliseconds.
Definition Thing.cpp:222
Type
Predefined thing types.
Definition Thing.h:23
Participant * owner
The participant managing this thing.
Definition Thing.h:74
virtual int GenerateBinary(char *buffer, unsigned char *ix)
Function used to generate binary data for this thing.
Definition Thing.cpp:263
unsigned char childCount
The number of children.
Definition Thing.h:115
Thing * FindChild(const char *name, bool recurse=true)
Find a thing by name.
Definition Thing.cpp:159
unsigned char type
The type of Thing This can be either a Thing::Type of a byte value for custom types.
Definition Thing.h:80
const char * modelUrl
An URL pointing to the location where a model of the thing can be found.
Definition Thing.h:99
A sensor which can detect touches.
Definition TouchSensor.h:8