天天看点

【ROS-数据格式】 csm 的数据格式CSM的数据格式

整理翻译ROS中csm的数据格式,包括结构体sm_params和sm_result,翻译和理解水平有限,有问题可以指出留言,我们一起进步!

  • CSM的数据格式

CSM的数据格式

#ifndef H_SCAN_MATCHING_LIB
#define H_SCAN_MATCHING_LIB

#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include "hsm/hsm.h"
#include "hsm/hsm_interface.h"
#include "laser_data.h"


struct sm_params {

	/** First scan ("ref"erence scan) */
	//第一个雷达数据
	LDP laser_ref;
	
	/** Second scan ("sens"or scan) */
	//第二个雷达数据
	LDP laser_sens;

	/** Where to start */
	//位姿的预测值多少.设置为0 就是不预测
 	double first_guess[3]; 

	/** Maximum angular displacement between scans (deg)*/
	//扫描之间的最大角位移(度)
	double max_angular_correction_deg;
	
	/** Maximum translation between scans (m) */
	//扫描之间的最大平移(米)
	double max_linear_correction;

	/** When to stop */
	//最大迭代次数
	int max_iterations;
	
	/** A threshold for stopping. */
	//停止阈值xy
	double epsilon_xy;
	
	/** A threshold for stopping. */
	//停止阈值角度
	double epsilon_theta;
	
	/** Maximum distance for a correspondence to be valid */
	//通信有效的最大距离
	double max_correspondence_dist;
	
	/** Use smart tricks for finding correspondences. Only influences speed; not convergence. */
	//用一些聪明的技巧来寻找通信,只影响速度;不收敛,这里是直译,暂时未能明白!
	int use_corr_tricks;
	
	/** Restart if error under threshold (0 or 1)*/
	//如果错误低于阈值则重新启动
	int restart;
	
		/** Threshold for restarting */
		//重新启动的阈值
		double restart_threshold_mean_error;
		
		/** Displacement for restarting */
		//重新启动的位移
		double restart_dt;
		
		/** Displacement for restarting */
		//重新启动的角度
		double restart_dtheta;
	

	/* Functions concerning discarding correspondences.
	   THESE ARE MAGIC NUMBERS -- and they need to be tuned. */
	//有关舍弃通信的功能-这些都是神奇的数字,需要调整的
	
	/** Percentage of correspondences to consider: if 0.9,
	    always discard the top 10% of correspondences with more error */
	//要考虑的通信比例:如果是0.9,则总是舍弃更大的前10%的通信
	double outliers_maxPerc;

	/** Parameters describing a simple adaptive algorithm for discarding.
	描述一个简单的自适应舍弃算法的参数。
	
	    1) Order the errors.
		2) Choose the percentile according to outliers_adaptive_order.
		   (if it is 0.7, get the 70% percentile)
		3) Define an adaptive threshold multiplying outliers_adaptive_mult with the value of the error at the chosen percentile.
		4) Discard correspondences over the threshold.
		1)排序错误。
		2)根据outliers_adaptive_order选择百分比。
(如果是0.7,选70%)
		3)将outliers_adaptive_mult与所选百分比的错误值相乘,定义一个自适应阈值。
		4)丢弃超过阈值的通信。
		
		This is useful to be conservative; yet remove the biggest errors.
		保守一点是有用的;移除最大的错误。
	*/
		double outliers_adaptive_order; /* 0.7 */
		double outliers_adaptive_mult; /* 2 */

	/** Do not allow two different correspondences to share a point */
	//不要让两个不同的通信者分享一个点
	//激光传感器中没有两个点具有相同的通信
	int outliers_remove_doubles; 


	
	/* Functions that compute and use point orientation for defining matches. */
	//计算和使用点方向来定义匹配的函数。

		/** For now, a very simple max-distance clustering algorithm is used */
		//目前使用的是一种非常简单的最大距离聚类算法
		double clustering_threshold;
		
		/** Number of neighbour rays used to estimate the orientation.*/
		//用来估计方向的邻射线的数目。
		int orientation_neighbourhood;
		
		/** Discard correspondences based on the angles */
		//根据角度丢弃通信
		int do_alpha_test;
		double do_alpha_test_thresholdDeg;
		
		
	/** I believe this trick is documented in one of the papers by Guttman (but I can't find the reference). Or perhaps I was told by him directly. 
		我相信这个技巧在Guttman的一篇论文中有记载(但我找不到)
参考)。也许是他直接告诉我的。

		If you already have a guess of the solution, you can compute the polar angle of the points of one scan in the new position. If the polar angle is not a monotone function of the readings index, it means that the surface is not visible in the  next position. If it is not visible, then we don't use it for matching.
		如果你已经猜出了答案,你可以计算出在新位置的一个扫描点的极角。如果极角不是读数指数的单调函数,则意味着表面在下一个位置不可见。如果它是不可见的,那么我们就不使用它来匹配。
		This is confusing without a picture! To understand what's going on, make a drawing in which a surface is not visible in one of the poses.
		没有照片是很混乱的!为了理解发生了什么,绘制一个在某个姿势中不可见的表面。
	  	Implemented in the function visibilityTest().
	  	在函数visibilityTest()中实现。
	*/	
	int do_visibility_test;

	/** If 1, use PlICP; if 0, use vanilla ICP. */
	//如1,使用PlICP;如果为0,使用vanilla ICP。
	int use_point_to_line_distance;

	/** If 1, the field "true_alpha" is used to compute the incidence beta, and the factor (1/cos^2(beta)) used to weight the impact of each correspondence. This works fabolously if doing localization, that is the first scan has no noise.
	如果是1,则使用字段“true_alpha”来计算关联beta,使用因子(1/cos^2(beta))来衡量每个对应的影响。这在进行定位时非常有效,因为第一次扫描没有噪声。
		If "true_alpha" is not available, it uses "alpha".
		如果“true_alpha”不可用,则使用“alpha”。
	*/
	int use_ml_weights;
	
	/* If 1, the field "readings_sigma" is used to weight the correspondence by 1/sigma^2 */
	//如果是1,“readings_sigma”字段用于对应的权重为1/sigma^2
	int use_sigma_weights;
	
	/** Use the method in http://purl.org/censi/2006/icpcov to compute the matching covariance. */
	//使用http://purl.org/censi/2006/icpcov中的方法计算匹配协方差。
	int do_compute_covariance;

	/** Checks that find_correspondences_tricks give the right answer */
	//检查find_correspondence es_tricks给出的答案是否正确
	int debug_verify_tricks;
	
	/** Pose of sensor with respect to robot: used for computing the first estimate given the odometry. */
	//传感器相对于机器人的姿态:用于计算给定里程计的第一个估计。
	double laser[3]; 

	/** Noise in the scan */
	//扫描噪声
	double sigma;

	/** mark as invalid ( = don't use ) rays outside of this interval */
	//标记为无效(=不要使用)射线以外的这个间隔
	double min_reading, max_reading;
	
	/* Parameters specific to GPM (unfinished :-/ ) */
	//GPM参数(未完成:-/)
	double gpm_theta_bin_size_deg;
	double gpm_extend_range_deg; 
	int gpm_interval;
	/* Parameter specific to HSM (unfinished :-/ ) */
	//HSM专用参数(未完成:-/)
	struct hsm_params hsm;
};


struct sm_result {
	/** 1 if the result is valid */
	//如果结果有效
	int valid;
	
	/** Scan matching result (x,y,theta) */
	//扫描匹配结果(x,y,theta)
	double x[3];
	
	/** Number of iterations done */
	//迭代次数
	int iterations;
	/** Number of valid correspondence in the end */
	//最终有效通信的数量
	int nvalid;
	/** Total correspondence error */
	//总通信错误
	double error;
	
	/** Fields used for covariance computation */
	//用于协方差计算的字段
	#ifndef RUBY
		gsl_matrix *cov_x_m;	
		gsl_matrix *dx_dy1_m;
		gsl_matrix *dx_dy2_m;
	#endif
};


void sm_icp(struct sm_params*input, struct sm_result*output);
void sm_icp_xy(struct sm_params*input, struct sm_result*output);
void sm_gpm(struct sm_params*input, struct sm_result*output);
void sm_hsm(struct sm_params*input, struct sm_result*output);

/* Unfinished, untested :-/ */
void sm_mbcip(struct sm_params*input, struct sm_result*output);



void sm_journal_open(const char* file);

#endif

};