Skip to content

Commit

Permalink
Added velodyne package
Browse files Browse the repository at this point in the history
  • Loading branch information
Neelaksh-007 committed Nov 3, 2020
1 parent 12026cc commit cab88d9
Show file tree
Hide file tree
Showing 50 changed files with 2,970 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
g_mapper
sensors/velodyne_depricated
7 changes: 7 additions & 0 deletions px4_files/setup_env.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source ~/catkin_ws/devel/setup.bash
declare FIRMWARE_PATH="/home/neelaksh/catkin_ws/Firmware"
declare VELODYNE_PATH="/home/neelaksh/catkin_ws/src/aq_project/sensors/velodyne_simulator/velodyne_description/models"
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${VELODYNE_PATH}
source ${FIRMWARE_PATH}/Tools/setup_gazebo.bash ${FIRMWARE_PATH} ${FIRMWARE_PATH}/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${FIRMWARE_PATH}
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${FIRMWARE_PATH}/Tools/sitl_gazebo
1 change: 0 additions & 1 deletion sensors/velodyne_simulator
Submodule velodyne_simulator deleted from b5aa0c
27 changes: 27 additions & 0 deletions sensors/velodyne_simulator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Software License Agreement (BSD License)

Copyright (c) 2015-2018, Dataspeed Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Dataspeed Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 changes: 50 additions & 0 deletions sensors/velodyne_simulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Velodyne Simulator
URDF description and Gazebo plugins to simulate Velodyne laser scanners

![rviz screenshot](img/rviz.png)

# Features
* URDF with colored meshes
* Gazebo plugin based on [gazebo_plugins/gazebo_ros_block_laser](https://github.com/ros-simulation/gazebo_ros_pkgs/blob/kinetic-devel/gazebo_plugins/src/gazebo_ros_block_laser.cpp)
* Publishes PointCloud2 with same structure (x, y, z, intensity, ring)
* Simulated Gaussian noise
* GPU acceleration ([with a modern Gazebo build](gazebo_upgrade.md))
* Supported models:
* [VLP-16](velodyne_description/urdf/VLP-16.urdf.xacro)
* [HDL-32E](velodyne_description/urdf/HDL-32E.urdf.xacro)
* Pull requests for other models are welcome
* Experimental support for clipping low-intensity returns

# Parameters
* ```*origin``` URDF transform from parent link.
* ```parent``` URDF parent link name. Default ```base_link```
* ```name``` URDF model name. Also used as tf frame_id for PointCloud2 output. Default ```velodyne```
* ```topic``` PointCloud2 output topic name. Default ```/velodyne_points```
* ```hz``` Update rate in hz. Default ```10```
* ```lasers``` Number of vertical spinning lasers. Default ```VLP-16: 16, HDL-32E: 32```
* ```samples``` Nuber of horizontal rotating samples. Default ```VLP-16: 1875, HDL-32E: 2187```
* ```min_range``` Minimum range value in meters. Default ```0.9```
* ```max_range``` Maximum range value in meters. Default ```130.0```
* ```noise``` Gausian noise value in meters. Default ```0.008```
* ```min_angle``` Minimum horizontal angle in radians. Default ```-3.14```
* ```max_angle``` Maximum horizontal angle in radians. Default ```3.14```
* ```gpu``` Use gpu_ray sensor instead of the standard ray sensor. Default ```false```
* ```min_intensity``` The minimum intensity beneath which returns will be clipped. Can be used to remove low-intensity objects.

# Known Issues
* At full sample resolution, Gazebo can take up to 30 seconds to load the VLP-16 pluggin, 60 seconds for the HDL-32E
* With the default Gazebo version shipped with ROS, ranges are incorrect when accelerated with the GPU option ([issue](https://bitbucket.org/osrf/gazebo/issues/946/),[image](img/gpu.png))
* Solution: Upgrade to a [modern Gazebo version](gazebo_upgrade.md)
* Gazebo cannot maintain 10Hz with large pointclouds
* Solution: User can reduce number of points (samples) or frequency (hz) in the urdf parameters, see [example.urdf.xacro](velodyne_description/urdf/example.urdf.xacro)
* Gazebo crashes when updating HDL-32E sensors with default number of points. "Took over 1.0 seconds to update a sensor."
* Solution: User can reduce number of points in urdf (same as above)
* Gazebo versions in indigo and jade have different z orientations
* Solution: Maintain separate branches for urdf changes (gazebo2 and master)

# Example Gazebo Robot
```roslaunch velodyne_description example.launch```

# Example Gazebo Robot (with GPU)
```roslaunch velodyne_description example.launch gpu:=true```

52 changes: 52 additions & 0 deletions sensors/velodyne_simulator/bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Docker image from Docker Hub
image: osrf/ros:kinetic-desktop-full

pipelines:
default:
- parallel:
- step:
name: kinetic
image: osrf/ros:kinetic-desktop-full
script:
- mkdir -p /tmp/src/repo && mv `pwd`/* /tmp/src/repo && mv /tmp/src `pwd` # Move everything into the src directory
- source `find /opt/ros -name setup.bash | sort | head -1` && echo $ROS_DISTRO # Source ROS environment
- apt update && rosdep install --from-paths src --ignore-src -y # Install dependencies missing from the docker image
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args tests
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args run_tests -j1
- catkin_test_results build_isolated
- step:
name: lunar
image: osrf/ros:lunar-desktop-full
script:
- mkdir -p /tmp/src/repo && mv `pwd`/* /tmp/src/repo && mv /tmp/src `pwd` # Move everything into the src directory
- source `find /opt/ros -name setup.bash | sort | head -1` && echo $ROS_DISTRO # Source ROS environment
- apt update && rosdep install --from-paths src --ignore-src -y # Install dependencies missing from the docker image
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args tests
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args run_tests -j1
- catkin_test_results build_isolated
- step:
name: melodic
image: osrf/ros:melodic-desktop-full
script:
- mkdir -p /tmp/src/repo && mv `pwd`/* /tmp/src/repo && mv /tmp/src `pwd` # Move everything into the src directory
- source `find /opt/ros -name setup.bash | sort | head -1` && echo $ROS_DISTRO # Source ROS environment
- apt update && rosdep install --from-paths src --ignore-src -y # Install dependencies missing from the docker image
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args tests
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args run_tests -j1
- catkin_test_results build_isolated
branches:
gazebo2:
- step:
name: indigo
image: osrf/ros:indigo-desktop-full
script:
- mkdir -p /tmp/src/repo && mv `pwd`/* /tmp/src/repo && mv /tmp/src `pwd` # Move everything into the src directory
- source `find /opt/ros -name setup.bash | sort | head -1` && echo $ROS_DISTRO # Source ROS environment
- apt update && rosdep install --from-paths src --ignore-src -y # Install dependencies missing from the docker image
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args tests
- catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --make-args run_tests -j1
- catkin_test_results build_isolated
14 changes: 14 additions & 0 deletions sensors/velodyne_simulator/gazebo_upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# GPU issues
The GPU problems reported in this [issue](https://bitbucket.org/osrf/gazebo/issues/946/) have been solved with this [pull request](https://bitbucket.org/osrf/gazebo/pull-requests/2955/) for the ```gazebo7``` branch. The Gazebo versions from the ROS apt repository (7.0.0 for Kinetic, 9.0.0 for Melodic) do not have this fix. One solution is to pull up-to-date packages from the OSRF Gazebo apt repository. Another solution is to compile from source: http://gazebosim.org/tutorials?tut=install_from_source

* The GPU fix was added to ```gazebo7``` in version 7.14.0
* The GPU fix was added to ```gazebo9``` in version 9.4.0

# Use up-to-date packages from the OSRF Gazebo apt repository
```
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 upgrade
```

Binary file added sensors/velodyne_simulator/img/gpu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sensors/velodyne_simulator/img/rviz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions sensors/velodyne_simulator/velodyne_description/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package velodyne_description
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.0.10 (2020-08-03)
-------------------
* Change PointCloud visualization type from flat squares to points in example rviz config
* Bump minimum CMake version to 3.0.2 in all CMakeLists.txt
* Fix xacro macro instantiation
* Contributors: Kevin Hallenbeck, Micho Radovnikovich

1.0.9 (2019-03-08)
------------------

1.0.8 (2018-09-08)
------------------

1.0.7 (2018-07-03)
------------------
* Added GPU support
* Updated inertia tensors for VLP-16 and HDL-32E to realistic values
* Removed unnecessary file extraction code in cmake
* Contributors: Kevin Hallenbeck, Max Schwarz

1.0.6 (2017-10-17)
------------------
* Use robotNamespace as prefix for PointCloud2 topic frame_id by default
* Contributors: Micho Radovnikovich

1.0.5 (2017-09-05)
------------------
* Increased minimum collision range to prevent self-clipping when in motion
* Added many URDF parameters, and set example sample count to reasonable values
* Launch rviz with gazebo
* Contributors: Kevin Hallenbeck

1.0.4 (2017-04-24)
------------------
* Updated package.xml format to version 2
* Contributors: Kevin Hallenbeck

1.0.3 (2016-08-13)
------------------
* Contributors: Kevin Hallenbeck

1.0.2 (2016-02-03)
------------------
* Moved M_PI property out of macro to support multiple instances
* Materials caused problems with more than one sensors. Removed.
* Added example urdf and gazebo
* Changed to DAE meshes
* Added meshes. Added HDL-32E.
* Start from block laser
* Contributors: Kevin Hallenbeck
15 changes: 15 additions & 0 deletions sensors/velodyne_simulator/velodyne_description/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.0.2)
project(velodyne_description)

find_package(catkin REQUIRED)

find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

catkin_package()

install(DIRECTORY launch meshes rviz urdf world
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<launch>
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="verbose" default="false"/>
<arg name="world_name" default="$(find velodyne_description)/world/example.world"/>

<!-- Start gazebo and load the world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch" >
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="headless" value="$(arg headless)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="verbose" value="$(arg verbose)"/>
<arg name="world_name" value="$(arg world_name)"/>
</include>

<!-- Spawn the example robot -->
<arg name="gpu" default="false"/>
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find velodyne_description)/urdf/example.urdf.xacro' gpu:=$(arg gpu)" />
<node pkg="gazebo_ros" type="spawn_model" name="spawn_model" args="-urdf -param /robot_description -model example"/>
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>

<!-- RViz -->
<arg name="rviz" default="true"/>
<node if="$(arg rviz)" pkg="rviz" type="rviz" name="$(anon rviz)" respawn="false" output="screen" args="-d $(find velodyne_description)/rviz/example.rviz" />

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" ?>
<launch>
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="verbose" default="false"/>
<arg name="world_name" default="$(find mavlink_sitl_gazebo)/worlds/empty.world"/>
<arg name="sensor" default="velodyne_VLP16"/>
<arg name="sdf" default="$(find velodyne_description)/models/$(arg sensor)/$(arg sensor).sdf"/>

<!-- sensor pose -->
<arg name="x" default="1"/>
<arg name="y" default="1"/>
<arg name="z" default="0"/>
<arg name="R" default="0"/>
<arg name="P" default="0"/>
<arg name="Y" default="0"/>

<!-- Start gazebo and load the world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch" >
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="headless" value="$(arg headless)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="verbose" value="$(arg verbose)"/>
<arg name="world_name" value="$(arg world_name)"/>
</include>

<!-- Spawn the example robot -->
<arg name="gpu" default="false"/>
<node pkg="gazebo_ros" type="spawn_model" name="spawn_model" output="screen" args="-sdf -file $(arg sdf) -model $(arg sensor) -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>
<!-- <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node> -->

<!-- RViz -->
<!-- <arg name="rviz" default="true"/>
<node if="$(arg rviz)" pkg="rviz" type="rviz" name="$(anon rviz)" respawn="false" output="screen" args="-d $(find velodyne_description)/rviz/example.rviz" /> -->

</launch>

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Loading

0 comments on commit cab88d9

Please sign in to comment.