![]() |
Roboid Control for Python
|
A thing is the basic building block.
Classes | |
class | Type |
Predefined thing types. More... | |
Public Member Functions | |
None | __init__ (self, Optional['Participant'] owner=None, Optional['Thing'] parent=None, int thing_type=Type.Undetermined, int thing_id=0) |
Create a new thing. | |
SetParent (self, Optional['Thing'] parent) | |
Sets the parent of this Thing. | |
AddChild (self, 'Thing' child) | |
Add a child Thing to this Thing. | |
RemoveChild (self, 'Thing' child) | |
Remove the given thing as a child of this thing. | |
Optional[ 'Thing'] | GetChild (self, int thing_id, bool recurse=False) |
Get a child by thing Id. | |
Optional[ 'Thing'] | FindChild (self, str name, bool recurse=True) |
Find a thing by name. | |
None | SetPosition (self, Spherical position) |
Set the position of the thing. | |
None | SetOrientation (self, Quaternion orientation) |
Set the orientation of the thing. | |
None | SetLinearVelocity (self, Spherical linear_velocity) |
Set the linear velocity of the thing. | |
None | SetAngularVelocity (self, Spherical angular_velocity) |
Set the angular velocity of the thing. | |
None | Update (self, int currentTimeMs=0, bool recurse=False) |
Update de state of the thing. | |
int | GenerateBinary (self, bytearray bytes, set[int] ix_ref) |
Function used to generate binary data for this thing. | |
ProcessBinary (self, bytes data) | |
Function used to process binary data received for this thing. | |
Static Public Member Functions | |
int | GetTimeMs () |
Get the current time in milliseconds. | |
Public Attributes | |
owner | |
parent | |
position | |
position_updated | |
orientation | |
orientation_updated | |
linear_velocity_updated | |
linear_velocity | |
angular_velocity_updated | |
angular_velocity | |
Static Public Attributes | |
Position | |
int | Orientation = 0x02 |
int | LinearVelocity = 0x04 |
int | AngularVelocity = 0x08 |
None __init__ | ( | self, | |
Optional['Participant'] | owner = None , |
||
Optional['Thing'] | parent = None , |
||
int | thing_type = Type.Undetermined , |
||
int | thing_id = 0 |
||
) |
Create a new thing.
owner | The owning participant |
parent | The parent thing (will override owner if set) |
thing_type | The type of thing (can use Thing.Type) |
thingId | The ID of the thing, leave out or set to zero to generate an ID |
Reimplemented in DifferentialDrive, TouchSensor, TemperatureSensor, and TouchSensor.
SetParent | ( | self, | |
Optional['Thing'] | parent | ||
) |
Sets the parent of this Thing.
The | Thing which should become the parent |
AddChild | ( | self, | |
'Thing' | child | ||
) |
Add a child Thing to this Thing.
child | The Thing which should become a child |
RemoveChild | ( | self, | |
'Thing' | child | ||
) |
Remove the given thing as a child of this thing.
child | The child to remove |
Optional['Thing'] GetChild | ( | self, | |
int | thing_id, | ||
bool | recurse = False |
||
) |
Get a child by thing Id.
id | The thing ID to find |
recurse | Look recursively through all descendants |
Optional['Thing'] FindChild | ( | self, | |
str | name, | ||
bool | recurse = True |
||
) |
Find a thing by name.
name | The name of the thing |
recurse | Look recursively through all descendants |
None SetPosition | ( | self, | |
Spherical | position | ||
) |
Set the position of the thing.
position | The new position in local space, in meters |
None SetOrientation | ( | self, | |
Quaternion | orientation | ||
) |
Set the orientation of the thing.
orientation | The new orientation in local space |
None SetLinearVelocity | ( | self, | |
Spherical | linear_velocity | ||
) |
Set the linear velocity of the thing.
linearVelocity | The new linear velocity in local space, in meters per second |
None SetAngularVelocity | ( | self, | |
Spherical | angular_velocity | ||
) |
Set the angular velocity of the thing.
angularVelocity | the new angular velocity in local space |
|
static |
Get the current time in milliseconds.
None Update | ( | self, | |
int | currentTimeMs = 0 , |
||
bool | recurse = False |
||
) |
Update de state of the thing.
currentTimeMs | The current clock time in milliseconds; If this is zero, the current time is retrieved automatically |
recurse | When true, this will Update the descendants recursively |
Reimplemented in DifferentialDrive.
int GenerateBinary | ( | self, | |
bytearray | bytes, | ||
set[int] | ix_ref | ||
) |
Function used to generate binary data for this thing.
buffer | The byte array for thw binary data |
ix_ref | A single element array with the starting position for writing the binary data |
Reimplemented in TouchSensor, TemperatureSensor, and TouchSensor.
ProcessBinary | ( | self, | |
bytes | data | ||
) |
Function used to process binary data received for this thing.
bytes | The binary data |
Reimplemented in TouchSensor, TemperatureSensor, and TouchSensor.