61 if(vec.empty())
return 0;
63 double max= vec[0]->orientation;
64 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
65 if((*i)->orientation > max)
66 max = (*i)->orientation;
73 if(vec.empty())
return 0;
75 double min= vec[0]->orientation;
76 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
77 if((*i)->orientation < min)
78 min = (*i)->orientation;
83 double max_x(
const std::vector<t_posePtr>& vec)
85 if(vec.empty())
return 0;
87 double max = vec[0]->x;
88 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
95 double min_x(
const std::vector<t_posePtr>& vec)
97 if(vec.empty())
return 0;
99 double min = vec[0]->x;
100 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
107 double max_y(
const std::vector<t_posePtr>& vec)
109 if(vec.empty())
return 0;
111 double max = vec[0]->y;
112 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
119 double min_y(
const std::vector<t_posePtr>& vec)
121 if(vec.empty())
return 0;
123 double min = vec[0]->y;
124 for(std::vector<t_posePtr>::const_iterator i = vec.begin(); i != vec.end(); ++i)
140 if(rays[i].range->total<2)
143 for(
int e=1;e<rays[i].
range->total;e++)
145 range_l=(
double*)cvGetSeqElem(rays[i].range,e-1);
146 range_n=(
double*)cvGetSeqElem(rays[i].range,e);
148 diff=fabs(*range_l-*range_n);
150 if(diff<config->minimum_delta)
152 *range_n=(*range_l+*range_n)/2;
153 cvSeqRemove(rays[i].range,e);
164 printf(
"Watch out for memory allocation, null pointer in %s\n",__FUNCTION__);
183 double theta,range,*rg;
188 printf(
"PCL timestamp not correct, error during migration lar3 to lar4\n");
192 for(uint i=0;i<point_cloud.points.size();i++)
194 theta=atan2(point_cloud.points[i].y,point_cloud.points[i].x);
198 range=sqrt(pow(point_cloud.points[i].x,2)+pow(point_cloud.points[i].y,2));
207 printf(
"Error!, index outside grid, maybe you didn't initialized the ray config\n");
211 for(e=0;e<rays[ix].
range->total;e++)
213 rg=(
double*)cvGetSeqElem(rays[ix].range,e);
219 cvSeqInsert(rays[ix].range,e,&range);
227 printf(
"Wrong pointer, be carefull with memory allocation!\n");
239 for(
int i=0;i<ray_config->
num_rays;i++)
240 cvClearSeq(rays[i].range);
247 printf(
"Watch out for memory allocation, null pointer in %s\n",__FUNCTION__);
279 printf(
"Watch out for memory allocation, null pointer in %s\n",__FUNCTION__);
298 for(
int e=0;e<src[i].
range->total;e++)
300 range=(
double*)cvGetSeqElem(src[i].range,e);
301 cvSeqInsert(dst[i].range,e,range);
320 cvSeqPushFront(h_rays->
data,&rays);
322 if(h_rays->
data->total>50)
329 cvSeqPop(h_rays->
data);
335 static bool initialise=TRUE;
336 static unsigned int max_size=30;
340 memset(acc->
fps,0,max_size*
sizeof(
double));
359 mean_fps+=acc->
fps[i];
double get_orientation(t_pose &i)
double min_y(const std::vector< t_posePtr > &vec)
double max_orientation(const std::vector< t_posePtr > &vec)
unsigned int current_size
int Theta2Index(double theta, ray_config_t *config)
double get_phi(t_pose &i)
void ClearRays(ray_measurment_t *rays, ray_config_t *ray_config)
double get_m_phi(t_pose &i)
Generic types declaration for use in the lidar_egomotion algorithm.
double angular_resolution
void RemoveOverlappingPoints(ray_config_t *config, ray_measurment_t *rays)
double max_y(const std::vector< t_posePtr > &vec)
void CopyRays(ray_definition *src, ray_definition *dst)
double get_fps(double dt, t_fps *acc)
double get_m_vl(t_pose &i)
void InitRayDefinition(ray_definition *src)
void PointCloud2Ray(pcl::PointCloud< pcl::PointXYZ > &point_cloud, ray_definition *dst)
void AddToHistory(ray_definition *src, ray_history *h_rays)
void InitRayHistory(ray_history *h_rays)
CvMemStorage * data_storage
double min_orientation(const std::vector< t_posePtr > &vec)
void Pointcloud2Rays(pcl::PointCloud< pcl::PointXYZ > &point_cloud, ray_config_t *config, ray_measurment_t *rays)
double min_x(const std::vector< t_posePtr > &vec)
CvMemStorage * range_storage
double max_x(const std::vector< t_posePtr > &vec)