小马的世界

Install Autoware.Universe on Ubuntu 22.04

2023-10-20 · 6 min read
自动驾驶 英语English英語

⚠️Important Note⚠️: Please do not install ROS or Nvidia driver/CUDA software by yourself, these software will be installed automatically.

Prerequisites

Please make sure you have installed Ubuntu22.04, and make sure you have not installed any conflicting software (it is best not to actively install any software).
https://www.balena.io/etcher
https://ubuntu.com/download/desktop/thank-you?version=22.04.1&architecture=amd64

Adjust display settings

Setting -> Display -> Open the Fractional Scaling ->

Adjust Scale to 125%

Install basic prerequisites

sudo apt -y update
sudo apt -y upgrade
sudo apt -y install openssh-server git vim htop net-tools
sudo vim /etc/ssh/sshd_config

editPermitRootLogin yes

systemctl restart sshd
# for reboot OS
sudo reboot 

At this time, you can use ssh username@ip-address to remotely access this computer, which is convenient for subsequent multi-threaded installation.

Turn off auto-sleep

Setting -> Privacy -> Screen

Turn the Blank Screen Delay to Never

Turn off the Automatic Screen Lock

Turn off the Lock Screen on Suspend

How to set up a development environment

Clone autowarefoundation/autoware and move to the directory.

cd
git clone https://github.com/XRMobility/xrm-autoware.git autoware
cd autoware

Installing dependencies using Ansible

Be very careful with this method. Make sure you read and confirmed all the steps in the Ansible configuration before using it.

If you've manually installed the dependencies, you can skip this section.

./setup-dev-env.sh

How to set up a workspace

Create the src directory and clone repositories into it.

Autoware uses vcstool to construct workspaces.

cd
cd autoware
mkdir src
vcs import src < autoware.repos

Install dependent ROS packages.

Autoware requires some ROS 2 packages in addition to the core components. The tool rosdep allows an automatic search and installation of such dependencies. You might need to run rosdep update before rosdep install.

source /opt/ros/humble/setup.bash
sudo apt-get install -y libqt5serialport5-dev
sudo apt-get install -y libyaml-cpp-dev
sudo apt-get install -y  libpcap-dev
rosdep update
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

Build the workspace.

Autoware uses colcon to build workspaces. For more advanced options, refer to the documentation.

# For release build
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
# For debug build
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo

Note⚠️ : If rclcpp is killed, it may be due to insufficient memory. Please follow the steps below to expand virtual memory and try again several times.

# Optional: Check the current swapfile
free -h

# Remove the current swapfile
sudo swapoff /swapfile
sudo rm /swapfile

# Create a new swapfile
sudo fallocate -l 32G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# Optional: Check if the change is reflected
free -h

How to update a workspace

  1. Update the .repos file.
cd autoware
git pull
  1. Update the repositories.
vcs import src < autoware.repos
vcs pull src

For Git users:

vcs import

is similar to

git checkout

Note that it doesn't pull from the remote.

vcs pull

is similar to

git pull

Note that it doesn't switch branches.

For more information, refer to the official documentation.

  1. Install dependent ROS packages.
source /opt/ros/humble/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
  1. Build the workspace.
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

Additional settings for developers

Colorizing logger output

By default, ROS 2 logger doesn't colorize the output. To colorize it, write the following in your .bashrc:

export RCUTILS_COLORIZED_OUTPUT=1

Customizing the format of logger output

By default, ROS 2 logger doesn't output detailed information such as file name, function name, or line number. To customize it, write the following in your .bashrc:

export RCUTILS_CONSOLE_OUTPUT_FORMAT="[{severity} {time}] [{name}]: {message} ({function_name}() at {file_name}:{line_number})"

For more options, see here.

Enabling localhost-only communication

By default, ROS 2 communicates using multi-cast, which may unnecessarily increase the network traffic. To avoid it, write the following in your .bashrc:

export ROS_LOCALHOST_ONLY=1

Setting up ROS_DOMAIN_ID

ROS 2 uses ROS_DOMAIN_ID to create groups and communicate between machines in the groups. Since all ROS 2 nodes use domain ID 0 by default, it may cause unintended interference.

To avoid it, set a different domain ID for each group in your .bashrc:

# Replace X with the Domain ID you want to use
# Domain ID should be a number in range [0, 101] (inclusive)
export ROS_DOMAIN_ID=X

For more information, see here.

Other Troubleshooting

https://autowarefoundation.github.io/autoware-documentation/main/support/troubleshooting/

References

Autoware Documentation-Installation https://autowarefoundation.github.io/autoware-documentation/main/installation/

Autoware Universe Documentation https://autowarefoundation.github.io/autoware.universe/main/

Play a simulation

install gdown

git clone https://github.com/wkentaro/gdown.git
cd gdown
sudo pip install gdown

Planning simulation

Download and unpack a sample map.

gdown -O ~/autoware_map/ 'https://docs.google.com/uc?export=download&id=1499_nsbUbIeturZaDj7jhUownh5fvXHd'
unzip -d ~/autoware_map ~/autoware_map/sample-map-planning.zip

Rosbag replay simulation

Steps

  1. Download and unpack a sample map.

    • You can also download the map manually.
gdown -O ~/autoware_map/ 'https://docs.google.com/uc?export=download&id=1A-8BvYRX3DhSzkAnOcGWFw5T30xTlwZI'
unzip -d ~/autoware_map/ ~/autoware_map/sample-map-rosbag.zip
  1. Download the sample rosbag files.
gdown -O ~/autoware_map/ 'https://docs.google.com/uc?export=download&id=1VnwJx9tI3kI_cTLzP61ktuAJ1ChgygpG'
unzip -d ~/autoware_map/ ~/autoware_map/sample-rosbag.zip

Note

  • Sample map and rosbag: Copyright 2020 TIER IV, Inc.
  • Due to privacy concerns, the rosbag does not contain image data, which will cause:
  • Traffic light recognition functionality cannot be tested with this sample rosbag.
  • Object detection accuracy is decreased.