os1_ros.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include <chrono>
8 #include <functional>
9 #include <string>
10 
11 #include <pcl/common/common.h>
12 #include <pcl/point_cloud.h>
13 #include <sensor_msgs/Imu.h>
14 #include <sensor_msgs/PointCloud2.h>
15 
16 #include "ouster/os1.h"
17 #include "ouster_driver/PacketMsg.h"
19 
20 namespace ouster_driver {
21 namespace OS1 {
22 
23 using CloudOS1 = pcl::PointCloud<PointOS1>;
24 using CloudOS1XYZ = pcl::PointCloud<pcl::PointXYZ>;
25 using CloudOS1XYZI = pcl::PointCloud<pcl::PointXYZI>;
26 using CloudOS1XYZIR = pcl::PointCloud<PointXYZIR>;
27 using CloudOS1XYZIF = pcl::PointCloud<PointXYZIF>;
28 using CloudOS1XYZIRF = pcl::PointCloud<PointXYZIRF>;
29 using CloudOS1XYZIFN = pcl::PointCloud<PointXYZIFN>;
30 using CloudOS1XYZIRFN = pcl::PointCloud<PointXYZIRFN>;
31 using ns = std::chrono::nanoseconds;
32 
40 bool read_imu_packet(const ouster::OS1::client& cli, PacketMsg& pm);
41 
49 bool read_lidar_packet(const ouster::OS1::client& cli, PacketMsg& pm);
50 
58 
65 
74 sensor_msgs::Imu packet_to_imu_msg(const PacketMsg& pm,
75  const std::string& frame = "os1_imu");
76 
86 void add_packet_to_cloud(ns scan_start_ts, ns scan_duration,
87  const PacketMsg& pm, CloudOS1& cloud);
88 
97 sensor_msgs::PointCloud2 cloud_to_cloud_msg(const CloudOS1& cloud, ns timestamp,
98  const std::string& frame = "os1");
108 void spin(const ouster::OS1::client& cli,
109  const std::function<void(const PacketMsg& pm)>& lidar_handler,
110  const std::function<void(const PacketMsg& pm)>& imu_handler);
111 
120 std::function<void(const PacketMsg&)> batch_packets(
121  ns scan_dur, const std::function<void(ns, const CloudOS1&)>& f);
122 
128 void set_point_mode(std::string mode_xyzir);
129 
133 void convert2XYZ(const CloudOS1& in, CloudOS1XYZ& out);
134 
138 void convert2XYZI(const CloudOS1& in, CloudOS1XYZI& out);
139 
143 void convert2XYZIR(const CloudOS1& in, CloudOS1XYZIR& out);
144 
148 void convert2XYZIF(const CloudOS1& in, CloudOS1XYZIF& out);
149 
153 void convert2XYZIRF(const CloudOS1& in, CloudOS1XYZIRF& out);
154 
158 void convert2XYZIFN(const CloudOS1& in, CloudOS1XYZIFN& out);
159 
163 void convert2XYZIRFN(const CloudOS1& in, CloudOS1XYZIRFN& out);
164 }
165 }
pcl::PointCloud< PointXYZIF > CloudOS1XYZIF
Definition: os1_ros.h:27
bool read_imu_packet(const ouster::OS1::client &cli, PacketMsg &pm)
Definition: os1_ros.cpp:22
pcl::PointCloud< PointXYZIRFN > CloudOS1XYZIRFN
Definition: os1_ros.h:30
pcl::PointCloud< PointOS1 > CloudOS1
Definition: os1_ros.h:23
void convert2XYZIRF(const CloudOS1 &in, CloudOS1XYZIRF &out)
Definition: os1_ros.cpp:274
void convert2XYZIFN(const CloudOS1 &in, CloudOS1XYZIFN &out)
Definition: os1_ros.cpp:292
void convert2XYZ(const CloudOS1 &in, CloudOS1XYZ &out)
Definition: os1_ros.cpp:212
void set_point_mode(std::string mode_xyzir)
Definition: os1_ros.cpp:207
ouster_driver::PacketMsg PacketMsg
Definition: os1_node.cpp:34
pcl::PointCloud< pcl::PointXYZI > CloudOS1XYZI
Definition: os1_ros.h:25
void convert2XYZIR(const CloudOS1 &in, CloudOS1XYZIR &out)
Definition: os1_ros.cpp:240
ns timestamp_of_imu_packet(const PacketMsg &pm)
Definition: os1_ros.cpp:14
ns timestamp_of_lidar_packet(const PacketMsg &pm)
Definition: os1_ros.cpp:18
void spin(const ouster::OS1::client &cli, const std::function< void(const PacketMsg &pm)> &lidar_handler, const std::function< void(const PacketMsg &pm)> &imu_handler)
Definition: os1_ros.cpp:153
std::function< void(const PacketMsg &)> batch_packets(ns scan_dur, const std::function< void(ns, const CloudOS1 &)> &f)
Definition: os1_ros.h:120
std::chrono::nanoseconds ns
Definition: os1_ros.h:31
pcl::PointCloud< PointXYZIR > CloudOS1XYZIR
Definition: os1_ros.h:26
void convert2XYZIF(const CloudOS1 &in, CloudOS1XYZIF &out)
Definition: os1_ros.cpp:257
void convert2XYZI(const CloudOS1 &in, CloudOS1XYZI &out)
Definition: os1_ros.cpp:224
sensor_msgs::Imu packet_to_imu_msg(const PacketMsg &pm, const std::string &frame="os1_imu")
Definition: os1_ros.cpp:32
bool read_lidar_packet(const ouster::OS1::client &cli, PacketMsg &pm)
Definition: os1_ros.cpp:27
pcl::PointCloud< pcl::PointXYZ > CloudOS1XYZ
Definition: os1_ros.h:24
pcl::PointCloud< PointXYZIFN > CloudOS1XYZIFN
Definition: os1_ros.h:29
void add_packet_to_cloud(ns scan_start_ts, ns scan_duration, const PacketMsg &pm, CloudOS1 &cloud)
Definition: os1_ros.cpp:137
void convert2XYZIRFN(const CloudOS1 &in, CloudOS1XYZIRFN &out)
Definition: os1_ros.cpp:310
pcl::PointCloud< PointXYZIRF > CloudOS1XYZIRF
Definition: os1_ros.h:28
sensor_msgs::PointCloud2 cloud_to_cloud_msg(const CloudOS1 &cloud, ns timestamp, const std::string &frame="os1")
Definition: os1_ros.cpp:70


ouster
Author(s): ouster developers
autogenerated on Mon Jun 10 2019 14:16:21