Skip to content
This repository was archived by the owner on Aug 28, 2022. It is now read-only.

Commit b9b282b

Browse files
committed
First commit for Autoware version branch. Modified the original Ouster ROS code to suit Autoware needs. Code structure is more simple, only ROS driver code is kept, and the readme.md file has more details on how to configure the sensor and use this driver. To further ease Autoware integration, Velodyne compatibility options were added and tested with ndt_matching, ray_ground_filter and euclidean_cluster nodes.
1 parent 9a7ffc5 commit b9b282b

33 files changed

+278
-2749
lines changed

.gitignore

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
1-
/CMakeLists.txt
2-
.catkin_tools/
3-
build/
4-
devel/
5-
logs/
6-
install/
1+
# GNU global tags
2+
GTAGS
3+
GRTAGS
4+
GSYMS
5+
GPATH
6+
7+
# Python byte-compile file
8+
__pycache__/
9+
*.py[co]
10+
.ycm_extra_conf.py
11+
# editor backup files
12+
*~
13+
\#*\#
14+
15+
# backup files
16+
*.bak
17+
18+
# Eclipse
19+
.cproject
20+
.project
21+
.pydevproject
22+
.settings/
23+
24+
# Visual Studio Code
25+
.vscode/
26+
27+
# CLion
28+
.idea/
29+
cmake-build-debug/
30+
31+
# clang-format
32+
#.clang-format
33+
34+
# ROSBag files
35+
*.bag
36+
37+
# Environments
38+
.env
39+
.venv
40+
env/
41+
venv/
42+
ENV/
43+
44+
# Autoware Resources
45+
*.pcap
46+
*.pcd
47+
*.bag

.travis.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
sudo: required
2+
dist: xenial
3+
language: generic
4+
services:
5+
- docker
6+
compiler:
7+
- gcc
8+
9+
notifications:
10+
email:
11+
on_failure: always
12+
13+
env:
14+
global:
15+
- ROS_CI_DESKTOP="`lsb_release -cs`"
16+
- CI_SOURCE_PATH=$(pwd)
17+
- ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall
18+
- CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options
19+
- PYTHONPATH=${PYTHONPATH}:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages
20+
- WS_DIR="`mktemp -u ~/ouster_ws_tmp.XXXXXXXXXXXXXXXX`"
21+
matrix:
22+
- ROS_DISTRO="indigo" ROS_REPO=ros DOCKER_BASE_IMAGE=ros:indigo-ros-core
23+
- ROS_DISTRO="kinetic" ROS_REPO=ros DOCKER_BASE_IMAGE=ros:kinetic-ros-core
24+
25+
before_install:
26+
- sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list";
27+
travis_retry sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116;
28+
travis_retry sudo apt-get update;
29+
travis_retry sudo apt-get install -y dpkg;
30+
travis_retry sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-${ROS_DISTRO}-catkin;
31+
source /opt/ros/${ROS_DISTRO}/setup.bash;
32+
travis_retry sudo rosdep init;
33+
travis_retry rosdep update;
34+
35+
install:
36+
- mkdir -p $WS_DIR/src
37+
- cd $WS_DIR/src
38+
- catkin_init_workspace
39+
- cd $WS_DIR
40+
- catkin_make
41+
- source devel/setup.bash
42+
- cd $WS_DIR/src
43+
- ln -s $CI_SOURCE_PATH .
44+
45+
before_script:
46+
- cd $WS_DIR/src
47+
- wstool init
48+
- if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
49+
- wstool up
50+
- cd $WS_DIR
51+
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
52+
53+
script:
54+
- source /opt/ros/$ROS_DISTRO/setup.bash
55+
- cd $WS_DIR
56+
- catkin_make $( [ -f $CATKIN_OPTIONS ] && cat $CATKIN_OPTIONS )

ouster_ros/CMakeLists.txt renamed to CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ find_package(catkin REQUIRED COMPONENTS
1010
pcl_ros
1111
pcl_conversions
1212
roscpp
13-
ouster_client
1413
)
1514

1615
add_message_files(DIRECTORY msg FILES PacketMsg.msg)
@@ -27,7 +26,7 @@ catkin_package(
2726
CATKIN_DEPENDS pcl_ros pcl_conversions roscpp message_runtime std_msgs sensor_msgs
2827
)
2928

30-
add_library(ouster_ros STATIC src/os1_ros.cpp)
29+
add_library(ouster_ros STATIC src/os1_ros.cpp src/os1.cpp)
3130
target_link_libraries(ouster_ros ${catkin_LIBRARIES})
3231
add_dependencies(ouster_ros ${PROJECT_NAME}_gencpp)
3332

File renamed without changes.

ouster_ros/include/ouster_ros/os1_ros.h renamed to include/ouster_ros/os1_ros.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace ouster_ros {
2121
namespace OS1 {
2222

2323
using CloudOS1 = pcl::PointCloud<PointOS1>;
24+
using CloudOS1XYZIR = pcl::PointCloud<PointOS1XYZIR>;
2425
using ns = std::chrono::nanoseconds;
2526

2627
/**
@@ -59,9 +60,13 @@ ns timestamp_of_lidar_packet(const PacketMsg& pm);
5960
/**
6061
* Parse an imu packet message into a ROS imu message
6162
* @param pm packet message populated by read_imu_packet
63+
* @param frame the frame to set in the resulting ROS message
6264
* @returns ROS sensor message with fields populated from the OS1 packet
65+
*
66+
* @note Modified to support custom message frame name
6367
*/
64-
sensor_msgs::Imu packet_to_imu_msg(const PacketMsg& pm);
68+
sensor_msgs::Imu packet_to_imu_msg(const PacketMsg& pm,
69+
const std::string& frame = "os1_imu");
6570

6671
/**
6772
* Accumulate points from a lidar packet message into a PCL point cloud. All
@@ -108,5 +113,19 @@ void spin(const ouster::OS1::client& cli,
108113
*/
109114
std::function<void(const PacketMsg&)> batch_packets(
110115
ns scan_dur, const std::function<void(ns, const CloudOS1&)>& f);
116+
117+
/**
118+
* Define the pointcloud type to use
119+
* @param mode_xyzir to publish PointXYZIR point cloud type (when true), or the native PointOS1 (when false)
120+
*
121+
* @note This function was added to support velodyne compatible mode.
122+
*/
123+
void set_point_mode(bool mode_xyzir);
124+
125+
/**
126+
* Converts the OS1 native point format to XYZIR (Velodyne like)
127+
*/
128+
void convert2XYZIR(const CloudOS1& in, CloudOS1XYZIR& out);
129+
111130
}
112131
}

ouster_ros/include/ouster_ros/point_os1.h renamed to include/ouster_ros/point_os1.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ struct EIGEN_ALIGN16 PointOS1 {
1313
uint8_t ring;
1414
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1515
};
16+
17+
struct EIGEN_ALIGN16 PointOS1XYZIR {
18+
PCL_ADD_POINT4D; // quad-word XYZ
19+
float intensity; ///< laser intensity reading
20+
uint16_t ring; ///< laser ring number
21+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // ensure proper alignment
22+
};
1623
}
1724
}
1825

@@ -26,3 +33,11 @@ POINT_CLOUD_REGISTER_POINT_STRUCT(ouster_ros::OS1::PointOS1,
2633
(uint8_t, ring, ring)
2734
)
2835

36+
POINT_CLOUD_REGISTER_POINT_STRUCT(ouster_ros::OS1::PointOS1XYZIR,
37+
(float, x, x)
38+
(float, y, y)
39+
(float, z, z)
40+
(float, intensity, intensity)
41+
(uint16_t, ring, ring)
42+
)
43+

launch/os1.launch

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- -*- mode: XML -*- -->
2+
<!-- start Ouster OS1 driver -->
3+
4+
<launch>
5+
6+
<arg name="lidar_address" default="192.168.2.105" doc="hostname or IP address in dotted decimal form of the Ouster sensor"/>
7+
<arg name="pc_address" default="192.168.2.1" doc="hostname or IP address of the computer (PC) where the sensor will send data packets"/>
8+
<arg name="lidar_port" default="7502" doc="port to which the sensor should send lidar data"/>
9+
<arg name="imu_port" default="7503" doc="port to which the sensor should send imu data"/>
10+
<arg name="replay" default="false" doc="when true, the node will listen on ~/lidar_packets and ~/imu_packets for data instead of attempting to connect to a sensor"/>
11+
<arg name="scan_dur_ns" default="100000000" doc="nanoseconds to batch lidar packets before publishing a cloud"/>
12+
<arg name="mode_xyzir" default="true" doc="Point cloud mode, either XYZIR (velodyne compatible) on true, or the default for PointOS1 on false"/>
13+
<arg name="lidar_frame_name" default="velodyne" doc="Frame name for lidar output message"/>
14+
<arg name="imu_frame_name" default="imu" doc="Frame name for IMU output message"/>
15+
16+
<node pkg="ouster_ros" type="os1_node" name="os1_node" output="log" >
17+
<param name="os1_lidar_address" value="$(arg lidar_address)"/>
18+
<param name="pc_address" value="$(arg pc_address)"/>
19+
<param name="os1_lidar_port" value="$(arg lidar_port)"/>
20+
<param name="os1_imu_port" value="$(arg imu_port)"/>
21+
<param name="replay" value="$(arg replay)"/>
22+
<param name="scan_dur_ns" value="$(arg scan_dur_ns)"/>
23+
<param name="points_topic_name" value="/points_raw"/>
24+
<param name="imu_topic_name" value="/imu_raw"/>
25+
<param name="lidar_frame_name" value="$(arg lidar_frame_name)"/>
26+
<param name="imu_frame_name" value="$(arg imu_frame_name)"/>
27+
<param name="mode_xyzir" value="$(arg mode_xyzir)"/>
28+
</node>
29+
30+
</launch>
File renamed without changes.

ouster_client/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)