Base Component
The base component provides an API for moving all configured components attached to a mobile robot platform as a whole without needing to send commands to individual components.
If you have a mobile robot, use a base component to coordinate the motion of its motor components.
Configuration
Most mobile robots with a base use the following hardware:
- A board
- Some actuators to move the base, such as motors attached to wheels or propellers
- Some sort of chassis to hold everything together.
To use a rover or other base, you need to add each component as well as the base to your machine’s configuration. Go to your machine’s CONFIGURE page, and add a model that supports your base.
The following list shows the available base models. For additional configuration information, click on the model name:
Add support for other models
If none of the existing models fit your use case, you can create a modular resource to add support for it.
Model | Description |
---|---|
two_wheeled_base | Mobile robot with two wheels |
Add support for other models
If none of the existing models fit your use case, you can create a modular resource to add support for it.
viam-micro-server
works differently from the RDK, so creating modular resources for it is different.
Refer to the Micro-RDK Module Template on GitHub for information on how to create custom resources for your viam-micro-server
machine.
You will need to recompile and flash your ESP32 yourself instead of using Viam’s prebuilt binary and installer.
API
The base API supports the following methods:
Method Name | Description | viam-micro-server Support |
---|---|---|
MoveStraight | Move the base in a straight line across the given distance (mm) at the given velocity (mm/sec). | |
Spin | Turn the base in place, rotating it to the given angle (degrees) at the given angular velocity (degrees/sec). | |
SetPower | Set the linear and angular power of the base, represented as a percentage of max power for each direction in the range of [-1.0 to 1.0]. | |
SetVelocity | Set the linear velocity (mm/sec) and angular velocity (degrees/sec) of the base. | |
GetProperties | Get the width and turning radius of the model of base in meters. | |
IsMoving | Returns whether the base is actively moving (or attempting to move) under its own power. | |
Stop | Stop the base from moving immediately. | |
GetGeometries | Get all the geometries associated with the base in its current configuration, in the frame of the base. | |
Reconfigure | Reconfigure this resource. | |
DoCommand | Execute model-specific commands that are not otherwise defined by the component API. | |
GetResourceName | Get the ResourceName for this base with the given name. | |
Close | Safely shut down the resource and prevent further use. |
Troubleshooting
If your base is not working as expected, follow these steps:
- Check your machine logs on the LOGS tab to check for errors.
- Review your base model’s documentation to ensure you have configured all required attributes.
- Review your configuration for any motors that are components of the base. Check that the names of the motor components match the list of motors you configured on the base.
- If a motor is spinning in an unexpected direction, try using the
dir_flip
attribute in its config, or try swapping the wires running to the motor to change its direction. - Check that all wires are securely attached to the correct pins.
- If you are using a battery to power the base, check that it is adequately charged. If the motors are drawing more power than the battery can supply, the single-board computer may be power cycling. Consider using a wall power supply for testing purposes to rule out this issue.
- Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the base there.
If none of these steps work, reach out to us on the Community Discord and we will be happy to help.
Next steps
For general configuration, development, and usage info, see:
You can also use the base component with the following services:
- Navigation service: to navigate with GPS
- SLAM service: for mapping
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!