Configure a SCUTTLE Robot

Requirements

Start configuring your robot

  1. Go to the Viam app.
  2. Create a robot and follow the setup instructions until the robot successfully connects to the Viam app.
  3. Navigate to the robot’s Config tab.

A SCUTTLE robot on a carpeted floor.

Configure the board

Add your first component, the board:

Click on the Components subtab and click Create component. Select the board type, then select the pi model. Enter local as the name for your board and click Create.

Click on Show more and add I2C with name main and bus 1.

The component configuration panel for a board component.

Add the following JSON object to the components array:

{
  "type": "board",
  "model": "pi",
  "name": "local",
  "attributes": {
    "i2cs": [
      {
        "bus": "1",
        "name": "main"
      }
    ]
  }
}

Configure the encoders

Next, configure the left and right encoders as follows:

Left encoder

Click Create component. Select the encoder type, then select the AMS-AS5048 model. Enter lenc as the name for your encoder and click Create.

Click the board dropdown list and select the name of your board, local.

In the i2c bus field type main, and in the i2c address field type 64.

Configuration of an AMS-AS5048 encoder in the Viam app config builder.

Right encoder

Click Create component. Select the encoder type, then select the AMS-AS5048 model. Enter renc as the name for your encoder and click Create.

Click the board dropdown list and select the name of your board, local.

In the i2c bus field type main, and in the i2c address field type 65.

Click Save config.

Add the following JSON objects to the components array:

{
    "name": "lenc",
    "model": "AMS-AS5048",
    "type": "encoder",
    "namespace": "rdk",
    "attributes": {
      "board": "local",
      "connection_type": "i2c",
      "i2c_attributes": {
        "i2c_bus": "main",
        "i2c_addr": 64
      }
    }
},
{
    "name": "renc",
    "model": "AMS-AS5048",
    "type": "encoder",
    "namespace": "rdk",
    "attributes": {
      "board": "local",
      "connection_type": "i2c",
      "i2c_attributes": {
        "i2c_bus": "main",
        "i2c_addr": 65
      }
    }
}

Configure the motors

The next step is to add the motors and make them spin the wheels.

Right motor

Click Create component. Select the motor type, then select the gpio model. Enter right as the name for your encoder and click Create.

Then from the Board dropdown, select local, the Raspberry Pi the motor is wired to.

Select Encoded in the Encoder section and select renc as the encoder and set ticks per rotation to 2.

Next, describe how the motor is wired to the Pi:

  1. Switch the Component Pin Assignment Type to In1/In2.
  2. Set A/In1 to 16.
  3. Set B/In2 to 15.
  4. Leave the pwm (pulse-width modulation) pin blank, because this specific motor driver’s configuration does not require a separate PWM pin.

The motor config panel.

Left motor

Click Create component. Select the motor type, then select the gpio model. Enter left as the name for your encoder and click Create.

Then select local from the Board dropdown to choose the Raspberry Pi the motor is wired to.

Select Encoded in the Encoder section and select lenc as the encoder and set ticks per rotation to 2.

Next, describe how the motor is wired to the Pi:

  1. Switch the Component Pin Assignment Type to In1/In2.
  2. Set A/In1 to 12.
  3. Set B/In2 to 11.
  4. Leave the pwm (pulse-width modulation) pin blank, because this specific motor driver’s configuration does not require a separate PWM pin.

Add the following JSON objects to the components array:

{
  "name": "right",
  "model": "gpio",
  "type": "motor",
  "namespace": "rdk",
  "attributes": {
    "pins": {
      "a": "16",
      "b": "15",
      "pwm": "",
      "dir": ""
    },
    "board": "local",
    "dir_flip": false,
    "ticks_per_rotation": 2
  },
  "depends_on": [ "local" ]
},
{
  "name": "left",
  "model": "gpio",
  "type": "motor",
  "namespace": "rdk",
  "attributes": {
    "pins": {
      "a": "12",
      "b": "11",
      "pwm": ""
    },
    "board": "local",
    "dir_flip": false,
    "ticks_per_rotation": 2
  },
  "depends_on": [ "local" ]
}

Save the config by clicking Save config at the bottom of the page.

Test the motor configuration

Now that you have configured your board, encoders, and motors, you can actuate your motors. Navigate to the Control tab.

You’ll see a panel for each configured component.

Motor panels

Click on the panel for the right motor.

Power level adjustment

Try changing the motor’s power level and click Run.

If your wheel turns in reverse when it should turn forward, add the dir_flip attribute to the motor’s configuration, by clicking Show more and setting the attribute to “true.”

Configure the base

Next, configure the base component, which describes the geometry of your chassis and wheels so that the software can calculate how to steer the rover in a coordinated way. Configuring a base component also provides you with a nice UI for moving the rover around.

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the base type, then select the wheeled model. Enter a name for your base and click Create.

An example configuration for a wheeled base.
  1. Select right as the Right Motor and left as the Left Motor.
  2. Enter 250 in Wheel Circumference (mm).
  3. Enter 400 in Width (mm) (measured between the midpoints of the wheels).
{
  "components": [
    {
      "attributes": {},
      "model": "pi",
      "name": "local",
      "type": "board"
    },
    {
      "attributes": {
        "board": "local",
        "pins": {
          "pwm": "",
          "a": "16",
          "b": "15"
        }
      },
      "model": "gpio",
      "name": "right",
      "type": "motor"
    },
    {
      "attributes": {
        "board": "local",
        "pins": {
          "pwm": "",
          "a": "12",
          "b": "11"
        }
      },
      "model": "gpio",
      "name": "left",
      "type": "motor"
    },
    {
      "attributes": {
        "left": ["left"],
        "right": ["right"],
        "wheel_circumference_mm": 250,
        "width_mm": 400
      },
      "model": "wheeled",
      "name": "your-wheeled-base",
      "type": "base"
    }
  ]
}

Save the config by clicking Save config at the bottom of the page.

Test the base

Now that you have configured the base you can try moving the SCUTTLE robot with your keyboard. Navigate to the Control tab.

Click on the panel for the base.

WASD controls

On the Keyboard tab, toggle the keyboard control to active. Use W and S to go forward and back, and A and D to arc and spin.

Try driving your SCUTTLE robot around using the WASD keyboard controls.

If you navigate to the Discrete tab, you can use movement modes such as Straight and Spin and different movement types such as Continuous and Discrete and directions such as Forwards and Backwards.

Discrete controls

Configure the camera

Finally, add a camera to your SCUTTLE robot.

Navigate to the Config tab of your robot’s page in the Viam app. Click on the Components subtab and click Create component. Select the camera type, then select the webcam model. Enter a name for your camera and click Create.

Configuration of a webcam camera in the Viam app config builder.

If you click on the Video Path field while your robot is live, a dropdown autopopulates with identified camera paths.

{
  "name": "Webcam",
  "model": "webcam",
  "type": "camera",
  "namespace": "rdk",
  "attributes": {
    "video_path": "video0"
  }
}

View the camera stream

Now that you have configured the base you can try moving the SCUTTLE robot with your keyboard. Navigate to the Control tab.

Click on the panel for the camera. Then toggle the camera view to ON.

If everything is configured correctly, you will see the live video feed from your camera. You can change the refresh frequency as needed to change bandwidth.

Example Camera view inside Viam app

Next steps

Now that you have fully configured your SCUTTLE robot, you can drive it around and view its camera stream.

To take things to the next level, check out one of the following tutorials:



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.