【Apollo】Debugging and Simulation Practice

The Apollo EDU-Pre distribution is a lightweight distribution prepared for developers to learn and experiment with Apollo source code. It includes the deployment and usage scripts of Apollo Env Container (Apollo environment container), Apollo Core (Apollo core component package) ) and the edu-launch responsible for core functions.
This tutorial is built based on the learning version project

(1) Ubuntu Installation Guide for Apollo EDU-Pre Release

Prerequisite: Install Ubuntu Linux

The recommended version of Apollo is 18.04, and the author’s working environment is ubuntu20.04

Step 1: Download the Apollo EDU distribution

1.1 Download the EDU-Pre installation file
File address: Click to download
1.2 Start ubuntu and execute the script installation in the command line terminal. The execution instructions are as follows

bash apollo-edu-install.sh

Here I created a new apollo folder to facilitate the management of related files, copied the downloaded sh file to the apollo folder, and then executed the above command in the folder. After execution, the script will automatically download and decompress the Apollo EDU-Pre distribution.
Insert image description here

Step 2: Install and configure docker

If docker has been installed and configured on your computer, you can skip this step. If it is not installed and configured correctly, please run the following two steps:
2.1 Enter the script folder

cd apollo-edu/scripts

2.2 Execute the following command in this directory to configure docker

bash docker_install.sh

ps: Since installing docker requires sudo permissions, the following prompt will appear and you need to enter a password:
Insert image description here


During the installation
Insert image description here
use nvidia GPU computing, you also need to install nvidia-docker
Insert image description here
github link https:/ /github.com/NVIDIA/nvidia-dockerClick
the installation guide
Insert image description here
to install nvidia-docker, provided that the nvidia driver and docker have been installed

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2

Step 3: Start the environment container and enter

3.1 Execute the following command in the scripts directory to start the docker environment

bash edu_launcher.sh start

If everything is normal, you will see a prompt similar to the picture below: Enjoy!
Insert image description here
If nvidia-docker is installed, USE_GPU_HOST will appear
Insert image description here

3.2
After starting the environment, execute the following command in the scripts directory to enter the docker environment

bash edu_launcher.sh enter

After the script is successfully executed, the following information will be displayed, and you will enter Apollo's running container:

user_name@in-dev-docker:/apollo_workspace# 

Insert image description here

Step 4: Install Apollo core

Apollo core is the core component set of Apollo v8.0-pre, which now includes:

  • cyber module
  • common module
  • common_msg module
  • Apollo build-tool: The build tool for building Apollo v8.0-pre.
    In the apollo_workspace directory, execute the following command to install Apollo core:
bash scripts/apollo_neo.sh install_core

Insert image description here

(2) Use Dreamview to view data packets

Prerequisites

This document assumes that you have installed the Apollo EDU-Pre distribution according to the instructions and that the Apollo docker environment is running normally. If the Apollo docker environment has not been started, please execute the following command:

bash scripts/edu_launcher.sh start

Step 1: Enter the Apollo Docker environment

  1. Enter the following command to enter Apollo
bash scripts/edu_launcher.sh enter
  1. Execute the setup script. The operation of Apollo depends on certain environment variables. You need to manually execute the setup script.
source /opt/apollo/neo/setup.sh

This step will not have any output, just load it

Step 2: Install DreamView (if it is already installed, please ignore it)

In the same terminal, enter the following command to install Apollo's DreamView program.

sudo apt install apollo-neo-dreamview-dev && sudo apt install apollo-neo-monitor-dev

Step 3: Start DreamView

In the same terminal, enter the following command to start Apollo's DreamView program.

bash scripts/apollo_neo.sh bootstrap

Insert image description here
After running, there will be a prompt that DreamView is running at http://localhost:8888

Step 4: Download Apollo’s demo package

Record is a data format used by Apollo to record data.
Files with the .record suffix are what we call record packets.
In the command line, enter the following command to download the record data package:

wget https://apollo-system.cdn.bcebos.com/dataset/6.0_edu/demo_3.5.record

Step 5: Play Apollo’s demo package

cyber_recorder play -f demo_3.5.record --loop

Insert image description here
The option --loop is used to set loop playback mode.
After running, the following prompt will be output:
Insert image description here

Step 6: Use DreamView to view packets

Enter http://localhost:8888 in the browser, visit Apollo DreamView:
select Sunnyvale on the map, and the operation situation is as shown in the figure below:
Insert image description here

(3) Installation and simulation debugging of planning module

Step 1: Enter the Apollo Docker environment

  1. Enter the following command to enter the Apollo Docker environment
bash scripts/edu_launcher.sh enter

Step 2: Compile the planning source code package

bash scripts/edu_launcher.sh build planning

This command specifies that the build tool needs to import the planning source code and compile it. After compilation, enjoy!
Insert image description here

In addition to the planning module, modules such as dreamview, routing, task_manager and monitor are also introduced. You can enter the following command to view the details:

bash scripts/edu_launcher.sh build -h

*When calling the script compilation command, the current directory is the workspace directory. Please be sure to use the script compilation command in the workspace.
*Note:

  1. When calling the script compilation command, the current directory is the workspace directory. Please be sure to use the script compilation command in the workspace.
  2. If you are using Windows WSL2, you may encounter a compilation failure caused by the lack of the /run/shm folder during the compilation process. Simply create the file manually and then recompile.
    Apollo's compilation tool will automatically analyze all required dependencies, automatically download and generate necessary dependency information files. The first compilation requires pulling some dependency packages from the Internet, so it will take about 40 minutes depending on network speed and computer configuration. Please be patient. Wait for the compilation to complete. The compilation completion style is as shown in the figure:

After compilation, you need to manually refresh the environment variables:

source ~/.bashrc

Step 3: Debugging the planning

Run dreamview:

bash scripts/apollo_neo.sh bootstrap

*If you have already started dreamview, you can restart the dreamview process:

bash scripts/apollo_neo.sh bootstrap restart

At this time, dreamview and monitor will be automatically started. You can enter localhost:8888 in the browser to open dreamview:
Insert image description here

Step 4: Enter sim control simulation mode for debugging

(1) Select MKz Standard Debug in the upper menu bar > Select MkzExample for the vehicle model > Select Sunnyvale Big Loop for the map > Click Tasks > Select Sim Control to enter simulation control, as shown in the figure below:
Insert image description here

(2) Click the Module Control column on the left to start the module process that needs to be debugged. We select the Planning and Routing modules:

(3) Set the vehicle simulation driving path, click Routing Editing on the left, drag and click the mouse to set the vehicle driving path in the map, as shown in the figure below

(4) When the point setting is completed, click Send Routing Request. Waiting will appear as shown in the figure below. The red line is the path searched in the map by the routing module, and the light blue trajectory is the local path planned in real time by the planning module.
Insert image description here

(5) If you want to debug the planning module at this time, you can directly modify the planning source code in the workspace. The source code is located in the workspace: modules/planning
re-run the compilation script after modification:

bash scripts/edu_launcher.sh build planning

(6) Re-run the planning module in dreamview.

Guess you like

Origin blog.csdn.net/qq_34972053/article/details/127771964