Configure a mux input controller
Configuring a mux
(multiplexed) input controller allows you to combine one or more controllers into a single virtual controller.
This lets you control a robot from different locations, such as the web and a locally connected gamepad, or use multiple controllers as one device.
For example, you could use a joystick alongside a numpad.
Configuration
To combine multiple controlers into a mux
controller, you must first configure each controller individually.
The following example configuration combines a gamepad
and a webgamepad
controller:
Navigate to the Config tab of your robot’s page in the Viam app.
Click on the Components subtab and click Create component.
Select the input_controller
type, then select the mux
model.
Enter a name for your input controller and click Create.
Edit and fill in the attributes as applicable.
{
"components": [
{
"name": "<your-mux-input-controller-name>",
"type": "input_controller",
"model": "mux",
"attributes": {
"sources": [
"<your-gamepad-input-controller-name",
"WebGamepad"
]
},
"depends_on": [
"<your-gamepad-input-controller-name>",
"WebGamepad"
]
},
{
"name": "<your-gamepad-input-controller-name>",
"type": "input_controller",
"model": "gamepad",
"attributes": {
"dev_file": "<your-filepath>",
"auto_reconnect": <boolean>
},
"depends_on": []
},
{
"name": "WebGamepad",
"type": "input_controller",
"model": "webgamepad",
"attributes": {},
"depends_on": []
}
]
}
The following attributes are available for mux
input controllers:
Name | Type | Inclusion | Description |
---|---|---|---|
sources | array | Required | The name of every controller component you wish to combine input from. |
Important
You must put each controller’s name
that you add in sources
in depends_on
.
This tells the program loading the config to fully load the source components first.
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.
Have questions, or want to meet other people working on robots? Join our Community Discord.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!