-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,82 @@ | ||
Configure keyboard control | ||
======= | ||
========================== | ||
|
||
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 | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.