7#include "LinearAlgebra/Spherical.h"
8#include "LinearAlgebra/SwingTwist.h"
10namespace RoboidControl {
15#define THING_STORE_SIZE 256
24 static const unsigned char Undetermined = 0x00;
26 static const unsigned char Switch = 0x01;
27 static const unsigned char DistanceSensor = 0x02;
28 static const unsigned char DirectionalSensor = 0x03;
33 static const unsigned char UncontrolledMotor = 0x07;
34 static const unsigned char Servo = 0x08;
37 static const unsigned char Root = 0x10;
38 static const unsigned char Roboid = 0x09;
39 static const unsigned char Humanoid = 0x0A;
40 static const unsigned char ExternalSensor = 0x08;
41 static const unsigned char Animator = 0x0C;
81#pragma region Properties
89 unsigned char type = Type::Undetermined;
95 const char*
name =
nullptr;
97 void SetName(
const char*
name);
98 const char* GetName()
const;
99 bool nameChanged =
false;
112#pragma endregion Properties
114#pragma region Hierarchy
159 Thing* parent =
nullptr;
160 Thing** children =
nullptr;
162#pragma endregion Hierarchy
212 SwingTwist orientation;
216 Spherical linearVelocity;
219 Spherical angularVelocity;
221#pragma endregion Pose
226 virtual void PrepareForUpdate();
230 virtual void Update(
bool recurse =
false);
236#pragma endregion Update
A motor with speed control It uses a feedback loop from an encoder to regulate the speed The speed is...
Definition ControlledMotor.h:11
A thing which can move itself using a differential drive system.
Definition DifferentialDrive.h:11
A participant is a device which manages things. It can communicate with other participant to synchron...
Definition Participant.h:62
An Incremental Encoder measures the rotations of an axle using a rotary sensor. Some encoders are abl...
Definition RelativeEncoder.h:10
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:225
bool angularVelocityUpdated
Boolean indicating the thing has an updated angular velocity.
Definition Thing.h:202
void SetModel(const char *url)
Sets the location from where the 3D model of this Thing can be loaded from.
Definition Thing.cpp:87
virtual void Update(bool recurse=false)
Updates the state of the thing.
Definition Thing.cpp:262
void SetPosition(Spherical position)
Set the position of the thing.
Definition Thing.cpp:201
void SetParent(Thing *parent)
Sets the parent of this Thing.
Definition Thing.cpp:93
Thing * GetChildByIndex(unsigned char ix)
Get a child by index.
Definition Thing.cpp:112
SwingTwist GetOrientation()
Get the orientation of the thing.
Definition Thing.cpp:214
void SetOrientation(SwingTwist orientation)
Set the orientation of the thing.
Definition Thing.cpp:209
virtual void AddChild(Thing *child)
Add a child Thing to this Thing.
Definition Thing.cpp:116
Spherical GetPosition()
Get the position of the thing.
Definition Thing.cpp:205
Thing * GetParent()
Gets the parent of this Thing.
Definition Thing.cpp:108
bool linearVelocityUpdated
Boolean indicating the thing has an updated linear velocity.
Definition Thing.h:193
bool terminate
Terminated things are no longer updated.
Definition Thing.h:79
bool IsRoot() const
Check if this is a root thing.
Definition Thing.cpp:104
virtual void ProcessBinary(char *bytes)
Function used to process binary data received for this thing.
Definition Thing.cpp:288
virtual void SetAngularVelocity(Spherical angularVelocity)
Set the angular velocity of the thing.
Definition Thing.cpp:229
void SetLinearVelocity(Spherical linearVelocity)
Set the linear velocity of the thing.
Definition Thing.cpp:218
~Thing()
Destructor for a Thing.
Definition Thing.cpp:72
bool hierarchyChanged
Indicator that the hierarchy of the thing has changed.
Definition Thing.h:156
virtual Spherical GetAngularVelocity()
Get the angular velocity of the thing.
Definition Thing.cpp:236
bool positionUpdated
Boolean indicating that the thing has an updated position.
Definition Thing.h:174
const char * name
The name of the thing.
Definition Thing.h:95
Thing * RemoveChild(Thing *child)
Remove the given thing as a child of this thing.
Definition Thing.cpp:139
Thing * GetChild(unsigned char id, bool recurse=false)
Get a child by thing Id.
Definition Thing.cpp:164
bool orientationUpdated
Boolean indicating the thing has an updated orientation.
Definition Thing.h:183
static unsigned long GetTimeMs()
Get the current time in milliseconds.
Definition Thing.cpp:244
Participant * owner
The participant owning this thing.
Definition Thing.h:92
virtual int GenerateBinary(char *buffer, unsigned char *ix)
Function used to generate binary data for this thing.
Definition Thing.cpp:283
unsigned char childCount
The number of children.
Definition Thing.h:128
Thing * FindChild(const char *name, bool recurse=true)
Find a thing by name.
Definition Thing.cpp:181
static Thing * LocalRoot()
The root thing for the local participant.
Definition Thing.cpp:23
unsigned char type
The type of Thing This can be either a Thing::Type of a byte value for custom types.
Definition Thing.h:89
static void CreateRoot(Participant *owner)
Create a root thing for a participant.
Definition Thing.cpp:48
const char * modelUrl
An URL pointing to the location where a model of the thing can be found.
Definition Thing.h:110
A sensor which can detect touches.
Definition TouchSensor.h:8
Predefined thing types.
Definition Thing.h:23