Skip to content

Commit 16be797

Browse files
authored
[velodyne_pointcloud] add_two_pt scripts (#473)
* [velodyne_pointcloud] add_two_pt scripts see issues: #109 #295 and commit: f30d687 * [velodyne_pointcloud] gen_calibration: add two_pt see issues: #109 #295 and commit: f30d687 * [velodyne_pointcloud] add two_pt in params/64e_* * [velodyne_pointcloud] update test_calibration
1 parent 08a792d commit 16be797

File tree

6 files changed

+2274
-730
lines changed

6 files changed

+2274
-730
lines changed

velodyne_pointcloud/params/64e_s2.1-sztaki.yaml

+751-244
Large diffs are not rendered by default.

velodyne_pointcloud/params/64e_s3-xiesc.yaml

100755100644
+723-225
Large diffs are not rendered by default.

velodyne_pointcloud/params/64e_utexas.yaml

+770-257
Large diffs are not rendered by default.
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/python
2+
"""
3+
usage: add_two_pt.py < calibration.yaml > calibration_two_pt.yaml
4+
5+
In order to take into acount *HDL-64* correction_{x,y}, related to 2012 merge:
6+
https://github.com/ros-drivers/velodyne/commit/f30d68735c47312aa73d29203ddb16abc01357f4
7+
8+
https://github.com/ros-drivers/velodyne/blob/master/velodyne_pointcloud/src/lib/rawdata.cc#L438
9+
https://github.com/ros-drivers/velodyne/blob/master/velodyne_pointcloud/src/lib/calibration.cc#L70
10+
"""
11+
import sys
12+
import yaml
13+
14+
calibration = yaml.safe_load(sys.stdin)
15+
for laser in calibration['lasers']:
16+
laser['two_pt_correction_available'] = True
17+
18+
print(yaml.safe_dump(calibration))

velodyne_pointcloud/scripts/gen_calibration.py

+8
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ def addLaserCalibration(laser_num, key, val):
199199
# TODO: make sure all required fields are present.
200200
# (Which ones are required?)
201201

202+
203+
# fix #473 : take into acount HDL-64 correction_{x,y}, related to:
204+
# commit/f30d68735c47312aa73d29203ddb16abc01357f4
205+
for laser in calibration['lasers']:
206+
if laser.get('dist_correction_x', 0) and laser.get('dist_correction_y', 0):
207+
laser['two_pt_correction_available'] = True
208+
209+
202210
if calibrationGood:
203211

204212
# write calibration data to YAML file

velodyne_pointcloud/tests/test_calibration.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ TEST(Calibration, hdl64e)
110110

111111
// check some values for the first laser:
112112
LaserCorrection laser = calibration.laser_corrections[0];
113-
EXPECT_FALSE(laser.two_pt_correction_available);
113+
EXPECT_TRUE(laser.two_pt_correction_available);
114114
EXPECT_FLOAT_EQ(laser.vert_correction, -0.124932751059532);
115115
EXPECT_FLOAT_EQ(laser.horiz_offset_correction, 0.0);
116116
EXPECT_EQ(laser.max_intensity, 255);
117117
EXPECT_EQ(laser.min_intensity, 0);
118118

119119
// check similar values for the last laser:
120120
laser = calibration.laser_corrections[63];
121-
EXPECT_FALSE(laser.two_pt_correction_available);
121+
EXPECT_TRUE(laser.two_pt_correction_available);
122122
EXPECT_FLOAT_EQ(laser.vert_correction, -0.209881335496902);
123123
EXPECT_FLOAT_EQ(laser.horiz_offset_correction, 0.0);
124124
EXPECT_EQ(laser.max_intensity, 255);
@@ -134,15 +134,15 @@ TEST(Calibration, hdl64e_s21)
134134

135135
// check some values for the first laser:
136136
LaserCorrection laser = calibration.laser_corrections[0];
137-
EXPECT_FALSE(laser.two_pt_correction_available);
137+
EXPECT_TRUE(laser.two_pt_correction_available);
138138
EXPECT_FLOAT_EQ(laser.vert_correction, -0.15304134919741974);
139139
EXPECT_FLOAT_EQ(laser.horiz_offset_correction, 0.025999999);
140140
EXPECT_EQ(laser.max_intensity, 235);
141141
EXPECT_EQ(laser.min_intensity, 30);
142142

143143
// check similar values for the last laser:
144144
laser = calibration.laser_corrections[63];
145-
EXPECT_FALSE(laser.two_pt_correction_available);
145+
EXPECT_TRUE(laser.two_pt_correction_available);
146146
EXPECT_FLOAT_EQ(laser.vert_correction, -0.2106649408137298);
147147
EXPECT_FLOAT_EQ(laser.horiz_offset_correction, -0.025999999);
148148
EXPECT_EQ(laser.max_intensity, 255);

0 commit comments

Comments
 (0)