drand48随机数
uniformPoseGenerator函数中,按均匀分布在地图上随机生成一个位姿。
unsigned int rand_index = drand48() * free_space_indices.size(); //均匀采样drand48(),随机找到一个像素点的序号 std::pair<int,int> free_point = free_space_indices[rand_index]; pf_vector_t p; p.v[0] = MAP_WXGX(map, free_point.first); //地图像素点转换成世界坐标系下的位姿 p.v[1] = MAP_WYGY(map, free_point.second); // Convert from map index to world coords p.v[2] = drand48() * 2 * M_PI - M_PI; //0-180角度均匀采样
drand48 返回服从均匀分布的·[0.0, 1.0) 之间的 double 型随机数。
作者:水水滴答
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。