Class ControlComponent
Management of the control of Vector's behaviors.
When you connect to Vector with this SDK he will behave normally. Taking control of Vector will disable his internal behaviors (driving around autonomously, responding to voice commands, etc). You are required to take control of Vector in order to execute commands that move Vector or provide other output.
Call the RequestControl(Int32) method to request control of Vector and ReleaseControl() to release control. Unless you use priority level OverrideBehaviors Vector will regain control automatically if he senses an edge or runs low on battery. You can subscribe to the ControlGranted and ControlLost events to get feedback on when you have acquired or lost control.
Implements
Inherited Members
Namespace: Anki.Vector
Assembly: Anki.Vector.dll
Syntax
public class ControlComponent : Component, INotifyPropertyChanged
Properties
| Improve this Doc View SourceControlPriority
Gets the last requested control priority.
public ControlPriority ControlPriority { get; }
Property Type
ControlPriority |
HasControl
Gets a value indicating whether SDK has control over Vector
public bool HasControl { get; }
Property Type
Boolean |
MaintainBehaviorControl
Gets a value indicating whether SDK will attempt to acquire control automatically when a behavior method is called after losing control to higher priority behaviors such as returning home to charge a low battery.
public bool MaintainBehaviorControl { get; }
Property Type
Boolean |
Methods
| Improve this Doc View SourceReleaseControl()
Releases the control of Vector
public Task<bool> ReleaseControl()
Returns
Type | Description |
---|---|
Task<Boolean> | A task that represents the asynchronous operation. The task result indicated whether control was released. |
RequestControl(ControlPriority, Int32)
Requests the control.
public Task<bool> RequestControl(ControlPriority priority, int timeout = 10000)
Parameters
Type | Name | Description |
---|---|---|
ControlPriority | priority | The priority. |
Int32 | timeout | The timeout. |
Returns
Type | Description |
---|---|
Task<Boolean> | A task that represents the asynchronous operation. The task result indicated whether control was granted. |
Exceptions
Type | Condition |
---|---|
VectorControlTimeoutException | Surpassed control timeout |
RequestControl(Int32)
Requests the control of Vector.
public Task<bool> RequestControl(int timeout = 10000)
Parameters
Type | Name | Description |
---|---|---|
Int32 | timeout | The timeout in milliseconds. |
Returns
Type | Description |
---|---|
Task<Boolean> | A task that represents the asynchronous operation. The task result indicated whether control was granted. |
WaitForControlChange()
Waits for control to change.
The task will complete when control has changed and the result is true if SDK has control over Vector.
public Task<bool> WaitForControlChange()
Returns
Type | Description |
---|---|
Task<Boolean> | A task that represents the asynchronous operation; the task result contains whether not SDK has control. |
Events
| Improve this Doc View SourceControlGranted
Occurs when control of Vector is granted.
public event EventHandler<ControlGrantedEventArgs> ControlGranted
Event Type
EventHandler<ControlGrantedEventArgs> |
ControlLost
Occurs when control of Vector is lost.
public event EventHandler<ControlLostEventArgs> ControlLost
Event Type
EventHandler<ControlLostEventArgs> |