Class WorldComponent
Vector’s known view of his world.
This view includes objects and faces it knows about and can currently see with its camera.
Implements
Inherited Members
Namespace: Anki.Vector
Assembly: Anki.Vector.dll
Syntax
public class WorldComponent : Component, INotifyPropertyChanged
Fields
| Improve this Doc View SourceObjectVisibilityTimeout
The object visibility timeout in milliseconds
public const int ObjectVisibilityTimeout = 2500
Field Type
| Int32 |
Properties
| Improve this Doc View SourceCharger
Gets the charger if it has been seen by the robot, otherwise this value is null.
public Charger Charger { get; }
Property Type
| Charger |
IsCubeConnected
Gets a value indicating whether the is cube connected.
public bool IsCubeConnected { get; }
Property Type
| Boolean |
LightCube
Gets the light cube if it has been seen by the robot, otherwise this value is null.
public LightCube LightCube { get; }
Property Type
| LightCube |
Objects
Gets the all objects currently tracked in the world
public ReadOnlyObservableCollection<ObservableObject> Objects { get; }
Property Type
| ReadOnlyObservableCollection<ObservableObject> |
Methods
| Improve this Doc View SourceConnectCube()
Attempt to connect to a cube.
If a cube is currently connected, this will do nothing.
public Task<StatusCode> ConnectCube()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
CreateFixedCustomObject(Pose, Single, Single, Single, Boolean)
Defines a cuboid of custom size and places it in the world. It cannot be observed.
public Task<StatusCode> CreateFixedCustomObject(Pose pose, float xSizeMm, float ySizeMm, float zSizeMm, bool relativeToRobot = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Pose | pose | The pose of the object to create. |
| Single | xSizeMm | The size of the object (in millimeters) in the x axis. |
| Single | ySizeMm | The size of the object (in millimeters) in the y axis. |
| Single | zSizeMm | The size of the object (in millimeters) in the z axis. |
| Boolean | relativeToRobot | Whether or not the pose given assumes the robot's pose as its origin. |
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
CubesAvailable()
Returns the Factory Ids of all available cubes.
public Task<IEnumerable<string>> CubesAvailable()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<String>> | A task that represents the asynchronous operation; the task result contains the factory id's of available cubes. |
DefineCustomObject(CustomObjectType, CustomObjectArchetype, Boolean)
Defines the custom object with the provided object definition.
The robot will now detect the markers associated with this object and raise an ObjectObserved event when they are seen. There are 20 custom object types that can be defined.
public Task<StatusCode> DefineCustomObject(CustomObjectType customObjectType, CustomObjectArchetype archetype, bool isUnique = true)
Parameters
| Type | Name | Description |
|---|---|---|
| CustomObjectType | customObjectType | The object type you are binding this custom object definition to. |
| CustomObjectArchetype | archetype | The custom object archetype (definition). |
| Boolean | isUnique | If True, the robot will assume there is only 1 of this object. (and therefore only 1 of each of any of these markers) in the world. |
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | customObjectType - Custom object type cannot be 'None' |
| ArgumentException | Specified Custom object definition is not supported - definition |
DeleteCustomObjectArchetypes()
Causes the robot to forget all the custom defined object archetypes.
The custom objects need to be deleted from Vector before calling this method to ensure none of the archetypes are in use.
public Task<StatusCode> DeleteCustomObjectArchetypes()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot delete archetypes because custom objects are in use. Delete all custom objects first. |
DeleteCustomObjects()
Causes the robot to forget about all the custom objects it currently knows about.
public Task<StatusCode> DeleteCustomObjects()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
DeleteFixedCustomObjects()
Causes the robot to forget about all the fixed custom objects it currently knows about.
public Task<StatusCode> DeleteFixedCustomObjects()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
DisconnectCube()
Requests a disconnection from the currently connected cube.
public Task<StatusCode> DisconnectCube()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
FlashCubeLights()
Flashes the cube lights.
Plays the default cube connection animation on the currently connected cube's lights.
public Task<StatusCode> FlashCubeLights()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
ForgetPreferredCube()
Forgets the preferred cube.
'Forget' the robot's preferred cube. This will cause the robot to connect to the cube with the highest RSSI(signal strength) next time a connection is requested.
public Task<StatusCode> ForgetPreferredCube()
Returns
| Type | Description |
|---|---|
| Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
GetFaceById(Int32)
Gets the face by face identifier.
public Face GetFaceById(int faceId)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | faceId | The face identifier. |
Returns
| Type | Description |
|---|---|
| Face | The face matching the ID |
GetObjectById(Int32)
Gets an object by object identifier.
public ObjectWithId GetObjectById(int objectId)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | objectId | The object identifier. |
Returns
| Type | Description |
|---|---|
| ObjectWithId | The observable object matching the ID or null |
Events
| Improve this Doc View SourceKnownFaceAppeared
Triggered when a known face has appeared
public event EventHandler<KnownFaceAppearedEventArgs> KnownFaceAppeared
Event Type
| EventHandler<KnownFaceAppearedEventArgs> |
ObjectAdded
Occurs when a new object is added to the world. This will occur only once when a new object is first visually identified by the robot. From then on the object will be available in the Objects collection.
public event EventHandler<ObjectAddedEventArgs> ObjectAdded
Event Type
| EventHandler<ObjectAddedEventArgs> |
ObjectAppeared
Triggered whenever an object is first visually identified by a robot.
This differs from ObjectObserved in that it’s only triggered when an object initially becomes visible. If it disappears for more than ObjectVisibilityTimeout milliseconds and then is seen again, a ObjectDisappeared will be dispatched, followed by another ObjectAppeared event.
For continuous tracking information about a visible object, see ObjectObserved.
public event EventHandler<ObjectAppearedEventArgs> ObjectAppeared
Event Type
| EventHandler<ObjectAppearedEventArgs> |
ObjectConnected
Triggered when the robot connects to the light cube.
public event EventHandler<ObjectConnectedEventArgs> ObjectConnected
Event Type
| EventHandler<ObjectConnectedEventArgs> |
ObjectDisappeared
Triggered whenever an object that was previously being observed is no longer visible.
public event EventHandler<ObjectDisappearedEventArgs> ObjectDisappeared
Event Type
| EventHandler<ObjectDisappearedEventArgs> |
ObjectDisconnected
Triggered when the robot disconnects from the light cube
public event EventHandler<ObjectDisconnectedEventArgs> ObjectDisconnected
Event Type
| EventHandler<ObjectDisconnectedEventArgs> |
ObjectEvent
Occurs when object event occurs.
public event EventHandler<ObjectEventArgs> ObjectEvent
Event Type
| EventHandler<ObjectEventArgs> |
ObjectFinishedMoving
Triggered when the object has finished moving (the light cube)
public event EventHandler<ObjectFinishedMovingEventArgs> ObjectFinishedMoving
Event Type
| EventHandler<ObjectFinishedMovingEventArgs> |
ObjectMoving
Triggered when an object is moved (the light cube)
public event EventHandler<ObjectMovingEventArgs> ObjectMoving
Event Type
| EventHandler<ObjectMovingEventArgs> |
ObjectObserved
Triggered whenever an object is visually identified by the robot.
A stream of these events are produced while an object is visible to the robot.Each event has an updated image_box field. See ObjectAppeared if you only want to know when an object first becomes visible.
public event EventHandler<ObjectObservedEventArgs> ObjectObserved
Event Type
| EventHandler<ObjectObservedEventArgs> |
ObjectTapped
Triggered when the light cube is tapped
public event EventHandler<ObjectTappedEventArgs> ObjectTapped
Event Type
| EventHandler<ObjectTappedEventArgs> |
ObjectUpAxisChanged
Triggered when the light cube's up axis changed.
public event EventHandler<ObjectUpAxisChangedEventArgs> ObjectUpAxisChanged
Event Type
| EventHandler<ObjectUpAxisChangedEventArgs> |