SCUTTLE is a great open-hardware robot designed to be flexible, extensible, durable and affordable. It is an awesome robot to use whether your goal is to learn more about robotics and to support any number of cool projects. The original SCUTTLE design was iterated upon to require ZERO fabrication and to be sourced from parts available world-wide at low cost. All of the documentation to build your own Scuttle can be found at scuttlerobot.org.
To make any robot function, however, requires software. In this project, we are going to show how to set up a Scuttle robot with Viam, the modern robotics platform, in order to be able to control and manage your robot.
Install Viam on A Raspberry PiFirst install Viam on a Raspberry Pi in order to get started. Check out this Viam Tutorial for a step by step walkthrough.
Begin Configuring Your RobotGo to app.viam.com on your web browser, and select the robot's config.
The first component you will add is the `board`, which represents your Single Board Computer, the Raspberry Pi, into which we are wiring all other components. To create a new component, select `CREATE A COMPONENT`. For component `Type`, select `board`. Then you can name the `board` whatever you like as long as you are consistent when referring to it later; we'll name this component `local` since it is the `board` we will communicate with directly. For `Model`, select `pi`, then click the new component button. Your board component’s config will generate the following JSON attributes:
Next, add one of the `motor` controllers, and see if you can make the wheel spin. As with all other components, the first step is to select `CREATE A COMPONENT`. Start with the right wheel, and name the component `right`. For the `Type` select `motor`, for the `Model` select `gpio`, and then click the new component button. This will give you empty attributes for pins and the board:
Here, we'll need to tell Viam how this motor is wired up to the Pi. First, select the `Depends On` as `local` since that is what this motor is wired to. For the SCUTTLE robot, the following `pins` should be correct: `a` to `16`, `b` to `15`. You should leave the `dir` and `pwm` (pulse-width modulation) pins blank, because of this specific motor driver’s configuration. For the `board` you should put `local`. Then you have to add your additional attributes. After board, add “dir_flip” and set it to true. Then add “max_rpm” and set it to 100. The code on the attributes section should look like this:
Having entered a board and a motor component, you should now be able to actuate your motor. Save the config by clicking `SAVE CONFIG` at the bottom of the page and click `CONTROL` at the top of the page to navigate to the Control Page. There, you should see a panel for the right `motor`: you can use this panel to set the motor's `power` level.
Please be careful when activating your robot! Start with the power level (RPM) set to 10% and increase it incrementally (about 10% each time), activating the motor at each step until the wheels are rotating at a reasonable rate when you press run. You can also change the direction of the rotation.
Ensure the rover has sufficient space to drive around without hitting anyone or anything. Consider possibly holding your robot off the ground so it cannot run away or collide with anything unexpected.
At this point, the wheel on one side of your robot should be working through app.viam.com. Now try to add the other set of wheels and see if you can get this bot driving in a coordinated manner. To do this, we’ll have to add the other `motor` controller and link them together with a `base`.
To do this, you’ll once again select `CREATE A COMPONENT`. The config attributes for this `motor` controller will be very similar to the `right` set of the motor component you have already configured, which makes sense as the hardware is the same and it is connected to the same `board`. Some of the differences will be the `Name` which will be `left` and the pins it's connected to, which should be set as follows: `a` to `12`, `b` to `11`. You also do not need the “dir_flip” command for this set of motors.
Configuring the BaseUnite these wheelsets with a `base` component, which is used to describe the physical structure onto which your components are mounted. Configuring a `base` component will give you a nice UI for moving the rover around.
Start by selecting `CREATE A COMPONENT`. Name the component `scuttle`. For the `Type` select `base`, for the `Model` select `wheeled`. After you create the component, in the `Depends On` section, select `local`, “left`, and `right` since these are the components that comprise our `base`. In your attributes section, for `width_mm` you will use `400` (measured between the midpoints of the wheels) and for `wheel_circumference_mm` you will use `250`. The `left` and `right` attributes are intended to be the motors corresponding to the left and right sides of the rover. You can simply add “left” and “right” between the brackets for your set of motors respectively.
When you save the config and switch to the control view, you should have new buttons for the `base` functionality. In the keyboard tab, you can toggle your keyboard control to active, and then you can use W and S to go back and forth, and A and D to arc and spin. If you click the discrete tab, you will be able to see different movement modes just as `Straight` and `Spin`; and different movement types such as `Continuous` and `Discrete`, and directions `Forwards` and `Backwards`. Try playing around with these and get a sense of what they do.
Now you have a rover that you can drive via Viam’s WebUI.
Configuring the Camera ComponentAdd the `camera` on it. Once again, click `CREATE A COMPONENT`. Name this camera `camera`. For the `Type` select `camera`, and for `Model` select `webcam`. Then click on the new component button. For `Depends On` select `local`, and set the “path_pattern” attribute to the Linux path by typing “video0”.
If you save the config and click on your WebUI, you will be able to see your camera streaming.
Base view:
Camera component view:
After successfully completing this tutorial, you should have a fully functional Scuttle rover which you can drive around and see the rover's perspective via Viam’s app. Play around with it and try some creative ideas on how you can use the camera with your rover. If you’d like, you can check out how to use Color Detection on a Scuttleor you can come up with your own camera-related tutorials. You can also check out How to Control a Scuttle with a Bluetooth Gamepadto learn more about different configurations possible with the Scuttle rover.
Next StepsIn this project, we showed you how to set a Scuttle robot with a camera on Viam.
If you have any issues or if you want to connect with other engineers learning how to build robots with Viam, be sure that you head over to the Discord (https://discord.gg/viam).
If you want to see more robotics tutorials and projects that use Viam, visit Viam’s documentation hub.
Comments