Class: RobotRepresentation

RobotRepresentation

Class representing a basic robot's representation.

Constructor

new RobotRepresentation()

Author:
  • Loris Tissino (http://loris.tissino.it)
License:
  • MIT
Source:

Methods

(abstract) build() → {boolean}

Builds the robot's representation.
Source:
Returns:
- Whether the robot's representation could be built
Type
boolean

createDOFConstraint(mainObject, constrainedObject, position) → {Physijs.DOFConstraint}

Returns a Physijs DOF Constraint.
Parameters:
Name Type Description
mainObject Object First object to be constrained
constrainedObject Object Second object to be constrained
position THREE.Vector3 Point in the scene to apply the constraint
Source:
Returns:
- The constraint created
Type
Physijs.DOFConstraint

createHingeConstraint(mainObject, constrainedObject, position, axis) → {Physijs.DOFConstraint}

Returns a Physijs Hinge Constraint.
Parameters:
Name Type Description
mainObject Object First object to be constrained
constrainedObject Object Second object to be constrained
position THREE.Vector3 Point in the scene to apply the constraint
axis THREE.Vector3 Axis along which the hinge lies
Source:
Returns:
- The constraint created
Type
Physijs.DOFConstraint

createWheel(options) → {Physijs.CylinderMesh}

Returns a Physijs CylinderMesh representing a wheel.
Parameters:
Name Type Description
options Object The options
Source:
Returns:
- The wheel created
Type
Physijs.CylinderMesh

getAbsolutePositionForObject(obj, forceUpdate) → {THREE.Vector3}

Returns the absolute position of an object.
Parameters:
Name Type Description
obj Object The object
forceUpdate boolean Whether the cached value should be used
Source:
Returns:
- The position
Type
THREE.Vector3

getAngle(pos1, pos2, axes) → {float}

Returns the angle on a plain between two points.
Parameters:
Name Type Description
pos1 THREE.Vector3 The first point
pos2 THREE.Vector3 The second point
axes array An array of two chars, each representing an axis to be considered for the definition of the plane
Source:
Returns:
- The angle in radians
Type
float

getBottomImagePixelCoordinatesForObject(obj, forceUpdate) → {THREE.Vector2}

Returns the coordinates of an object mapped on the pixels of the bottom image.
Parameters:
Name Type Description
obj Object The object
forceUpdate boolean Whether the cached value should be used
Source:
Returns:
- The coordinates
Type
THREE.Vector2

getLambertPjsMaterial() → {object}

Returns a Physijs Material based on a THREE.MeshLambertMaterial.
Source:
Returns:
- The material created
Type
object

hasCamera() → {boolean}

Returns true if the robot has available a (virtual) camera.
Source:
Returns:
- Whether the robot has been assigned a remote control
Type
boolean

hasController() → {boolean}

Returns true if the robot has been assigned a remote control.
Source:
Returns:
- Whether the robot has been assigned a remote control
Type
boolean

(abstract) manageCommunicationFailure()

Manages the fact that there has been a communication failure.
Source:

move(vector, relative) → {RobotRepresentation}

Moves the robot to a specific place.
Parameters:
Name Type Description
vector THREE.Vector3 The vector with the coordinates to move the robot to
relative boolean Whether the coordinates are to be considered relative or absolute
Source:
Returns:
- The robot
Type
RobotRepresentation

rotateOnAxis(axis, angle) → {RobotRepresentation}

Rotates the robot on an axis.
Parameters:
Name Type Description
axis THREE.Vector3 The axis along which the robot should be rotated
angle float The angle of rotation, in radians
Source:
Returns:
- The robot
Type
RobotRepresentation

setControllerUrl(url) → {RobotRepresentation}

Sets the url for the simulated remote control or similar device.
Parameters:
Name Type Description
url string The URL
Source:
Returns:
- The robot
Type
RobotRepresentation

setId(id) → {RobotRepresentation}

Sets the id of the robot and prepares the containers it needs.
Parameters:
Name Type Description
id string The id of the robot
Source:
Returns:
- The robot
Type
RobotRepresentation

setInitialValues(values) → {RobotRepresentation}

Sets the initialValues of the robot.
Parameters:
Name Type Description
values Object The values
Source:
Returns:
- The robot
Type
RobotRepresentation

setRobotManager(robotsManager) → {RobotRepresentation}

Sets the robot's manager.
Parameters:
Name Type Description
robotsManager RobotsManager The Robots' Manager to set
Source:
Returns:
- The robot
Type
RobotRepresentation

show() → {RobotRepresentation}

Writes information about the robot on the console.
Source:
Returns:
- The robot
Type
RobotRepresentation

(abstract) update(data)

Updates the data to/from the robot's behavior.
Parameters:
Name Type Description
data Object The data received/transmitted
Source:

updateWheelSpeed(wheel, speed) → {RobotRepresentation}

Updates the speed of a wheel.
Parameters:
Name Type Description
wheel Object The wheel to update
speed float The speed to set
Source:
Returns:
- The robot
Type
RobotRepresentation