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

Detailed Description

A thing is the primitive building block.

Inheritance diagram for Passer.RoboidControl.Thing:
Passer.RoboidControl.DistanceSensor Passer.RoboidControl.TemperatureSensor Passer.RoboidControl.TouchSensor

Public Types

enum  Type {
  Undetermined , Switch , DistanceSensor , DirectionalSensor ,
  TemperatureSensor , ControlledMotor , UncontrolledMotor , Servo ,
  Roboid , Humanoid , ExternalSensor
}
 Predefined thing types.
 

Public Member Functions

delegate void ChangeHandler ()
 
delegate void SphericalHandler (Spherical v)
 
delegate void ThingHandler (Thing t)
 
void AddChild (Thing child)
 Attach a thing as a child of this thing.
 
void RemoveChild (Thing child)
 Remove the given thing as a child of this thing.
 
 Thing (RemoteParticipant participant, bool invokeEvent=false)
 Create a new thing for the given participant.
 
 Thing (RemoteParticipant participant, byte networkId, byte thingId, byte thingType=0)
 Create a new thing for the given participant.
 
virtual void CreateComponent ()
 Function which can be used to create components in external engines.
 
void Update ()
 Convience function for use in Unity which removes the need for a currentTime argument.
 
virtual void Update (ulong currentTime)
 Update this thing.
 
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 void InvokeNewThing (Thing thing)
 Trigger the creation for the given thing.
 
static bool IsThing (Thing thing, byte networkId, byte thingId)
 Check if the thing has the given properaties.
 

Public Attributes

RemoteParticipant participant
 The participant to which this thing belongs.
 
byte networkId
 The network ID of this thing.
 
byte id
 The ID of this thing.
 
byte type
 The type of this thing. This can be either a Thing::Type (needs casting) or a byte value for custom types.
 
List< Thingchildren = new List<Thing>()
 The list of children of this thing.
 
string modelUrl = ""
 An URL pointing to the location where a model of the thing can be found.
 
Spherical angularVelocity = Spherical.zero
 The angular velocity of the thing in local space.
 
Unity.Thing component = null
 A reference to the representation of the thing in Unity.
 

Properties

Thing parent [get, set]
 The parent of this thing.
 
virtual string name [get, set]
 The name of the 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.
 

Events

ChangeHandler OnParentChanged = delegate { }
 Event which is triggered when the parent changes.
 
ChangeHandler OnNameChanged = delegate { }
 Event which is triggered when the name changes.
 
ChangeHandler OnPositionChanged = delegate { }
 Event triggered when the position has changed.
 
ChangeHandler OnOrientationChanged = delegate { }
 Event triggered when the orientation has changed.
 
SphericalHandler OnLinearVelocityChanged = delegate { }
 Event triggered when the linear velocity has changed.
 
static ThingHandler OnNewThing = delegate { }
 Event triggered when a new thing has been created.
 

Constructor & Destructor Documentation

◆ Thing() [1/2]

Passer.RoboidControl.Thing.Thing ( RemoteParticipant  participant,
bool  invokeEvent = false 
)

Create a new thing for the given participant.

Parameters
participantThe participant for which this thing is created
invokeEventTrue when a new thing event should be triggered

◆ Thing() [2/2]

Passer.RoboidControl.Thing.Thing ( RemoteParticipant  participant,
byte  networkId,
byte  thingId,
byte  thingType = 0 
)

Create a new thing for the given participant.

Parameters
participantThe participant for which this thing is created
networkIdThe network ID of the thing
thingIdThe ID of the thing
thingTypeThe type of thing

Member Function Documentation

◆ AddChild()

void Passer.RoboidControl.Thing.AddChild ( Thing  child)

Attach a thing as a child of this thing.

Parameters
childThe thing to attach as a child

◆ RemoveChild()

void Passer.RoboidControl.Thing.RemoveChild ( Thing  child)

Remove the given thing as a child of this thing.

Parameters
childThe child to remove

◆ CreateComponent()

virtual void Passer.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 Passer.RoboidControl.DistanceSensor, and Passer.RoboidControl.TouchSensor.

◆ Update()

virtual void Passer.RoboidControl.Thing.Update ( ulong  currentTime)
virtual

Update this thing.

Parameters
currentTimeThe current time in milliseconds

◆ GenerateBinary()

virtual byte[] Passer.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

◆ ProcessBinary()

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

Function used to process binary data received for this thing.

Parameters
bytesThe binary data

Reimplemented in Passer.RoboidControl.DistanceSensor, and Passer.RoboidControl.TemperatureSensor.

◆ InvokeNewThing()

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

Trigger the creation for the given thing.

Parameters
thingThe created thing

◆ IsThing()

static bool Passer.RoboidControl.Thing.IsThing ( Thing  thing,
byte  networkId,
byte  thingId 
)
static

Check if the thing has the given properaties.

Parameters
thingThe thing to check
networkIdThe network ID to compare to
thingIdThe thing ID to compare to
Returns
True when the thing has the given properties