Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(tutorial): add traffic light in planning simulation: (1) use AutowareStatePanel for engaging the vehicle (2) add traffic light simulation #129

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
.history/
*.code-workspace
*.vsix
site/
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ This section briefly explains how to run your vehicle with Autoware.

### Install Autoware

Follow the [installation steps of Autoware](https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/).
Follow the [installation steps of Autoware](https://autowarefoundation.github.io/autoware-documentation/main/installation/).

### Launch Autoware

Expand Down
2 changes: 1 addition & 1 deletion docs/installation/autoware/docker-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
### Installing dependencies manually

- [Install Docker Engine](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/docker_engine#manual-installation)
- [Install Docker Compose](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/docker_compose#manual-installation)
- [Install Docker Compose](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/docker_engine#manual-installation)
- [Install NVIDIA Container Toolkit](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/nvidia_docker#manual-installation)
- [Install rocker](https://github.com/autowarefoundation/autoware/tree/main/ansible/roles/rocker#manual-installation)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 52 additions & 28 deletions docs/tutorials/ad-hoc-simulation/planning-simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,77 @@

## How to run a planning simulation

1. Launch Autoware.
### Launch Autoware

```sh
source ~/autoware/install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/Downloads/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
```
```sh
source ~/autoware/install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/Downloads/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
```

Note that you cannot use `~` instead of `$HOME` here.
Note that you cannot use `~` instead of `$HOME` here.

![after-autoware-launch](images/planning/lane-following/after-autoware-launch.png)
![after-autoware-launch](images/planning/lane-following/after-autoware-launch.png)

2. Set an initial pose for the ego vehicle.
### Open Autoware State Panel
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Open Autoware State Panel
### Add Autoware State Panel


- a) Click the `2D Pose estimate` button in the toolbar, or hit the `P` key
- b) In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the initial pose.
This panel is useful when we start planning simulation. Click `Panels -> Add new panel`, select `AutowareStatePanel`, and then press `OK`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This panel is useful when we start planning simulation. Click `Panels -> Add new panel`, select `AutowareStatePanel`, and then press `OK`.
This panel is useful when running planning simulations. To add the panel, click `Panels -> Add new panel`, select `AutowareStatePanel`, and then click `OK`.


![set-initial-pose](images/planning/lane-following/set-initial-pose.png)
![after-autoware-launch](images/planning/lane-following/open-autoware-state-panel.png)

3. Set a goal pose for the ego vehicle.
### Set an initial pose for the ego vehicle

- a) Click the `2D Nav Goal` button in the toolbar, or hit the `G` key
- b) In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the goal pose.
1. Click the `2D Pose estimate` button in the toolbar, or hit the `P` key.
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the initial pose. The car should be placed in the right direction according to the lane(you can check the arrow on the lane). Now you will see a car on the Rviz.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the initial pose direction is opposite to that of the lane. Will the vehicle still be displayed? If the vehicle is displayed, will path planning fail after the goal pose is (correctly) set?

Suggested change
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the initial pose. The car should be placed in the right direction according to the lane(you can check the arrow on the lane). Now you will see a car on the Rviz.
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the initial pose. An image representing the vehicle should now be displayed.
!!! warning
Remember to set the initial pose of the car in the same direction as the lane. To confirm the direction of the lane, check the arrowheads displayed on the map.


![set-goal-pose](images/planning/lane-following/set-goal-pose.png)
![set-initial-pose](images/planning/lane-following/set-initial-pose.png)

4. To place a dummy object such as a pedestrian, click the `2D Dummy Pedestrian` button in the toolbar.
### Set a goal pose for the ego vehicle

![set-dummy-pedestrian](images/planning/lane-following/set-dummy-pedestrian.png)
1. Click the `2D Nav Goal` button in the toolbar, or hit the `G` key
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the goal pose. Keep in mind to set the goal pose aligned with the lane direction. Otherwise the path will not be planned. Now you will see a planned path.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the warning about goal pose alignment to be a warning using the mkdocs admonition code block.

Suggested change
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the goal pose. Keep in mind to set the goal pose aligned with the lane direction. Otherwise the path will not be planned. Now you will see a planned path.
2. In the 3D View pane, click and hold the left-mouse button, and then drag to set the direction for the goal pose. If done correctly, you will see a planned path from initial pose to goal pose.
!!! warning
Remember to set the goal pose to be aligned with the lane direction, otherwise the path will not be planned!


5. Engage the ego vehicle.
![set-goal-pose](images/planning/lane-following/set-goal-pose.png)

```bash
source ~/autoware/install/setup.bash
ros2 topic pub /autoware/engage autoware_auto_vehicle_msgs/msg/Engage "engage: true" -1
```
### Place a dummy object

You can skip this step.

To place a dummy car/pedestrian, click the `2D Dummy Car` and/or `2D Dummy Pedestrian` button in the toolbar, and then set its pose by dragging on the map. You can set its velocity in `Tool Properties -> 2D Dummy Car/Pedestrian` panel. In the image the velocity is set to 0.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is simpler to mark the step as optional in the title. Thoughts or comments?
I also added some explanation about what zero velocity means for dummy objects.

Suggested change
### Place a dummy object
You can skip this step.
To place a dummy car/pedestrian, click the `2D Dummy Car` and/or `2D Dummy Pedestrian` button in the toolbar, and then set its pose by dragging on the map. You can set its velocity in `Tool Properties -> 2D Dummy Car/Pedestrian` panel. In the image the velocity is set to 0.
### Place a dummy object (optional)
To place a dummy car or pedestrian, click either the `2D Dummy Car` or the `2D Dummy Pedestrian` button in the toolbar, and then set its pose by dragging on the map. You can set the object's velocity in `Tool Properties -> 2D Dummy Car/Pedestrian` panel. In the image the velocity is set to 0 and so the dummy object will remain stationary.


![set-dummy-car](images/planning/lane-following/place-dummy-car.png)

To delete those objects, click the `Delete All Objects` button in the toolbar.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To delete those objects, click the `Delete All Objects` button in the toolbar.
To delete any dummy objects placed in the view, click the `Delete All Objects` button in the toolbar.


### Set traffic light

You can skip this step.

To simulate traffic light recognition, go to `Panels -> Add new panel`, select `TrafficLightPublishPanel`, and then press `OK`. Then in the panel you need to set the `ID` and color of the traffic light.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reasoning as above.

Suggested change
### Set traffic light
You can skip this step.
To simulate traffic light recognition, go to `Panels -> Add new panel`, select `TrafficLightPublishPanel`, and then press `OK`. Then in the panel you need to set the `ID` and color of the traffic light.
### Set traffic light (optional)
To simulate traffic light recognition, first go to `Panels -> Add new panel`, select `TrafficLightPublishPanel`, and then click `OK`. Then in the panel, input the id of the traffic light that you want to test, choose the color for the light and then click the `SET` button.


You can check the `ID` of the traffic light by searching for `traffic` tag in `lanelet2_map.osm`. In the image there is one traffic light whose `ID` is 34836 and its color is `SET` to `RED`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can check the `ID` of the traffic light by searching for `traffic` tag in `lanelet2_map.osm`. In the image there is one traffic light whose `ID` is 34836 and its color is `SET` to `RED`.
You can find the `ID` of the desired traffic light by searching for the `traffic` tag in the `lanelet2_map.osm` file. The image below shows a traffic light whose `ID` is 34836 and its color is set to `RED`.


![set-traffic-light](images/planning/lane-following/set-traffic-light.png)

By clicking `PUBLISH` button the traffic light status is sent to the simulator, and the planned path changes accordingly.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
By clicking `PUBLISH` button the traffic light status is sent to the simulator, and the planned path changes accordingly.
Finally, click the `PUBLISH` button to send the traffic light status to the simulator. Any planned path that goes past the selected traffic light will then change accordingly.


![send-traffic-light-color](images/planning/lane-following/send-traffic-light-color.png)

### Engage the ego vehicle

![start-driving](images/planning/lane-following/start-driving.png)
Now you can start driving by clicking `Engage` button in `AutowareStatePanel`. Or you can also manually `engage` the vehicle by running this command.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Now you can start driving by clicking `Engage` button in `AutowareStatePanel`. Or you can also manually `engage` the vehicle by running this command.
Now you can start the ego vehicle driving by clicking the `Engage` button in `AutowareStatePanel`. Alteratively, you can manually engage the vehicle by running the following command:


6. To delete objects, click the `Delete All Objects` button in the toolbar.
```bash
source ~/autoware/install/setup.bash
ros2 topic pub /autoware/engage autoware_auto_vehicle_msgs/msg/Engage "engage: true" -1
```

![delete-objects](images/planning/lane-following/delete-objects.png)
![start-driving](images/planning/lane-following/engage-and-start-planning.png)

7. After that, the vehicle will restart driving and reach the goal.
### Reset traffic light
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Reset traffic light
### Reset traffic light (optional)


![restart-driving](images/planning/lane-following/restart-driving.png)
You can reset the color of the traffic light and let the vehicle make a turn at the intersection.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can reset the color of the traffic light and let the vehicle make a turn at the intersection.
If you previously set a traffic light to `RED` or `AMBER`, you can reset the color of the traffic light to `GREEN` and let the ego vehicle make a turn at the intersection.


![reach-goal](images/planning/lane-following/reach-goal.png)
![after-traffic-light-color-update](images/planning/lane-following/after-traffic-light-color-update.png)

## How to simulate parking maneuvers

Expand Down