Configure a Wheeled Base

A wheeled base supports mobile robotic bases with motors on both sides (differential steering). To configure a wheeled base as a component of your machine, first configure the board controlling the base and any motors attached to the base.

Configure a wheeled base as follows:

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 base type, then select the wheeled model. Enter a name or use the suggested name for your base and click Create.

An example configuration for a wheeled base in the Viam app config builder, with Attributes & Depends On dropdowns and the option to add a frame.

Select the motors attached to the base as your right and left motors. Edit and fill in the attributes as applicable.

{
  "components": [
    {
      ... <INSERT YOUR BOARD COMPONENT CONFIGURATION>
    },
    {
      ... <INSERT YOUR LEFT MOTOR COMPONENT CONFIGURATION>
    },
    {
      ... <INSERT YOUR RIGHT MOTOR COMPONENT CONFIGURATION>
    },
    {
      "name": "<your-base-name>",
      "model": "wheeled",
      "type": "base",
      "namespace": "rdk",
      "attributes": {
        "left": [
          "<your-left-motor-name>" // <INSERT ANY ADDITIONAL LEFT MOTOR NAMES>
        ],
        "right": [
          "<your-right-motor-name>" // <INSERT ANY ADDITIONAL RIGHT MOTOR NAMES>
        ],
        "wheel_circumference_mm": <int>,
        "width_mm": <int>
      },
      "depends_on": []
    }
  ]
}
{
  "components": [
    {
      "name": "my-pi",
      "model": "pi",
      "type": "board",
      "namespace": "rdk",
      "attributes": {},
      "depends_on": []
    },
    {
      "name": "rightm",
      "model": "gpio",
      "type": "motor",
      "namespace": "rdk",
      "attributes": {
        "pins": {
          "dir": "16",
          "pwm": "15"
        },
        "board": "my-pi"
      },
      "depends_on": []
    },
    {
      "name": "leftm",
      "model": "gpio",
      "type": "motor",
      "namespace": "rdk",
      "attributes": {
        "pins": {
          "dir": "13",
          "pwm": "11"
        },
        "board": "my-pi"
      },
      "depends_on": []
    },
    {
      "name": "my-wheeled-base",
      "model": "wheeled",
      "type": "base",
      "namespace": "rdk",
      "attributes": {
        "width_mm": 195,
        "wheel_circumference_mm": 183,
        "left": ["leftm"],
        "right": ["rightm"]
      },
      "depends_on": []
    }
  ]
}
JSON configuration file for a wheeled base with annotations explaining some of the attributes.

The following attributes are available for wheeled bases:

NameTypeRequired?Description
leftarrayRequiredArray with the name of any drive motors on the left side of the base.
rightarrayRequiredArray with the name of any drive motors on the right side of the base.
wheel_circumference_mmintRequiredThe outermost circumference of the drive wheels in millimeters. Used for odometry. Can be an approximation.
width_mmintRequiredWidth of the base in millimeters. In other words, the distance between the approximate centers of the right and left wheels. Can be an approximation.
spin_slip_factorfloatOptionalCan be used in steering calculations to correct for slippage between the wheels and the floor. If used, calibrated by the user.

Wire a wheeled base

An example wiring diagram for a base with one motor on each side:

Wiring diagram showing a Raspberry Pi, motor drivers, motors, power supply, and voltage regulator for the rover

Note that your base’s wiring will vary depending on your choice of board, motors, motor drivers, and power supply.

Test the base

After you configure the base, open the base’s TEST panel on the CONFIGURE or CONTROL tabs to view the controls to enable keyboard or discrete control over your machine’s movement.

The base component in control tab

In the Quick move section, you can toggle the keyboard control to active. With the Keyboard toggle active, use W and S to go forward and back, and A and D to arc and spin.

Try driving your base around using the WASD keyboard controls.

You can also move straight or spin from the base panel.

If you do not see the base card in the TEST panel, check the LOGS tab for possible setup or configuration errors.

Next steps

For more configuration and development 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.