diff --git a/doc/source/usage/configure_keyboard_control.md b/doc/source/usage/configure_keyboard_control.md index 6d071b0..feab255 100644 --- a/doc/source/usage/configure_keyboard_control.md +++ b/doc/source/usage/configure_keyboard_control.md @@ -1,2 +1,82 @@ Configure keyboard control -======= \ No newline at end of file +========================== + +The keyboard control is a manual control method that allows you to control the robot using the keyboard. + +## Keyboard Control Configuration Parameters + +Please make sure the dependencies are installed before running the simulation with keyboard. The dependencies can be installed using the following command: + +```bash +pip install ir-sim[keyboard] +``` + +To start with the keyboard control, you can simply to specify the `control_mode` parameter in the `world` section as `keyboard`. The example of the keyboard control is shown below: + +```python +import irsim + +env = irsim.make() + +for i in range(1000): + + env.step() + env.render(0.05) + + if env.done(): + break + +env.end() +``` + +```yaml +world: + height: 50 + width: 50 + control_mode: 'keyboard' + obstacle_map: 'cave.png' + mdownsample: 2 + +robot: + - kinematics: {name: 'acker'} + shape: {name: 'rectangle', length: 4.6, width: 1.6, wheelbase: 3} + state: [5, 5, 0, 0] + goal: [40, 40, 0] + vel_max: [4, 1] + plot: + show_trail: True + traj_color: 'g' + show_trajectory: True + show_goal: False + + sensors: + - type: 'lidar2d' + range_min: 0 + range_max: 20 + angle_range: 3.14 + number: 100 + alpha: 0.4 +``` + +The demonstration controlled by the keyboard is shown below: + +```{image} gif/keyboard.gif +:alt: Select Parameters +:width: 400px +:align: center +``` + +## Keyboard Control Key Mapping + +| Key | Function | +|----------|---------------------------------| +| `w` | Forward | +| `s` | Back Forward | +| `a` | Turn Left | +| `d` | Turn Right | +| `q` | Decrease Linear Velocity | +| `e` | Increase Linear Velocity | +| `z` | Decrease Angular Velocity | +| `c` | Increase Angular Velocity | +| `alt+num`| Change Current Control Robot ID | +| `r` | Reset the Environment | diff --git a/doc/source/usage/gif/keyboard.gif b/doc/source/usage/gif/keyboard.gif new file mode 100644 index 0000000..6cb0768 Binary files /dev/null and b/doc/source/usage/gif/keyboard.gif differ