2016-06-21 69 views
0

我正在尝试读取激光扫描数据,然后使用它来构建环境的地图 。在mrpt中读取外部2D激光扫描数据

我的问题是,我不明白数据必须提供给CObservation2DRangeScan对象的格式。

我已经试过:

X,Y,X,Y,... 
Y,X,Y,X,... 
X,X,Y,Y,... 
Y,Y,X,X,... 

我把数据写入一个rawlog文件,然后看看它在rawlog观众。 我使用[1,1],并且该点出现在X = -1和Y = 0。这是为什么?

下面是从rawlog观众

Timestamp (UTC): 2016/06/21,07:22:42.166880 
(as time_t): 1466493762.16688 
(as TTimestamp): 131109673621668800 
Sensor label: '' 

Homogeneous matrix for the sensor's 3D pose, relative to robot base: 
1.00000 0.00000 0.00000 0.00000 
0.00000 1.00000 0.00000 0.00000 
0.00000 0.00000 1.00000 0.00000 
0.00000 0.00000 0.00000 1.00000(x,y,z,yaw,pitch,roll) 
(0.0000,0.0000,0.0000,0.00deg,-0.00deg,0.00deg) 
Samples direction: Right->Left 
Points in the scan: 2 
Estimated sensor 'sigma': 0.010000 
Increment in pitch during the scan: 0.000000 deg 
Invalid points in the scan: 0 
Sensor maximum range: 80.00 m 
Sensor field-of-view ("aperture"): 360.0 deg 
Raw scan values: [1.000 1.000 ] 
Raw valid-scan values: [1 1 ] 

这里的数据是我使用的代码:我不完全熟悉MRPT的激光数据类的细节

CSensoryFrame SF; 

CActionCollection actionCol; 

CPose2D actualOdometryReading(0.0f, 0.0f, DEG2RAD(.0f)); 

// Prepare the "options" structure: 
CActionRobotMovement2D      actMov; 
CActionRobotMovement2D::TMotionModelOptions opts; 

opts.modelSelection = CActionRobotMovement2D::mmThrun; 
opts.thrunModel.alfa3_trans_trans = 0.10f; 

// Create the probability density distribution (PDF) from a 2D odometry reading: 
actMov.computeFromOdometry(actualOdometryReading, opts); 

actionCol.insert(actMov); 

CObservation2DRangeScanPtr myObs = CObservation2DRangeScan::Create(); 


myObs->scan = scan; // = [1,0] 
myObs->validRange = vranges; // = [1,1] 
myObs->aperture = 2 * M_PI; 


SF.insert(myObs); 

回答

0

,但使用其他机器人框架,我可以告诉你,激光扫描通常表示为范围值的集合,而不是笛卡尔(x,y)坐标。事实上,referenceCObservation2DRangeScan持有

浮点值的向量与所有的测量范围(以米为单位)。

而且你的程序的输出显示:

Raw scan values: [1.000 1.000 ] 

即两个范围1m的距离进行测量。由于您的传感器配置为具有360度的视场,因此第一次测量的方向与传感器姿态的-180°方向一致。您的传感器朝向+ X方向,因此该激光射线瞄准机器人的“后面”,从而为您提供坐标(-1,0)。第二个(也是最后一个)测量光线朝向+ 180°,给出相同的坐标。

尝试通过1米范围内360度测量的列表,并且您应该看到与圆圈相对应的内容。

+1

那么问题是如何使用点形式的激光扫描数据,而不是范围测量。 – mase

+1

你可能想要使用类似['CSimplePointsMap'](http://reference.mrpt.org/devel/classmrpt_1_1maps_1_1_c_simple_points_map.html)的东西。 – mindriot