Skip to content

Commit

Permalink
Squashed 'ros/src/sensing/drivers/lidar/packages/velodyne/' changes f…
Browse files Browse the repository at this point in the history
…rom 776a358..1a70413

1a70413 Merge branch 'master' into Autoware
7976d12 support vlp32c now
273520e Added hdl32c, fixed naming
e21b522 Merge pull request #146 from stsundermann/patch-2
0e5a200 Merge pull request #150 from ros-drivers/mikaelarguedas-patch-1
db6b5ee update to use non deprecated pluginlib macro
560fe12 Use std::abs instead of fabsf

git-subtree-dir: ros/src/sensing/drivers/lidar/packages/velodyne
git-subtree-split: 1a704135c529c5d2995cd2c1972ca4f59d5ae1ad
  • Loading branch information
amc-nu committed Mar 19, 2018
1 parent c864b66 commit e046967
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 8 deletions.
2 changes: 1 addition & 1 deletion velodyne_driver/src/driver/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ VelodyneDriver::VelodyneDriver(ros::NodeHandle node,
}
else if (config_.model == "32C")
{
packet_rate = 1808.0;
packet_rate = 1507.0;
model_full_name = std::string("VLP-") + config_.model;
}
else if (config_.model == "VLP16")
Expand Down
2 changes: 1 addition & 1 deletion velodyne_laserscan/src/VelodyneLaserScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void VelodyneLaserScan::recvCallback(const sensor_msgs::PointCloud2ConstPtr& msg

// Construct LaserScan message
if ((offset_x >= 0) && (offset_y >= 0) && (offset_r >= 0)) {
const float RESOLUTION = fabsf(cfg_.resolution);
const float RESOLUTION = std::abs(cfg_.resolution);
const size_t SIZE = 2.0 * M_PI / RESOLUTION;
sensor_msgs::LaserScanPtr scan(new sensor_msgs::LaserScan());
scan->header = msg->header;
Expand Down
2 changes: 1 addition & 1 deletion velodyne_laserscan/src/nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class LaserScanNodelet: public nodelet::Nodelet

}

PLUGINLIB_DECLARE_CLASS(velodyne_laserscan, LaserScanNodelet, velodyne_laserscan::LaserScanNodelet, nodelet::Nodelet);
PLUGINLIB_EXPORT_CLASS(velodyne_laserscan::LaserScanNodelet, nodelet::Nodelet);
2 changes: 1 addition & 1 deletion velodyne_pointcloud/include/velodyne_pointcloud/rawdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace velodyne_rawdata
*/
int setupOffline(std::string calibration_file, double max_range_, double min_range_);

void unpack(const velodyne_msgs::VelodynePacket &pkt, VPointCloud &pc);
void unpack(const velodyne_msgs::VelodynePacket &pkt, VPointCloud &pc, int packets_num);

void setParameters(double min_range, double max_range, double view_direction,
double view_width);
Expand Down
28 changes: 28 additions & 0 deletions velodyne_pointcloud/launch/32c_points.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- -*- mode: XML -*- -->
<!-- run velodyne_pointcloud/CloudNodelet in a nodelet manager for an HDL-32E
arg: calibration = path to calibration file (default: standard 32db.yaml)
pcap = path to packet capture file (default: use real device)
$Id$
-->

<launch>
<remap from="velodyne_points" to="points_raw"/>

<!-- declare arguments with default values -->
<arg name="pcap" default="" />
<arg name="calibration" default="$(find velodyne_pointcloud)/params/32c-db.yaml"/>

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
</include>

</launch>
53 changes: 53 additions & 0 deletions velodyne_pointcloud/launch/velodyne_hdl32c.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!-- -*- mode: XML -*- -->
<!-- run velodyne_pointcloud/CloudNodelet in a nodelet manager for an VLP-32C -->

<launch>

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VeloView-VLP-32C.yaml"/>
<arg name="device_ip" default="" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2368" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<arg name="laserscan_ring" default="-1" />
<arg name="laserscan_resolution" default="0.007" />
<arg name="topic_name" default="points_raw"/>

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
<remap from="velodyne_points" to="$(arg topic_name)"/>
</include>

<!-- start laserscan nodelet -->
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include>

</launch>
98 changes: 98 additions & 0 deletions velodyne_pointcloud/params/32c-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
lasers:
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 0, rot_correction: -0.024434609527920613,
vert_correction: -0.4363323129985824, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 1, rot_correction: 0.07330382858376185,
vert_correction: -0.017453292519943295, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 2, rot_correction: -0.024434609527920613,
vert_correction: -0.029094638630745476, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 3, rot_correction: 0.024434609527920613,
vert_correction: -0.2729520417193932, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 4, rot_correction: -0.024434609527920613,
vert_correction: -0.19739673840055869, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 5, rot_correction: 0.024434609527920613,
vert_correction: 0.0, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 6, rot_correction: -0.07330382858376185,
vert_correction: -0.011641346110802179, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 7, rot_correction: 0.024434609527920613,
vert_correction: -0.15433946575385857, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 8, rot_correction: -0.024434609527920613,
vert_correction: -0.12660618393966866, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 9, rot_correction: 0.07330382858376185,
vert_correction: 0.005811946409141118, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 10, rot_correction: -0.024434609527920613,
vert_correction: -0.005811946409141118, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 11, rot_correction: 0.024434609527920613,
vert_correction: -0.10730284241261137, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 12, rot_correction: -0.07330382858376185,
vert_correction: -0.0930784090088576, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 13, rot_correction: 0.024434609527920613,
vert_correction: 0.02326523892908441, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 14, rot_correction: -0.07330382858376185,
vert_correction: 0.011641346110802179, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 15, rot_correction: 0.024434609527920613,
vert_correction: -0.06981317007977318, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 16, rot_correction: -0.024434609527920613,
vert_correction: -0.08145451619057535, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 17, rot_correction: 0.07330382858376185,
vert_correction: 0.029094638630745476, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 18, rot_correction: -0.024434609527920613,
vert_correction: 0.017453292519943295, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 19, rot_correction: 0.07330382858376185,
vert_correction: -0.06400122367063206, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 20, rot_correction: -0.07330382858376185,
vert_correction: -0.058171823968971005, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 21, rot_correction: 0.024434609527920613,
vert_correction: 0.058171823968971005, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 22, rot_correction: -0.024434609527920613,
vert_correction: 0.04071853144902771, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 23, rot_correction: 0.024434609527920613,
vert_correction: -0.04654793115068877, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 24, rot_correction: -0.024434609527920613,
vert_correction: -0.05235987755982989, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 25, rot_correction: 0.024434609527920613,
vert_correction: 0.12217304763960307, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 26, rot_correction: -0.024434609527920613,
vert_correction: 0.08145451619057535, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 27, rot_correction: 0.07330382858376185,
vert_correction: -0.04071853144902771, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 28, rot_correction: -0.07330382858376185,
vert_correction: -0.03490658503988659, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 29, rot_correction: 0.024434609527920613,
vert_correction: 0.2617993877991494, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 30, rot_correction: -0.024434609527920613,
vert_correction: 0.18034487160857407, vert_offset_correction: 0.0}
- {dist_correction: 0.0, dist_correction_x: 0.0, dist_correction_y: 0.0, focal_distance: 0.0,
focal_slope: 0.0, horiz_offset_correction: 0.0, laser_id: 31, rot_correction: 0.024434609527920613,
vert_correction: -0.02326523892908441, vert_offset_correction: 0.0}
num_lasers: 32
2 changes: 1 addition & 1 deletion velodyne_pointcloud/src/conversions/convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace velodyne_pointcloud
// process each packet provided by the driver
for (size_t i = 0; i < scanMsg->packets.size(); ++i)
{
data_->unpack(scanMsg->packets[i], *outMsg);
data_->unpack(scanMsg->packets[i], *outMsg, scanMsg->packets.size());
}

// publish the accumulated cloud message
Expand Down
2 changes: 1 addition & 1 deletion velodyne_pointcloud/src/conversions/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace velodyne_pointcloud
pcl_conversions::toPCL(header, inPc_.header);

// unpack the raw data
data_->unpack(scanMsg->packets[next], inPc_);
data_->unpack(scanMsg->packets[next], inPc_, scanMsg->packets.size());

// clear transform point cloud for this packet
tfPc_.points.clear(); // is this needed?
Expand Down
10 changes: 8 additions & 2 deletions velodyne_pointcloud/src/lib/rawdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace velodyne_rawdata
* @param pc shared pointer to point cloud (points are appended)
*/
void RawData::unpack(const velodyne_msgs::VelodynePacket &pkt,
VPointCloud &pc)
VPointCloud &pc, int packets_num)
{
ROS_DEBUG_STREAM("Received packet, time: " << pkt.stamp);

Expand Down Expand Up @@ -190,7 +190,13 @@ namespace velodyne_rawdata
||(config_.min_angle > config_.max_angle
&& (raw->blocks[i].rotation <= config_.max_angle
|| raw->blocks[i].rotation >= config_.min_angle))){
float distance = tmp.uint * DISTANCE_RESOLUTION;

float distance;
if (packets_num==(int) ceil(1507.0 / 10))
distance = tmp.uint * DISTANCE_RESOLUTION * 2;
else
distance = tmp.uint * DISTANCE_RESOLUTION;

distance += corrections.dist_correction;

float cos_vert_angle = corrections.cos_vert_correction;
Expand Down

0 comments on commit e046967

Please sign in to comment.