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.
Tip
A fragment is a reusable configuration block representing a common hardware pattern. Using a fragment makes managing a fleet of multiple robots configured in the same way easy.
Prerequisites
- An assembled Viam Rover with a Raspberry Pi. For assembly instructions, see Unbox and Set Up your Viam Rover
- The Pi is able to connect to the Viam app. To add your Pi to the Viam app, refer to the rover setup guide.
Add the Fragment
Navigate to your robot in the Viam app. On the Config tab, click on the Fragments subtab.
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.
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.
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.
Note
This particular motor driver has pins labeled “ENA” and “ENB.” Typically, this would suggest that they should be configured as enable pins, but on this specific driver these function as PWM pins, so we configure them as such.
- 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.
Was this page helpful?
Glad to hear it! If there is anything we could be doing better, please create an issue.
We're sorry about that. If you'd like to talk to us for help, please join the Community Discord. To ensure we know what's wrong with this page, you can also open an issue.