Configure a webgamepad
Configuring a webgamepad
input controller allows you to use a web-based gamepad as a device to communicate with your robot.
Note
You must use “WebGamepad” as the name
of the web gamepad controller. This restriction will be removed in the future.
Configuration
Use the following configuration for an input controller of model webgamepad
:

{
"components": [
{
"name": "WebGamepad",
"type": "input_controller",
"model": "webgamepad",
"attributes": {},
"depends_on": []
}
]
}
Usage
Connect your controller to your computer. Follow the instructions included with your gamepad to make this connection.
If you haven’t done so already, create a robot in the Viam app, and follow the instructions in the SETUP tab to start viam-server
on your computer and connect to the robot.
Then, click on the robot’s CONFIG tab and configure an input_controller
component of model webgamepad
and name WebGamepad
, as shown above.
Save the config.
Next, navigate to the CONTROL tab.
You should see a WebGamepad
drop-down menu.
Click on the drop-down menu to expand it.
Click Enable, and press a button on your controller.
Then, you should see the Controls on your input controller appear:

You should now be able to see the row of control inputs respond to your button presses and stick toggles.
For example, this is how the row of Controls appears after pressing the circle (west) button on the button pad of the connected PS4 controller:

Note
You have to press a button or move a stick on your gamepad for the browser to report the gamepad. For your security, the browser won’t report a gamepad until an input has been sent.
Troubleshooting
You can find additional assistance in the Troubleshooting section.
You can also ask questions in the Community Discord and we will be happy to help.