You can customize gamepad button and axis mappings using a JSON configuration file. This can be done via the CLI when running teleoperation tests or when initializing the environment in code.
Via CLI:
python examples/test_teleoperation.py --controller-config path/to/controller_config.json
Via Python API:
env = gym.make(
"gym_hil/PandaPickCubeGamepad-v0",
controller_config_path="path/to/controller_config.json",
)
JSON Configuration Schema:
The configuration file maps controller inputs to logical actions. If no path is provided, the package uses its bundled controller_config.json.
{
"default": {
"axes": {
"left_x": 0,
"left_y": 1,
"right_x": 2,
"right_y": 3
},
"buttons": {
"a": 1,
"b": 2,
"x": 0,
"y": 3,
"lb": 4,
"rb": 5,
"lt": 6,
"rt": 7
},
"axis_inversion": {
"left_x": false,
"left_y": true,
"right_x": false,
"right_y": true
}
},
"Xbox 360 Controller": {
...
}
}
python examples/test_teleoperation.py --controller-config path/to/controller_config.json