Configure a Wheeled Odometry Movement Sensor
Configure a wheeled-odometry
movement sensor to implement wheeled odometry on your machine.
Wheeled odometry is the estimation of the rate of change of position, orientation, linear velocity, and angular velocity using the dimensions of a base, calculated by measuring the movement of the motors through encoders.
Because of this method of estimation, you don’t have to have a specific piece of movement sensor hardware to implement wheeled-odometry
on your machine.
This model uses encoders from position reporting motors to get an odometry estimate of a wheeled base as it moves.
With a configured wheeled-odometry
movement sensor, your machine calculates an estimation of the position, orientation, linear velocity, and angular velocity of the wheeled base each time time_interval_msec
elapses during a session.
You can access these readings through the movement sensor API.
For the best accuracy with odometry calculations, it is recommended you configure a time interval of less than 1000
milliseconds.
After configuring a wheeled-odometry
movement sensor, you can operate your base with Viam’s built-in services like the navigation service.
Set-up requirements
To prepare your machine, attach encoders to each of the position-reporting motors on your base to measure their rotation.
- Select motors that can report their own position, like
gpio
motors with encoders, or theodrive
module. You can access this property of a configured motor through the motor API’sGetProperties()
. - Configure your rover as a wheeled base component.
Make sure to configure the base width and circumference, as these measurements as a property of the base are vital for accurate odometry estimations by your movement sensor.
This movement sensor accesses these values through the base’s
GetProperties()
API method. - Configure each of the position-reporting motors as motor components.
- Then, proceed to configure a
wheeled-odometry
movement sensor with the name of each of the motor components.
Configuration
Navigate to the CONFIGURE tab of your machine’s page in the Viam app.
Click the + icon next to your machine part in the left-hand menu and select Component.
Select the movement-sensor
type, then select the wheeled-odometry
model.
Enter a name or use the suggested name for your movement sensor and click Create.
Fill in the attributes as applicable to your movement sensor, according to the table below.
{
"components": [
{
"name": "<your-wheeledodometry-movement-sensor-name>",
"model": "wheeled-odometry",
"type": "movement_sensor",
"namespace": "rdk",
"attributes": {
"base": "<your-base-name>",
"left_motors": ["<your-base-left-motor-name-1>", "<your-base-left-motor-name-2>"],
"right_motors": ["<your-base-right-motor-name-1", "your-base-right-motor-name-2>"],
"time-interval-msec": <number>
}
}
]
}
{
"components": [
{
"name": "my-wheeled-odometer",
"model": "wheeled-odometry",
"type": "movement_sensor",
"namespace": "rdk",
"attributes": {
"base": "my_wheeled_base",
"left_motors": ["leftm1", "leftm2"],
"right_motors": ["rightm1", "rightm2"]
}
}
]
}
Attributes
The following attributes are available for wheeled-odometry
movement sensors:
Name | Type | Required? | Description |
---|---|---|---|
base | string | Required | The name of the base to which the encoders making up this movement sensor are wired. |
left_motors | object | Required | A list containing the name of each of the bases’ left position-reporting motors. |
right_motors | object | Required | A list containing the name of each of the bases’ right position-reporting motors. |
time_interval_msec | float | Optional | The time in milliseconds between each wheeled odometry calculation. Default: 500.0 |
Test the movement sensor
After you configure your movement sensor, navigate to the Control tab and select the dedicated movement sensor dropdown panel. This panel presents the data collected by the movement sensor.
Troubleshooting
If your movement sensor is not working as expected, follow these steps:
- Check your machine logs on the LOGS tab to check for errors.
- Review this movement sensor model’s documentation to ensure you have configured all required attributes.
- Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the movement sensor 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 more configuration and usage info, see:
Have questions, or want to meet other people working on robots? Join our Community Discord.
If you notice any issues with the documentation, feel free to file an issue or edit this file.
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!