Add the Viam Fragment to your Robot

To be able to drive your rover, you need to configure it. Viam provides a reusable fragment for Viam rovers.

Prerequisites

Add the Fragment

Navigate to your robot in the Viam app. On the Config tab, click on the Fragments subtab.

Fragments tab inside the Viam app

On the Fragments tab, you can see the available fragments to add. Find ViamRover202210b and click ADD to add the fragment to your robot configuration.

List of available fragments

After you add the fragment, the config on the right side shows the robot’s configuration with the new fragment. Click Save Config to save the new configuration.

Fragment configuration

The fragment adds the following components to your robot’s JSON configuration:

  • Board component, which is the Raspberry Pi.
    • Within the board component attributes, digital interrupts: “re” to pin “37” and “le” to pin “35” and I2Cs: name “default_i2c_bus” and bus “1”.
  • Right gpio motor.
    • Within the motor attributes, board: “local”, encoder: “Renc”, ticks per rotation: “996”.
    • Within the component pin assignment, type: In1/In2, A/In1: “16 GPIO 23”, B/In2: “18 GPIO 24”, PWM: “22 GPIO 25”.
    • Depends on local and Renc.
  • Left gpio motor.
    • Within the motor attributes, board: “local”, encoder: “Lenc”, ticks per rotation: “996”.
    • Within the component pin assignment, type: In1/In2, A/In1: “11 GPIO 17”, B/In2: “13 GPIO 27”, PWM: “15 GPIO 22”.
    • Depends on local and Lenc.
  • A wheeled Viam base with attributes:
    • Right Motors: right
    • Left Motors: left
    • Wheel circumference (mm): 217
    • Width (mm): 260
    • Spin slip factor: 1.76
    • Depends on: left, right, local.
  • A webcam camera with video_path: video0 and depends on: local.
  • Renc encoder with board: local, pins “i”: “re” and depends on: local.
  • Lenc encoder with board: local, pins “i”: “le” and depends on: local.
  • An accelerometer with the following configuration:
    • Model: “accel-adxl345”
    • Name: “accelerometer”
    • Type: “movement_sensor”
    • and attributes of “i2c_bus”: “default_i2c_bus”, “use_alternate_i2c_address”: false, and “board”: “local”.
    • Depends on: local.
  • A microphone, type: audio_input, with attributes “audio_path_pattern”: “3a” and “debug”: false.

See the components on the configuration page

Adding a fragment to your robot adds the configuration to your robot. The components and services included in the fragment will appear inside a read-only fragment section in the Components and Services subtabs.

Next Steps



Have questions, or want to meet other people working on robots? Join our Community Discord.