Roboid Control for C#
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Properties | Events | List of all members
RoboidControl.Thing Class Reference

Detailed Description

A thing is the primitive building block.

Inheritance diagram for RoboidControl.Thing:
RoboidControl.DifferentialDrive RoboidControl.DigitalSensor RoboidControl.DistanceSensor RoboidControl.TemperatureSensor RoboidControl.TouchSensor

Classes

class  Type
 Predefined thing types. More...
 

Public Member Functions

 Thing (byte thingType=Type.Undetermined, bool invokeEvent=true)
 Create a new thing without communication abilities.
 
 Thing (Participant owner, byte thingType=Type.Undetermined, byte thingId=0, bool invokeEvent=true)
 Create a new thing for a participant.
 
 Thing (Thing parent, byte thingType=Type.Undetermined, byte thingId=0, bool invokeEvent=true)
 Create a new child thing.
 
virtual void CreateComponent ()
 Function which can be used to create components in external engines.
 
void AddChild (Thing child)
 Add a child Thing to this Thing.
 
bool RemoveChild (Thing child)
 Remove the given thing as a child of this thing.
 
void Update (bool recurse=false)
 Update de state of the thing.
 
virtual void Update (ulong currentTimeMs, bool recurse=false)
 Update this thing.
 
delegate void ChangeHandler ()
 
delegate void SphericalHandler (Spherical v)
 
delegate void ThingHandler (Thing t)
 
virtual byte[] GenerateBinary ()
 Function used to generate binary data for this thing.
 
virtual void ProcessBinary (byte[] bytes)
 Function used to process binary data received for this thing.
 

Static Public Member Functions

static ulong GetTimeMs ()
 Get the current time in milliseconds.
 
static void InvokeNewThing (Thing thing)
 Trigger the creation for the given thing.
 

Public Attributes

bool terminate = false
 
Participant owner = null
 The participant owning this thing.
 
byte id = 0
 The ID of this thing.
 
byte type = Type.Undetermined
 The type of this thing.
 
bool nameChanged = false
 
string modelUrl = ""
 An URL pointing to the location where a model of the thing can be found.
 
Unity.Thing component = null
 A reference to the representation of the thing in Unity.
 
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

List< Thingchildren = new()
 The children of this thing.
 

Properties

virtual string name [get, set]
 The name of the thing.
 
Thing parent [get, set]
 The parent of this thing.
 
Spherical position [get, set]
 The position of the thing in local space, in meters.
 
SwingTwist orientation [get, set]
 The orientation of the thing in local space.
 
Spherical linearVelocity [get, set]
 The linear velocity of the thing in local space in meters per second.
 
Spherical angularVelocity [get, set]
 The angular velocity of the thing in local space in degrees per second.
 

Events

ChangeHandler OnNameChanged = delegate { }
 Event which is triggered when the name changes.
 
ChangeHandler OnPoseChanged = delegate { }
 Event triggered when the pose has changed.
 
SphericalHandler OnLinearVelocityChanged = delegate { }
 Event triggered when the linear velocity has changed.
 
SphericalHandler OnAngularVelocityChanged = delegate { }
 Event triggered when the angular velocity has changed.
 
static ThingHandler OnNewThing = delegate { }
 Event triggered when a new thing has been created.
 

Constructor & Destructor Documentation

◆ Thing() [1/3]

RoboidControl.Thing.Thing ( byte  thingType = Type::Undetermined,
bool  invokeEvent = true 
)

Create a new thing without communication abilities.

Parameters
thingTypeThe type of thing (can use Thing.Type)
invokeEventInvoke a OnNewThing event when the thing has been created

◆ Thing() [2/3]

RoboidControl.Thing.Thing ( Participant  owner,
byte  thingType = Type::Undetermined,
byte  thingId = 0,
bool  invokeEvent = true 
)

Create a new thing for a participant.

Parameters
ownerThe owning participant
thingTypeThe type of thing (can use Thing.Type)
thingIdThe ID of the thing, leave out or set to zero to generate an ID
invokeEventInvoke a OnNewThing event when the thing has been created

◆ Thing() [3/3]

RoboidControl.Thing.Thing ( Thing  parent,
byte  thingType = Type::Undetermined,
byte  thingId = 0,
bool  invokeEvent = true 
)

Create a new child thing.

Parameters
parentThe parent thing
thingTypeThe type of thing (can use Thing.Type)
thingIdThe ID of the thing, leave out or set to zero to generate an ID
invokeEventInvoke a OnNewThing event when the thing has been created

<note>The owner will be the same as the owner of the parent thing</note>

Member Function Documentation

◆ CreateComponent()

virtual void RoboidControl.Thing.CreateComponent ( )
virtual

Function which can be used to create components in external engines.

Currently this is used to create GameObjects in Unity

Reimplemented in RoboidControl.DigitalSensor, RoboidControl.DistanceSensor, and RoboidControl.TouchSensor.

◆ AddChild()

void RoboidControl.Thing.AddChild ( Thing  child)

Add a child Thing to this Thing.

Parameters
childThe Thing which should become a child
Remarks
When the Thing is already a child, it will not be added again

◆ RemoveChild()

bool RoboidControl.Thing.RemoveChild ( Thing  child)

Remove the given thing as a child of this thing.

Parameters
childThe child to remove
Returns
True when the child was present or false when it was not found

◆ GetTimeMs()

static ulong RoboidControl.Thing.GetTimeMs ( )
static

Get the current time in milliseconds.

Returns
The current time in milliseconds

◆ Update() [1/2]

void RoboidControl.Thing.Update ( bool  recurse = false)

Update de state of the thing.

Parameters
recurseWhen true, this will Update the descendants recursively

◆ Update() [2/2]

virtual void RoboidControl.Thing.Update ( ulong  currentTimeMs,
bool  recurse = false 
)
virtual

Update this thing.

Parameters
currentTimehe current clock time in milliseconds; if this is zero, the current time is retrieved automatically
recurseWhen true, this will Update the descendants recursively

Reimplemented in RoboidControl.DifferentialDrive.

◆ InvokeNewThing()

static void RoboidControl.Thing.InvokeNewThing ( Thing  thing)
static

Trigger the creation for the given thing.

Parameters
thingThe created thing

◆ GenerateBinary()

virtual byte[] RoboidControl.Thing.GenerateBinary ( )
virtual

Function used to generate binary data for this thing.

Returns
A byte array with the binary data
See also
Passer::RoboidControl::BinaryMsg

Reimplemented in RoboidControl.DigitalSensor, RoboidControl.TemperatureSensor, and RoboidControl.TouchSensor.

◆ ProcessBinary()

virtual void RoboidControl.Thing.ProcessBinary ( byte[]  bytes)
virtual

Function used to process binary data received for this thing.

Parameters
bytesThe binary data to process

Reimplemented in RoboidControl.DigitalSensor, RoboidControl.DistanceSensor, RoboidControl.TemperatureSensor, and RoboidControl.TouchSensor.

Member Data Documentation

◆ type

byte RoboidControl.Thing.type = Type.Undetermined

The type of this thing.

This can be either a Thing.Type or a byte value for custom types.