2016-06-21 67 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