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

Feature/gazebo simulator #1930

Merged
merged 60 commits into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
835fc65
initial commit gazebo simulator
yukkysaito Jan 21, 2019
187330b
delete old gazebo simulator
yukkysaito Jan 21, 2019
fa95db8
add citysim and car_demo
yukkysaito Jan 21, 2019
67cb8cc
update gazebo launch
yukkysaito Jan 21, 2019
fa48325
update readme
yukkysaito Jan 21, 2019
7d55f96
add gitignore
yukkysaito Jan 21, 2019
577c420
fixed bug gazebo model download script
yukkysaito Jan 21, 2019
a0ae053
launch gazebo from runtimemanager
yukkysaito Jan 21, 2019
11ebc2f
fixed tf frame
yukkysaito Jan 21, 2019
f580c24
update car_demo submodule
yukkysaito Jan 22, 2019
f5d75ee
Merge remote-tracking branch 'origin/develop' into feature/gazebo_sim…
yukkysaito Jan 22, 2019
f44cd65
update mcity world
yukkysaito Jan 23, 2019
4af8736
fixed bug (vehicle_gazebo_input_subscriber)
yukkysaito Jan 28, 2019
443fca2
refactoring gazebo launch
yukkysaito Jan 28, 2019
997ee12
update readme
yukkysaito Jan 28, 2019
5c9c9a5
update gazebo world
yukkysaito Jan 28, 2019
f2944cf
modify initial pose on gazebo world
yukkysaito Jan 29, 2019
dd38dea
Merge branch 'feature/gazebo_simulator' of https://github.com/CPFL/Au…
yukkysaito Jan 29, 2019
43ebad5
update citysim submodule t fix bug
yukkysaito Jan 29, 2019
d82f31a
Merge remote-tracking branch 'origin/feature/gazebo_simulator' into f…
yukkysaito Jan 29, 2019
bb72fa1
Update ros/src/simulation/gazebo_simulator/worlds/gazebo_world_descri…
aohsato Jan 29, 2019
0102194
Update ros/src/simulation/gazebo_simulator/vehicle/vehicle_model/pack…
aohsato Jan 29, 2019
dd7fbb1
Merge remote-tracking branch 'origin/feature/gazebo_simulator' into f…
yukkysaito Jan 29, 2019
ff3b2f8
cosmetic change
yukkysaito Jan 29, 2019
fde128a
apply xml formatter
yukkysaito Jan 29, 2019
eb9cf22
add comment for vehicle_gazebo_input_subscriber
yukkysaito Jan 29, 2019
1d2c0c0
Update ros/src/simulation/gazebo_simulator/launcher/vehicle_gazebo_si…
aohsato Jan 29, 2019
baac12d
Update ros/src/simulation/gazebo_simulator/launcher/vehicle_gazebo_si…
aohsato Jan 29, 2019
578ab7e
Update ros/src/simulation/gazebo_simulator/launcher/vehicle_gazebo_si…
aohsato Jan 29, 2019
c5f8b6d
Update ros/src/simulation/gazebo_simulator/vehicle/vehicle_gazebo_sim…
aohsato Jan 29, 2019
693476f
Update ros/src/simulation/gazebo_simulator/vehicle/sensor_model/imu/i…
aohsato Jan 29, 2019
d77454e
cosmetic change
yukkysaito Jan 29, 2019
072f3ac
Merge remote-tracking branch 'origin/feature/gazebo_simulator' into f…
yukkysaito Jan 29, 2019
0c98318
Update ros/src/simulation/gazebo_simulator/vehicle/sensor_model/camer…
aohsato Jan 29, 2019
8fcb12e
modified maintainer info in package xml
yukkysaito Jan 29, 2019
c82aa1e
Merge remote-tracking branch 'origin/feature/gazebo_simulator' into f…
yukkysaito Jan 29, 2019
2c8f189
cosmetic change
yukkysaito Jan 29, 2019
ce223de
subscribe autoware_msgs::VehicleCmd message
yukkysaito Jan 30, 2019
38204b9
publish tf and twist from gazebo
yukkysaito Jan 30, 2019
41da408
:put_litter_in_its_place:
yukkysaito Feb 1, 2019
5ed70b2
update docker image for gazebo
yukkysaito Feb 1, 2019
28bf8bb
fixed bug and typo
yukkysaito Feb 5, 2019
e6deb8c
update tf frame
yukkysaito Feb 7, 2019
36fd263
update for can odometry
yukkysaito Feb 7, 2019
400b1c8
change gain for gazebo
yukkysaito Feb 8, 2019
8062f8b
Updated cross-build image and removed velodyne submodule
Feb 7, 2019
1b5e2d6
add dependency (velodyne simulator)
yukkysaito Feb 13, 2019
14ab89f
Merge pull request #1976 from sgermanserrano/fix/gazebo_simulator_ci
yukkysaito Feb 13, 2019
0f1d9a3
delete osrd_citysim submodule
yukkysaito Feb 16, 2019
ac427c6
add osrf_city submodule from CPFL repo
yukkysaito Feb 16, 2019
75a9fd9
add car_demo from CPFL repo
yukkysaito Feb 16, 2019
4c2a09c
modify wrong dependency
yukkysaito Feb 16, 2019
a3e8898
remove dependency velodyne_simulator
yukkysaito Feb 16, 2019
08ad3fe
modify sensor position
yukkysaito Feb 16, 2019
b4cf855
cosmetic change
yukkysaito Feb 16, 2019
17e344d
update readme
yukkysaito Feb 16, 2019
d089386
Update README.md
yukkysaito Feb 16, 2019
1e30f34
cosmetic change
yukkysaito Feb 22, 2019
38cc7da
Merge remote-tracking branch 'origin/feature/gazebo_simulator' into f…
yukkysaito Feb 22, 2019
beaee78
fixed bug (wrong package.xml of gazebo simulator)
yukkysaito Feb 22, 2019
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
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
path = ros/src/sensing/drivers/lidar/packages/ouster
url = https://github.com/CPFL/ouster
branch = autoware_branch
[submodule "ros/src/simulation/gazebo_simulator/vehicle/sensor_model/velodyne"]
path = ros/src/simulation/gazebo_simulator/vehicle/sensor_model/velodyne
url = https://bitbucket.org/DataspeedInc/velodyne_simulator.git
[submodule "ros/src/simulation/gazebo_simulator/worlds/external/osrf_citysim"]
path = ros/src/simulation/gazebo_simulator/worlds/external/osrf_citysim
url = https://github.com/yukkysaito/osrf_citysim.git
yukkysaito marked this conversation as resolved.
Show resolved Hide resolved
[submodule "ros/src/simulation/gazebo_simulator/worlds/external/car_demo"]
path = ros/src/simulation/gazebo_simulator/worlds/external/car_demo
url = https://github.com/yukkysaito/car_demo.git
14 changes: 13 additions & 1 deletion docker/crossbuild/Dockerfile.kinetic-crossbuild
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ros-kinetic-tf2-ros \
ros-kinetic-visualization-msgs \
ros-kinetic-xacro \
ros-kinetic-rosbridge-server
ros-kinetic-rosbridge-server \
ros-kinetic-gazebo-ros \
ros-kinetic-gazebo-msgs \
ros-kinetic-gazebo-ros-control \
ros-kinetic-urdf \
ros-kinetic-xacro \
ros-kinetic-position-controllers \
ros-kinetic-transmission-interface \
ros-kinetic-velocity-controllers \
ros-kinetic-effort-controllers \
ros-kinetic-controller-manager \
ros-kinetic-robot-state-publisher \
ros-kinetic-joint-state-controller

RUN find / -depth -xdev -type l -lname '/*' -exec sh -c 'linkpath="$(readlink {})" && rm -f {} && ln -frsv "$linkpath" "{}"' \;

Expand Down
53 changes: 53 additions & 0 deletions ros/src/simulation/gazebo_simulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Overview
Autonomous driving car simulator based on gazebo.
The following sensors are simulated.
- velodyne (VLP-16, HDL-32E)
- camera
- imu
![screenshot from 2019-01-11 00-42-10-min](https://user-images.githubusercontent.com/8327598/50984661-bed3f780-1545-11e9-9af6-071ddd1cec76.png)

yukkysaito marked this conversation as resolved.
Show resolved Hide resolved
# Requirements
- ROS (higher kinetic)
- gazebo (higher version 7)
- CUDA (Optional but requires GPU by default)

# Setup
1. upgrade gazebo version and download gazebo models(**only once**)
- reason : https://bitbucket.org/DataspeedInc/velodyne_simulator/src/56d11e899ce0a198e7206298b3aaaf8004f3a2c6/gazebo_upgrade.md?fileviewer=file-view-default
```
$ rosrun vehicle_gazebo_simulation_launcher setup.sh
```


# Some example
## **Citysim** : http://gazebosim.org/blog/car_sim
```
$ roslaunch vehicle_gazebo_simulation_launcher gazebo_launcher.launch world_name:=citysim_gazebo7 gpu:=true
```

If you use gazebo9, simulate traffic lights and moving objects.
Build according to the [readme](https://github.com/yukkysaito/osrf_citysim/tree/9356b76bd827a3afcb71000b9274e3f64713a77c) and execute the following command
yukkysaito marked this conversation as resolved.
Show resolved Hide resolved
```
$ roslaunch vehicle_gazebo_simulation_launcher gazebo_launcher.launch world_name:=citysim_gazebo9 gpu:=true
```

![screenshot from 2019-01-11 00-40-35-min](https://user-images.githubusercontent.com/8327598/50985197-19ba1e80-1547-11e9-98d1-284b3172c064.png)
## **mcity(car_demo)** : https://github.com/osrf/car_demo
```
$ roslaunch vehicle_gazebo_simulation_launcher gazebo_launcher.launch world_name:=mcity gpu:=true
```
![screenshot from 2019-01-11 00-38-49-min](https://user-images.githubusercontent.com/8327598/50985258-3e15fb00-1547-11e9-91d4-3b826b82136e.png)

## **simple** : https://github.com/CPFL/Autoware
```
$ roslaunch vehicle_gazebo_simulation_launcher gazebo_launcher.launch world_name:=simple gpu:=true
```
[![](https://img.youtube.com/vi/wIzZ25XJI2M/0.jpg)](https://www.youtube.com/watch?v=wIzZ25XJI2M)

## Download pointcloud map
If you need pointcloud map and path files, you can [download](https://drive.google.com/open?id=1yu8s885HDkJp3IbMV06KWim2ZdUxIoIF).

# How to change vehicle info
You can customize sensor position and vehicle info.
- sensor position: vehicle/vehicle_model/config/caibration.yaml
- vehicle info: vehicle/vehicle_model/config/vehicle_info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 2.8.3)
project(vehicle_gazebo_simulation_launcher)
yukkysaito marked this conversation as resolved.
Show resolved Hide resolved

find_package(catkin REQUIRED
controller_manager
controller_manager
robot_state_publisher
joint_state_controller
)

catkin_package(
CATKIN_DEPENDS
controller_manager
robot_state_publisher
joint_state_controller
)
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY scripts
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>

<arg name="model" default="$(find vehicle_model)/urdf/vehicle.xacro"/>
<arg name="ns" default="/autoware_gazebo"/>
<arg name="gpu" default="false"/>
<arg name="world_name" default="mcity"/>
<param name="robot_description" command="$(find xacro)/xacro.py --inorder $(arg model) gpu:=$(arg gpu)" />

<!-- world file -->
<arg name="world_file_name" default="worlds/empty.world" if="$(eval world_name=='empty')" />
<arg name="world_file_name" default="$(find gazebo_world_description)/worlds/autoware.world" if="$(eval world_name=='simple')" />
<arg name="world_file_name" default="$(find gazebo_world_description)/worlds/mcity_r1.world" if="$(eval world_name=='mcity')" />
<arg name="world_file_name" default="$(find gazebo_world_description)/worlds/citysim_gazebo7.world" if="$(eval world_name=='citysim_gazebo7')" />
<arg name="world_file_name" default="$(find gazebo_world_description)/worlds/citysim_gazebo9.world" if="$(eval world_name=='citysim_gazebo9')" />
<!-- spawn model flag-->
<arg name="spawn_model_flag" default="" if="$(eval world_name=='empty')" />
<arg name="spawn_model_flag" default="" if="$(eval world_name=='simple')" />
<arg name="spawn_model_flag" default="-x 3 -y -12 -z 0.5" if="$(eval world_name=='mcity')" />
<arg name="spawn_model_flag" default="" if="$(eval world_name=='citysim_gazebo7')" />
<arg name="spawn_model_flag" default="" if="$(eval world_name=='citysim_gazebo9')" />

<!-- launch gazebo -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" default="$(arg world_file_name)"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description $(arg spawn_model_flag) -urdf -model autoware_gazebo" />

<group ns="/vehicle_info">
<rosparam file="$(find vehicle_model)/config/vehicle_info.yaml" command="load"/>
</group>
<group ns="$(arg ns)">
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find vehicle_model)/config/controller.yaml" command="load"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen"
args="wheel_left_rear_velocity_controller wheel_right_rear_velocity_controller steering_left_front_position_controller steering_right_front_position_controller joint_state_controller"/>
<!-- tf publisher -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

<node name="vehicle_gazebo_input_subscriber" pkg="vehicle_gazebo_simulation_interface" type="vehicle_gazebo_input_subscriber" respawn="false"
output="screen">
<param name="twist_sub" value="true" />
<param name="twiststamped" value="true" />
<param name="ctrl_cmd" value="false" />
</node>
<node name="vehicle_gazebo_info_publisher" pkg="vehicle_gazebo_simulation_interface" type="vehicle_gazebo_info_publisher" respawn="false"
output="screen">
<param name="enable_base_link_tf" value="false" />
</node>
</group>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<launch>

<arg name="model" default="$(find vehicle_model)/urdf/vehicle.xacro"/>
<arg name="gui" default="true" />
<arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />

<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />
<param name="use_gui" value="$(arg gui)"/>

<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch>

<arg name="model" default="$(find vehicle_model)/urdf/vehicle.xacro"/>
<arg name="ns" default="/autoware_gazebo"/>
<arg name="gpu" default="false"/>
<param name="robot_description" command="$(find xacro)/xacro.py --inorder $(arg model) gpu:=$(arg gpu)" />
<arg name="rvizconfig" default="$(find urdf_tutorial)/rviz/urdf.rviz" />

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" default="$(find gazebo_world_description)/worlds/autoware.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>

<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model autoware_gazebo" />

<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
<node name="rqt_robot_steering" pkg="rqt_robot_steering" type="rqt_robot_steering" />

<group ns="$(arg ns)">
<!-- Load joint controller configurations from YAML file to parameter server -->
<rosparam file="$(find vehicle_model)/config/controller.yaml" command="load"/>
<!-- load the controllers -->
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen"
args="wheel_left_rear_velocity_controller wheel_right_rear_velocity_controller steering_left_front_position_controller steering_right_front_position_controller joint_state_controller"/>
<!-- tf publisher -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

<rosparam file="$(find vehicle_model)/config/vehicle_info.yaml" command="load"/>
<node name="vehicle_gazebo_input_subscriber" pkg="vehicle_gazebo_simulation_interface" type="vehicle_gazebo_input_subscriber" respawn="false"
output="screen">
<param name="twist_sub" value="true" />
<param name="twiststamped_sub" value="true" />
<param name="ctrl_cmd" value="true" />
</node>
<node name="vehicle_gazebo_info_publisher" pkg="vehicle_gazebo_simulation_interface" type="vehicle_gazebo_info_publisher" respawn="false"
output="screen">
</node>
</group>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<package format="2">
<name>vehicle_gazebo_simulation_launcher</name>
<version>0.0.0</version>
<description>The vehicle_gazebo_simulation_launcher package</description>

<maintainer email="yukky.saito@gmail.com">yukihiro saito</maintainer>

<license>Apache 2</license>

<buildtool_depend>catkin</buildtool_depend>

<build_depend>controller_manager</build_depend>
<build_depend>robot_state_publisher</build_depend>
<build_depend>joint_state_controller</build_depend>
<build_export_depend>controller_manager</build_export_depend>
<build_export_depend>robot_state_publisher</build_export_depend>
<build_export_depend>joint_state_controller</build_export_depend>
<exec_depend>controller_manager</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>joint_state_controller</exec_depend>
<exec_depend>velodyne_description</exec_depend>
<exec_depend>mercurial</exec_depend>

yukkysaito marked this conversation as resolved.
Show resolved Hide resolved
<export>
</export>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

mkdir -p ~/.gazebo/models
echo "Download generic gazebo models"
if [ -e /tmp/gazebo_models ]; then
echo "Already exist /tmp/gazebo_models"
echo "removing /tmp/gazebo_models"
rm -r /tmp/gazebo_models
fi
hg clone https://bitbucket.org/osrf/gazebo_models /tmp/gazebo_models

if [ -e /tmp/gazebo_models ]; then
echo "Install generic gazebo models"
mv -n /tmp/gazebo_models/* ~/.gazebo/models/
echo "Completed"
else
echo "Error"
fi

echo "Install osrf_citysim models"
SCRIPT_DIR=$(cd $(dirname $0); pwd)
cp -rn $SCRIPT_DIR/../../../worlds/external/osrf_citysim/models/* ~/.gazebo/models/

echo "Install car_demo models"
cp -rn $SCRIPT_DIR/../../../worlds/external/car_demo/car_demo/models/* ~/.gazebo/models/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

SCRIPT_DIR=$(cd $(dirname $0); pwd)
echo "Copy world file to gazebo_world_description"
cp -n $SCRIPT_DIR/../../../worlds/external/osrf_citysim/worlds/citysim_gazebo7.world $SCRIPT_DIR/../../../worlds/gazebo_world_description/worlds/
cp -n $SCRIPT_DIR/../../../worlds/external/osrf_citysim/worlds/citysim_gazebo9.world $SCRIPT_DIR/../../../worlds/gazebo_world_description/worlds/
cp -n $SCRIPT_DIR/../../../worlds/external/car_demo/car_demo/worlds/mcity.world $SCRIPT_DIR/../../../worlds/gazebo_world_description/worlds/
cp -n $SCRIPT_DIR/../../../worlds/external/car_demo/car_demo/worlds/mcity_r1.world $SCRIPT_DIR/../../../worlds/gazebo_world_description/worlds/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

SCRIPT_DIR=$(cd $(dirname $0); pwd)
$SCRIPT_DIR/download_model.sh
$SCRIPT_DIR/upgrade_gazebo_stable_version.sh
$SCRIPT_DIR/integrate_world_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/gazebo-stable.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743
sudo apt update
sudo apt install gazebo7 gazebo7-common gazebo7-plugin-base libgazebo7 libgazebo7-dev libignition-math2 libignition-math2-dev libsdformat4 libsdformat4-dev sdformat-sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 2.8.3)
project(camera_description)
yukkysaito marked this conversation as resolved.
Show resolved Hide resolved

find_package(catkin REQUIRED)

catkin_package()

install(DIRECTORY urdf
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<package format="2">
<name>camera_description</name>
<version>0.0.0</version>
<description>The camera_description package</description>

<maintainer email="yukky.saito@gmail.com">yukihiro saito</maintainer>

<license>Apache 2</license>

<buildtool_depend>catkin</buildtool_depend>

<export>
</export>
</package>
Loading