Drive a SCUTTLE Robot with a Bluetooth Gamepad

The purpose of this tutorial is to add a Bluetooth gamepad input controller to a SCUTTLE Robot. On completion of this tutorial you’ll be able to drive the SCUTTLE around like an RC car using the EasySMX ESM-9101 Wireless Controller.

Prerequisites

The following video demonstrates controlling a SCUTTLE Robot using a bluetooth gamepad:

Adding the controller to the SCUTTLE’s config

To add this controller to the robot’s config, from the Viam app (https://app.viam.com), click on our old friend, New COMPONENT.

  1. On the Create Component screen, enter "gamepad" as the component Name and select "input_controller" for the component Type.
  2. There are no Model options for input_controllers. Therefore, for Model, please manually enter, "gamepad," (without the quotes) then press Tab. The Viam app will retain your entry.
  3. Click New Component. The Viam app opens the Component Config panel for the gamepad.
  4. On the Component Config panel, leave Depends On set to empty.
  5. The Viam app does not add any JSON attributes to the input_controller configuration.

    Please add the following Attributes:

{
 "base": "scuttle",
 "input_controller": "gamepad"
}
Blank configuration json

The controller config adds the gamepad controller to your robot. However, it does not wire it up to any functionality. This requires a Service.

Adding a Service

To link the controller’s input to the base functionality, we need to add our first service. Services are the software packages that provide our robots with cool and powerful functionality.

  1. Click Create Service under services at the top of the Viam app (https://app.viam.com).
  2. Enter “Base Remote Control” for Component type. “Base Remote Control” is a service we provide for driving a rover with a gamepad.
  3. Enter scuttle_gamepad for the Service name.
Create service builder

After adding the Attributes, your config screen should appear similar to this:

Service configuration

Save the configuration and visit the control UI on the Viam app (https://app.viam.com).

You should see the panel for the Controller Service and its connection indicator. This is how your web UI will look. Note the green connection indicator:

Gamepad input UI

At this point, you should be able to move the SCUTTLE. If you are in the specific mode that allows you to use the Joystick (#7), it will change the values:

"X
0.0000
Y
0.0000"

If you are in the specific mode that allows you to use the D-Pad (#8), it will change the values:

"Hat0X
0.0000
Hat0Y
0.0000"

Testing these attributes tells you which mode you are in.

EasySMX ESM-9101 wireless controller information

Here is a diagram of the gamepad.

gamepad diagramgamepad legend

To change the in-use movement/direction control on the gamepad between the D-Pad and the Joystick, press and hold the Home button (#11) until it displays the lighted segment combination for the gamepad configuration you need. Each red color arrangement allows you to control the gamepad in the Viam app:

LED 1 and 3: Use the D-Pad
Led 1 and 3 are lit
LED 3 and 4: Use the D-Pad
Led 3 and 4 are lit
LED 1 and 2: Use the D-Pad
Led 1 and 2 are lit
LED 1 and 4: Use the Joystick
Led 1 and 4 are lit


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