Motion Service
The motion service enables your machine to plan and move itself or its components relative to itself, other machines, and the world. The motion service:
- Gathers the current positions of the machine’s components as defined with the frame system.
- Plans the necessary motions to move a component to a given destination while obeying any constraints you configure.
The motion service can:
- use motion planning algorithms locally on your machine to plan coordinated motion across many components.
- pass movement requests through to individual components which have implemented their own motion planning.
Configuration
You need to configure frames for your machine’s components with the frame system. This defines the spatial context within which the motion service operates.
The motion service itself is enabled on the machine by default, so you do not need to do any extra configuration in the Viam app to enable it.
API
The motion service API supports the following methods:
Method Name | Description |
---|---|
Move | The Move method is the primary way to move multiple components, or to move any object to any other location. |
MoveOnMap | Move a base component to a destination pose on a SLAM map. |
MoveOnGlobe | Move a base component to a destination GPS point, represented in geographic notation (latitude, longitude). |
GetPose | GetPose gets the location and orientation of a component within the frame system. |
StopPlan | Stop a base component being moved by an in progress MoveOnGlobe or MoveOnMap call. |
ListPlanStatuses | Returns the statuses of plans created by MoveOnGlobe or MoveOnMap calls that meet at least one of the following conditions since the motion service initialized: - the plan’s status is in progress - the plan’s status changed state within the last 24 hours All repeated fields are in chronological order. |
GetPlan | By default, returns the plan history of the most recent MoveOnGlobe or MoveOnMap call to move a base component. |
Reconfigure | Reconfigure this resource. |
FromRobot | Get the resource from the provided robot with the given name. |
DoCommand | Execute model-specific commands that are not otherwise defined by the service API. |
GetResourceName | Get the ResourceName for this instance of the motion service with the given name. |
Close | Safely shut down the resource and prevent further use. |
Test the motion service
You can test motion on your machine from the CONTROL tab.
Enter x and y coordinates to move your machine to, then click the Move button to issue a MoveOnMap()
request.
Info
The plan_deviation_m
for MoveOnMap()
on calls issued from the CONTROL tab is 0.5 m.
Next steps
The following tutorials contain complete example code for interacting with a robot arm through the arm component API, and with the motion service API, respectively:
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!