Class Robot
The main robot class for managing Vector.
The Robot object is responsible for managing the state and connections to a Vector, and is typically the entry-point to running the SDK.
Inherited Members
Namespace: Anki.Vector
Assembly: Anki.Vector.dll
Syntax
public class Robot : RobotObject, INotifyPropertyChanged, IDisposable
Constructors
| Improve this Doc View SourceRobot()
Initializes a new instance of the Robot class.
public Robot()
Properties
| Improve this Doc View SourceAcceleration
Gets the current accelerometer reading
public Acceleration Acceleration { get; }
Property Type
Acceleration |
Animation
Gets the animation component.
public AnimationComponent Animation { get; }
Property Type
AnimationComponent |
Audio
Gets the audio component.
public AudioComponent Audio { get; }
Property Type
AudioComponent |
Behavior
Gets the behavior component
public BehaviorComponent Behavior { get; }
Property Type
BehaviorComponent |
Camera
Gets the camera component
public CameraComponent Camera { get; }
Property Type
CameraComponent |
Capabilities
Gets the capabilities support by Vector's current firmware
public Capabilities Capabilities { get; }
Property Type
Capabilities |
CarryingObjectId
Gets the ID of the object currently being carried (-1 if none)
public int CarryingObjectId { get; }
Property Type
Int32 |
Control
Gets the control component
public ControlComponent Control { get; }
Property Type
ControlComponent |
Events
Gets the events component
public EventComponent Events { get; }
Property Type
EventComponent |
Faces
Gets the face component
public FaceComponent Faces { get; }
Property Type
FaceComponent |
FirmwareVersion
Gets the firmware version. Populated when connected
public Version FirmwareVersion { get; }
Property Type
Version |
Gyro
Gets the current gyroscope reading (x, y, z)
public AngularVelocity Gyro { get; }
Property Type
AngularVelocity |
HeadAngleRad
Gets Vector's head angle (up/down) in radians
public float HeadAngleRad { get; }
Property Type
Single |
HeadTrackingObjectId
Gets the ID of the object the head is tracking to (-1 if none)
public int HeadTrackingObjectId { get; }
Property Type
Int32 |
IPAddress
Gets the current IP address of the robot. Can be null if remote Vector connection is used.
public IPAddress IPAddress { get; }
Property Type
IPAddress |
IsConnected
Gets a value indicating whether the robot is connected.
public bool IsConnected { get; }
Property Type
Boolean |
LastImageTimestamp
Gets the robot's timestamp for the last image seen.
public uint LastImageTimestamp { get; }
Property Type
UInt32 |
LeftWheelSpeedMmps
Gets Vector’s left wheel speed in mm/sec
public float LeftWheelSpeedMmps { get; }
Property Type
Single |
LiftHeightMm
Gets the height of Vector’s lift from the ground.
public float LiftHeightMm { get; }
Property Type
Single |
LocalizedToObjectId
Gets the ID of the object that the robot is localized to (-1 if none)
public int LocalizedToObjectId { get; }
Property Type
Int32 |
Motors
Gets the motors component
public MotorComponent Motors { get; }
Property Type
MotorComponent |
NavMap
Gets the navmap component.
public NavMapComponent NavMap { get; }
Property Type
NavMapComponent |
Photos
Gets the photo component.
public PhotoComponent Photos { get; }
Property Type
PhotoComponent |
Pose
Gets the current pose (position and orientation) of Vector.
public Pose Pose { get; }
Property Type
Pose |
PoseAngleRad
Gets Vector's pose angle (heading in X-Y plane) in radians
public float PoseAngleRad { get; }
Property Type
Single |
PosePitchRad
Gets Vector’s pose pitch (angle up/down) in radians
public float PosePitchRad { get; }
Property Type
Single |
Proximity
Gets the proximity sensor data.
public ProximitySensorData Proximity { get; }
Property Type
ProximitySensorData |
RightWheelSpeedMmps
Gets Vector's right wheel speed in mm/sec
public float RightWheelSpeedMmps { get; }
Property Type
Single |
Screen
Gets the screen component.
public ScreenComponent Screen { get; }
Property Type
ScreenComponent |
Status
Gets the various status properties of the robot.
public RobotStatus Status { get; }
Property Type
RobotStatus |
Touch
Gets state related to touch detection.
public TouchSensorData Touch { get; }
Property Type
TouchSensorData |
Vision
Gets the vision component.
public VisionComponent Vision { get; }
Property Type
VisionComponent |
World
Gets the world component.
public WorldComponent World { get; }
Property Type
WorldComponent |
Methods
| Improve this Doc View SourceCheckCloudConnection()
Checks the cloud connection to Vector
public Task<CloudConnection> CheckCloudConnection()
Returns
Type | Description |
---|---|
Task<CloudConnection> | A task that represents the asynchronous operation; the task result contains the cloud connection information. |
CheckUpdateStatus()
Check if the robot is ready to reboot and update.
public Task<CheckUpdateStatus> CheckUpdateStatus()
Returns
Type | Description |
---|---|
Task<CheckUpdateStatus> | A task that represents the asynchronous operation; the task result contains the update status. |
Connect(IRobotConfiguration, Int32, Boolean)
Connect to Vector on the local network. This will attempt to connect using the configured IP address (if provided) otherwise it will trigger an mDNS query to find Vector's IP address. For connections to Vector over the Internet, use the RemoteConnect(IRemoteRobotConfiguration, Int32) method instead.
public Task Connect(IRobotConfiguration robotConfiguration, int timeout = 5000, bool useZeroConfig = true)
Parameters
Type | Name | Description |
---|---|---|
IRobotConfiguration | robotConfiguration | The robot configuration. |
Int32 | timeout | Timeout in milliseconds |
Boolean | useZeroConfig | if set to |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | robotConfiguration |
VectorNotFoundException | Unable to establish a connection to Vector. |
VectorInvalidVersionException | Your SDK version is not compatible with Vector’s version. |
Disconnect()
Disconnects from the Robot
public Task Disconnect()
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
|
GetFeatureFlag(String)
Request the current setting of a feature flag.
public Task<bool> GetFeatureFlag(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the feature to retrieve information about |
Returns
Type | Description |
---|---|
Task<Boolean> | A task that represents the asynchronous operation; the task result contains the robot setting. |
GetFeatureFlagList()
Request the list of the current feature flags.
public Task<IReadOnlyList<string>> GetFeatureFlagList()
Returns
Type | Description |
---|---|
Task<IReadOnlyList<String>> | A task that represents the asynchronous operation; the task result contains the robot setting. |
Remarks
To see which flags are enabled, use the Get Feature Flag command.
GetLatestAttentionTransfer()
Requests information about the most recent attention transfer
public Task<LatestAttentionTransfer> GetLatestAttentionTransfer()
Returns
Type | Description |
---|---|
Task<LatestAttentionTransfer> | A task that represents the asynchronous operation; the task result contains the latest attention transfer. |
NewConnection(IRobotConfiguration, Int32)
Connects to Vector and returns a robot instance.
public static Task<Robot> NewConnection(IRobotConfiguration robotConfiguration, int timeout = 5000)
Parameters
Type | Name | Description |
---|---|---|
IRobotConfiguration | robotConfiguration | The robot configuration. |
Int32 | timeout | The connection timeout in milliseconds. |
Returns
Type | Description |
---|---|
Task<Robot> | A task that represents the asynchronous operation; the task result contains the connected robot instance |
NewConnection(Int32)
Connects to Vector using the first robot found in the configuration file and returns a robot instance.
public static Task<Robot> NewConnection(int timeout = 5000)
Parameters
Type | Name | Description |
---|---|---|
Int32 | timeout | The timeout. |
Returns
Type | Description |
---|---|
Task<Robot> | A task that represents the asynchronous operation. The task result contains the connected robot instance. |
Exceptions
Type | Condition |
---|---|
VectorConfigurationException | No Robot Configuration found; please run the configuration tool to setup the robot connection. |
NewConnection(String, Int32)
Connects to Vector using the robot configuration that matches the name or serial number provided and returns a robot instance.
public static Task<Robot> NewConnection(string nameOrSerialNumber, int timeout = 5000)
Parameters
Type | Name | Description |
---|---|---|
String | nameOrSerialNumber | The name or serial number. |
Int32 | timeout | The timeout. |
Returns
Type | Description |
---|---|
Task<Robot> | A task that represents the asynchronous operation. The task result contains the connected robot instance. |
Exceptions
Type | Condition |
---|---|
VectorConfigurationException | No Robot Configuration with the name or serial number matching '{nameOrSerialNumber}' found. |
ReadBatteryState()
Reads the state of the battery from the robot.
public Task<BatteryState> ReadBatteryState()
Returns
Type | Description |
---|---|
Task<BatteryState> | A task that represents the asynchronous operation; the task result contains the battery state. |
ReadRobotLifetimeStats()
Gets the robot lifetime stats.
public Task<RobotLifetimeStats> ReadRobotLifetimeStats()
Returns
Type | Description |
---|---|
Task<RobotLifetimeStats> | A task that represents the asynchronous operation; the task result contains the robot lifetime stats. |
ReadRobotSettings()
Gets the settings from the robot.
public Task<RobotSettings> ReadRobotSettings()
Returns
Type | Description |
---|---|
Task<RobotSettings> | A task that represents the asynchronous operation; the task result contains the robot setting. |
ReadVersionState()
Reads the the versioning information for Vector, including Vector’s OS version and engine build id.
public Task<VersionState> ReadVersionState()
Returns
Type | Description |
---|---|
Task<VersionState> | A task that represents the asynchronous operation; The task result contains robot version information. |
RemoteConnect(IRemoteRobotConfiguration, Int32)
Connects to the robot using the remote connection information. This is used for connecting to Vector when he's not on the LAN. This requires port forwarding on your router to setup an external connection to Vector. For connecting to Vector on the same network as this application, use the Connect(IRobotConfiguration, Int32, Boolean) method instead.
public Task RemoteConnect(IRemoteRobotConfiguration robotConfiguration, int timeout = 5000)
Parameters
Type | Name | Description |
---|---|---|
IRemoteRobotConfiguration | robotConfiguration | The remote robot configuration. |
Int32 | timeout | The timeout. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | robotConfiguration |
VectorConfigurationException | Remote host not specified for remote connection. |
StartUpdateEngine()
Cycles the update-engine service (to start a new check for an update) and sets up a stream of CheckUpdateStatusEventArgs Events.
public Task<CheckUpdateStatus> StartUpdateEngine()
Returns
Type | Description |
---|---|
Task<CheckUpdateStatus> | A task that represents the asynchronous operation; the task result contains the update status. |
UpdateAndRestart()
Updates and restart the robot.
public Task<StatusCode> UpdateAndRestart()
Returns
Type | Description |
---|---|
Task<StatusCode> | A task that represents the asynchronous operation; the task result contains the result from the robot. |
UpdateRobotSettings(RobotSettings)
Updates the robot settings.
public Task<RobotSettings> UpdateRobotSettings(RobotSettings settings)
Parameters
Type | Name | Description |
---|---|---|
RobotSettings | settings | The settings to update. |
Returns
Type | Description |
---|---|
Task<RobotSettings> | A task that represents the asynchronous operation; the task result contains the updated settings. |
Events
| Improve this Doc View SourceConnected
Occurs when the robot is fully connected.
public event EventHandler<ConnectedEventArgs> Connected
Event Type
EventHandler<ConnectedEventArgs> |
Delocalized
Occurs when robot is delocalized (i.e. whenever Vector no longer knows where he is - e.g.when he's picked up).
public event EventHandler<DelocalizedEventArgs> Delocalized
Event Type
EventHandler<DelocalizedEventArgs> |
Disconnected
Occurs when robot is disconnected.
public event EventHandler<DisconnectedEventArgs> Disconnected
Event Type
EventHandler<DisconnectedEventArgs> |
Error
Occurs when there is a background exception.
public event EventHandler<ErrorEventArgs> Error
Event Type
EventHandler<ErrorEventArgs> |