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.TouchSensor Class Reference

Detailed Description

A sensor which can detect touches.

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

Public Types

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

Public Member Functions

 TouchSensor (RemoteParticipant participant, bool invokeEvent=true)
 Create a touch sensor.
 
override void CreateComponent ()
 Function which can be used to create components in external engines.
 
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.
 
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

bool touchedSomething = false
 Value which is true when the sensor is touching something, false otherwise.
 
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

◆ TouchSensor()

Passer.RoboidControl.TouchSensor.TouchSensor ( RemoteParticipant  participant,
bool  invokeEvent = true 
)

Create a touch sensor.

Parameters
participantThe participant for with the sensor is needed
invokeEventTrue when the creation should trigger an event

Member Function Documentation

◆ CreateComponent()

override void Passer.RoboidControl.TouchSensor.CreateComponent ( )
virtual

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

Currently this is used to create GameObjects in Unity

Reimplemented from Passer.RoboidControl.Thing.

◆ AddChild()

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

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)
inherited

Remove the given thing as a child of this thing.

Parameters
childThe child to remove

◆ Update()

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

Update this thing.

Parameters
currentTimeThe current time in milliseconds

◆ GenerateBinary()

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

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)
virtualinherited

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)
staticinherited

Trigger the creation for the given thing.

Parameters
thingThe created thing

◆ IsThing()

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

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