Base Component

Explanation of base configuration, and usage in Viam.

Most robots with wheeled bases will comprise at least the following:

  • A board component that can run a viam-server instance. That is to say, a computing device with general purpose input/output (GPIO) pins such as a Raspberry Pi or other single-board computer with GPIO.

  • Two or more motors with wheels attached

  • A power supply for the board

  • A power supply for the motors

  • Some sort of chassis to hold everything together

For example:

A robot comprised of a base (motors, wheels and chassis) as well as some other components. The wheels are highlighted to indicate that they are part of the concept of a 'base', while the non-base components are not highlighted. There are width and diameter labels on the diagram because width and circumference (pi times diameter) are required attributes when configuring a base component.

An example of a wiring diagram for a base that has one motor on each side is shown below. Note that this will vary greatly depending on choice of motors, motor drivers, power supply, and board.

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

Configuration

Configuring a base involves configuring the drive motors and ensuring the base attributes section contains the names of all motors that move the base right or left, respectively. Configure each motor according to its type. You can find more information on wiring and configuring different types of motors in the motor topic. The board controlling the base must also be configured.

An example configuration file, including the board, motors, and base:

{
  "components": [
    {
      "attributes": {},
      "model": "pi",
      "name": "follow-pi",
      "type": "board"
    },
    {
      "attributes": {
        "board": "follow-pi",
        "max_rpm": 300,
        "pins": {
          "dir": "16",
          "pwm": "15"
        }
      },
      "model": "gpio",
      "name": "rightm",
      "type": "motor"
    },
    {
      "attributes": {
        "board": "follow-pi",
        "max_rpm": 300,
        "pins": {
          "dir": "13",
          "pwm": "11"
        }
      },
      "model": "gpio",
      "name": "leftm",
      "type": "motor"
    },
    {
      "attributes": {
        "left": [
          "leftm"
        ],
        "right": [
          "rightm"
        ],
        "wheel_circumference_mm": 183,
        "width_mm": 195
      },
      "model": "wheeled",
      "name": "tread-base",
      "type": "base"
    }
  ]
}

An image of the JSON configuration file with annotations explaining some of the attributes.

Required Attributes

NameTypeDescription
typestringUse "base" for any base component
modelstringSelect "wheeled" unless you have a "boat".
namestringName your base.
leftstringList with the names of all drive motors on the left side of the base. There may be one or more motors.
rightarray of stringsList with the names of all drive motors on the right side of the base. There may be one or more motors.
wheel_circumference_mmintThe outermost circumference (not diameter!) of the drive wheels in millimeters. Used for odometry, so try to enter your best approximation of the effective circumference.
width_mmintWidth of the base in millimeters. In other words, the distance between the approximate centers of the right and left wheels.

Optional Attributes

spin_slip_factor (float): Used in steering calculations to correct for slippage between the wheels and the floor. To be calibrated by the user.

Implementation

Python SDK Documentation