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

Update code and patch to work with Carla 0.9.11. #138

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
60 changes: 44 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,61 @@
ARG AUTOWARE_VERSION=1.14.0-melodic-cuda
ARG AUTOWARE_VERSION=latest-melodic-cuda

FROM autoware/autoware:$AUTOWARE_VERSION

USER autoware
ENV USERNAME autoware

WORKDIR /home/autoware

# Update simulation repo to latest master.
COPY --chown=autoware update_sim.patch ./Autoware
RUN patch ./Autoware/autoware.ai.repos ./Autoware/update_sim.patch
RUN cd ./Autoware \
# Update autoware/simulation package version to latest.
COPY --chown=autoware update_sim_version.patch /home/$USERNAME/Autoware
RUN patch ./Autoware/autoware.ai.repos /home/$USERNAME/Autoware/update_sim_version.patch

# Change code in autoware/simulation package.
COPY --chown=autoware update_sim_code.patch /home/$USERNAME/Autoware/src/autoware/simulation
RUN cd /home/$USERNAME/Autoware \
&& vcs import src < autoware.ai.repos \
&& git --git-dir=./src/autoware/simulation/.git --work-tree=./src/autoware/simulation pull \
&& cd /home/$USERNAME/Autoware/src/autoware/simulation \
&& git apply update_sim_code.patch

# Compile with colcon build.
RUN cd ./Autoware \
&& source /opt/ros/melodic/setup.bash \
&& AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

# CARLA PythonAPI
RUN mkdir ./PythonAPI
ADD --chown=autoware https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/carla-0.9.10-py2.7-linux-x86_64.egg ./PythonAPI
ADD --chown=autoware https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/carla-0.9.11-py2.7-linux-x86_64.egg ./PythonAPI
RUN echo "export PYTHON2_EGG=$(ls /home/autoware/PythonAPI | grep py2.)" >> .bashrc \
&& echo "export PYTHONPATH=\$PYTHONPATH:~/PythonAPI/\$PYTHON2_EGG" >> .bashrc

# CARLA ROS Bridge
# There is some kind of mismatch between the ROS debian packages installed in the Autoware image and
# the latest ros-melodic-ackermann-msgs and ros-melodic-derived-objects-msgs packages. As a
# workaround we use a snapshot of the ROS apt repository to install an older version of the required
# packages.
RUN sudo rm -f /etc/apt/sources.list.d/ros1-latest.list
RUN sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
RUN sudo sh -c 'echo "deb http://snapshots.ros.org/melodic/2020-08-07/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-snapshots.list'
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
# packages.
USER root
RUN rm -f /etc/apt/sources.list.d/ros1-latest.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA
RUN sh -c 'echo "deb http://snapshots.ros.org/melodic/2020-08-07/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/ros-snapshots.list'
RUN apt-get update && apt-get install -y --no-install-recommends \
python-pip \
python-wheel \
ros-melodic-ackermann-msgs \
ros-melodic-derived-object-msgs \
&& sudo rm -rf /var/lib/apt/lists/*
RUN pip install simple-pid pygame networkx==2.2
&& rm -rf /var/lib/apt/lists/*
RUN pip install transforms3d simple-pid pygame networkx==2.2

RUN git clone -b '0.9.10.1' --recurse-submodules https://github.com/carla-simulator/ros-bridge.git
USER autoware

RUN git clone -b '0.9.11' --recurse-submodules https://github.com/carla-simulator/ros-bridge.git

# Update code in carla-ros-bridge package and fix the tf tree issue.
# The fix has been introduced in latest version (since 0.9.12):
# https://github.com/carla-simulator/ros-bridge/pull/570/commits/9f903cf43c4ef3dd0b909721e044c62a8796f841
COPY --chown=autoware update_ros_bridge.patch /home/$USERNAME/ros-bridge
RUN cd /home/$USERNAME/ros-bridge \
&& git apply update_ros_bridge.patch

# CARLA Autoware agent
COPY --chown=autoware . ./carla-autoware
Expand All @@ -52,5 +72,13 @@ RUN echo "export CARLA_AUTOWARE_CONTENTS=~/autoware-contents" >> .bashrc \
&& echo "source ~/carla_ws/devel/setup.bash" >> .bashrc \
&& echo "source ~/Autoware/install/setup.bash" >> .bashrc

CMD ["/bin/bash"]
USER root

# (Optional) Install vscode
RUN apt-get update
RUN apt-get install -y software-properties-common apt-transport-https wget
RUN wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
RUN apt-get -y install code

CMD ["/bin/bash"]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The carla autoware bridge is now hosted and maintained [here](https://github.com

This repository contains a demonstrator of an autoware agent ready to be executed with CARLA.

**The carla autoware integration requires CARLA 0.9.10.1. You can download it from [here](https://github.com/carla-simulator/carla/releases/tag/0.9.10.1)**
**The carla autoware integration requires CARLA 0.9.11. You can download it from [here](https://github.com/carla-simulator/carla/releases/tag/0.9.11)**

## CARLA autoware agent
The autoware agent is provided as a ROS package. All the configuration can be found inside the `carla-autoware-agent` folder.
Expand Down Expand Up @@ -42,7 +42,7 @@ This will generate a `carla-autoware:latest` docker image.
./CarlaUE4.sh
```

2. Run the `carla-autoware` image:
2. Run the `carla-autoware` image:

```sh
./run.sh
Expand All @@ -56,4 +56,3 @@ roslaunch carla_autoware_agent carla_autoware_agent.launch town:=Town01

## CARLA Autoware contents
The [autoware-contents](https://bitbucket.org/carla-simulator/autoware-contents.git) repository contains additional data required to run Autoware with CARLA, including the point cloud maps, vector maps and configuration files.

14 changes: 7 additions & 7 deletions carla-autoware-agent/agent/bridge.launch
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

<!-- ego_vehicle to base_link tf -->
<!-- Disabled as it gets published by ndt_matching -->
<!--<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)_to_baselink' args='0 0 0 0 0 0 /$(arg role_name) /base_link 10' />-->
<!-- <node pkg='tf' type='static_transform_publisher' name='$(arg role_name)_to_baselink' args='0 0 0 0 0 0 /$(arg role_name) /base_link 10' /> -->

<!-- ego_vehicle/gnss to gps tf -->
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)gnss_to_gps' args='0 0 0 0 0 0 /$(arg role_name)/gnss/gnss1 /gps 10' />
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)gnss_to_gps' args='0 0 0 0 0 0 /$(arg role_name)/gnss /gps 10' />

<!-- ego_vehicle/lidar to velodyne tf -->
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)lidar_to_velodyne' args='0 0 0 0 0 0 /$(arg role_name)/lidar/lidar1 /velodyne 10' />
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)lidar_to_velodyne' args='0 0 0 0 0 0 /$(arg role_name)/lidar /velodyne 10' />

<!-- ego_vehicle/cameraFront to camera tf -->
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)camerafront_to_camera' args='0 0 0 0 0 0 /$(arg role_name)/camera/rgb/front /camera 10' />
<node pkg='tf' type='static_transform_publisher' name='$(arg role_name)camerafront_to_camera' args='0 0 0 0 0 0 /$(arg role_name)/rgb_front /camera 10' />

<!--
#############################################
Expand All @@ -36,15 +36,15 @@
remap carla lidar to autoware.
@todo: to reduce load, Autoware should directly use the Carla-topic.
-->
<node pkg='topic_tools' type='relay' name='points_relay' args='/carla/$(arg role_name)/lidar/lidar1/point_cloud /points_raw'/>
<node pkg='topic_tools' type='relay' name='points_relay' args='/carla/$(arg role_name)/lidar /points_raw'/>

<!--
# camera #
remap carla front camera to autoware
@todo: to reduce load, Autoware should directly use the Carla-topic.
-->
<node pkg='topic_tools' type='relay' name='imag_relay' args='/carla/$(arg role_name)/camera/rgb/front/image_color /image_raw'/>
<node pkg='topic_tools' type='relay' name='info_relay' args='/carla/$(arg role_name)/camera/rgb/front/camera_info /camera_info'/>
<node pkg='topic_tools' type='relay' name='imag_relay' args='/carla/$(arg role_name)/rgb_front/image /image_raw'/>
<node pkg='topic_tools' type='relay' name='info_relay' args='/carla/$(arg role_name)/rgb_front/camera_info /camera_info'/>

<!--
# gnss #
Expand Down
162 changes: 162 additions & 0 deletions carla-autoware-agent/agent/config/objects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"objects":
[
{
"type": "sensor.pseudo.traffic_lights",
"id": "traffic_lights"
},
{
"type": "sensor.pseudo.objects",
"id": "objects"
},
{
"type": "sensor.pseudo.actor_list",
"id": "actor_list"
},
{
"type": "sensor.pseudo.markers",
"id": "markers"
},
{
"type": "sensor.pseudo.opendrive_map",
"id": "map"
},
{
"type": "vehicle.tesla.model3",
"id": "ego_vehicle",
"sensors":
[
{
"type": "sensor.camera.rgb",
"id": "rgb_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"image_size_x": 800,
"image_size_y": 600,
"fov": 90.0
},
{
"type": "sensor.camera.rgb",
"id": "rgb_view",
"spawn_point": {"x": -4.5, "y": 0.0, "z": 2.8, "roll": 0.0, "pitch": 20.0, "yaw": 0.0},
"image_size_x": 800,
"image_size_y": 600,
"fov": 90.0,
"attached_objects":
[
{
"type": "actor.pseudo.control",
"id": "control"
}
]
},
{
"type": "sensor.lidar.ray_cast",
"id": "lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20,
"noise_stddev": 0.0
},
{
"type": "sensor.lidar.ray_cast_semantic",
"id": "semantic_lidar",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 2.4, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"range": 50,
"channels": 32,
"points_per_second": 320000,
"upper_fov": 2.0,
"lower_fov": -26.8,
"rotation_frequency": 20
},
{
"type": "sensor.other.radar",
"id": "radar_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"horizontal_fov": 30.0,
"vertical_fov": 10.0,
"points_per_second": 1500,
"range": 100.0
},
{
"type": "sensor.camera.semantic_segmentation",
"id": "semantic_segmentation_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.depth",
"id": "depth_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70
},
{
"type": "sensor.camera.dvs",
"id": "dvs_front",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"fov": 90.0,
"image_size_x": 400,
"image_size_y": 70,
"positive_threshold": 0.3,
"negative_threshold": 0.3,
"sigma_positive_threshold": 0.0,
"sigma_negative_threshold": 0.0,
"use_log": true,
"log_eps": 0.001
},
{
"type": "sensor.other.gnss",
"id": "gnss",
"spawn_point": {"x": 1.0, "y": 0.0, "z": 2.0},
"noise_alt_stddev": 0.0, "noise_lat_stddev": 0.0, "noise_lon_stddev": 0.0,
"noise_alt_bias": 0.0, "noise_lat_bias": 0.0, "noise_lon_bias": 0.0
},
{
"type": "sensor.other.imu",
"id": "imu",
"spawn_point": {"x": 2.0, "y": 0.0, "z": 2.0, "roll": 0.0, "pitch": 0.0, "yaw": 0.0},
"noise_accel_stddev_x": 0.0, "noise_accel_stddev_y": 0.0, "noise_accel_stddev_z": 0.0,
"noise_gyro_stddev_x": 0.0, "noise_gyro_stddev_y": 0.0, "noise_gyro_stddev_z": 0.0,
"noise_gyro_bias_x": 0.0, "noise_gyro_bias_y": 0.0, "noise_gyro_bias_z": 0.0
},
{
"type": "sensor.other.collision",
"id": "collision",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 0.0}
},
{
"type": "sensor.other.lane_invasion",
"id": "lane_invasion",
"spawn_point": {"x": 0.0, "y": 0.0, "z": 0.0}
},
{
"type": "sensor.pseudo.tf",
"id": "tf"
},
{
"type": "sensor.pseudo.objects",
"id": "objects"
},
{
"type": "sensor.pseudo.odom",
"id": "odometry"
},
{
"type": "sensor.pseudo.speedometer",
"id": "speedometer"
},
{
"type": "actor.pseudo.control",
"id": "control"
}
]
}
]
}
Loading