types_declaration.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
32 #ifndef _TYPES_DECLARATION_H_
33 #define _TYPES_DECLARATION_H_
34 
35 #include <iostream>
36 #include <iomanip>
37 #include <boost/shared_ptr.hpp>
38 #include <boost/bind.hpp>
39 #include <vector>
40 
41 #include <ros/ros.h>
42 #include <opencv/cv.h>
43 #include <opencv/cxcore.h>
44 #include <opencv/cxcore.hpp>
45 
46 #include <pcl/point_cloud.h>
47 #include <pcl/point_types.h>
48 
49 #define deg2rad(a) (a*M_PI/180.)
50 #define rad2deg(a) (a*180./M_PI)
51 
52 using namespace std;
53 using namespace boost;
54 
55 typedef struct
56 {
57  double theta;
58  CvSeq*range;
59  CvMemStorage*range_storage;
61 
62 typedef struct
63 {
65  double minimum_delta;
67  int num_rays;
68  double x,y,t;//pose of this scan
69  double timestamp;//timestamp of this scan
71 
72 typedef struct
73 {
77 
78 typedef struct
79 {
80  CvSeq*data;
81  CvMemStorage*data_storage;
83 
84 typedef struct
85 {
86  double fps[100];
87  unsigned int position;
88  unsigned int current_size;
89 }t_fps;
90 
94 typedef struct
95 {
97  bool fp_s;
99  bool fi;
101  bool raw_only;
102 }t_flag;
103 
104 typedef struct s_pose
105 {
107  {
108  x=0;
109  y=0;
110  phi=0;
111  orientation=0;
112  vl=0;
113  vr=0;
114  m_phi=0;
115  m_vl=0;
116  timestamp=0;
117  }
118 
119  double x, y, phi;
120 
121  double orientation;
122  double vl,vr;
123 
124  double m_phi,m_vl;
125 
126  double timestamp;
127 
128  friend ostream& operator<< (ostream &o, const s_pose &i)
129  {
130  return o << setprecision(4) << fixed
131  <<i.x<<" "<<i.y<<" "<<i.phi<<" "<<i.orientation<<" "<<i.vl<<" "<<0/*i.vr*/<<" "<<i.m_phi<<" "<<i.m_vl<<" "<<i.timestamp;
132  }
133 
134 } t_pose;
135 
136 typedef boost::shared_ptr<t_pose> t_posePtr;
137 
138 double max_orientation(const std::vector<t_posePtr>& vec);
139 double min_orientation(const std::vector<t_posePtr>& vec);
140 double max_x(const std::vector<t_posePtr>& vec);
141 double min_x(const std::vector<t_posePtr>& vec);
142 double max_y(const std::vector<t_posePtr>& vec);
143 double min_y(const std::vector<t_posePtr>& vec);
144 
145 double get_m_phi(t_pose&i);
146 double get_m_vl(t_pose&i);
147 double get_phi(t_pose&i);
148 double get_orientation(t_pose&i);
149 
150 double get_vl(t_pose&i);
151 
152 void ClearRays(ray_measurment_t*rays,ray_config_t*ray_config);
153 void ClearRays(ray_definition*src);
154 int Theta2Index(double theta,ray_config_t*config);
157 void Pointcloud2Rays(pcl::PointCloud<pcl::PointXYZ>& point_cloud,ray_config_t*config,ray_measurment_t*rays);
158 void PointCloud2Ray(pcl::PointCloud<pcl::PointXYZ>& point_cloud,ray_definition*dst);
162 double get_fps(double dt,t_fps*acc);
165 
166 #endif
void InitRayHistory(ray_history *h_rays)
void AddToHistory(ray_definition *rays, ray_history *h_rays)
double get_m_vl(t_pose &i)
double max_orientation(const std::vector< t_posePtr > &vec)
double get_vl(t_pose &i)
double max_y(const std::vector< t_posePtr > &vec)
double orientation
unsigned int position
double get_m_phi(t_pose &i)
unsigned int current_size
double get_orientation(t_pose &i)
void CopyRays(ray_config_t *cfg, ray_measurment_t *src, ray_measurment_t *dst)
bool fi
first scan
ray_measurment_t * dt
struct s_pose t_pose
int Theta2Index(double theta, ray_config_t *config)
boost::shared_ptr< t_pose > t_posePtr
double min_y(const std::vector< t_posePtr > &vec)
double angular_resolution
double get_fps(double dt, t_fps *acc)
bool raw_only
display raw only
void PointCloud2Ray(pcl::PointCloud< pcl::PointXYZ > &point_cloud, ray_definition *dst)
void Pointcloud2Rays(pcl::PointCloud< pcl::PointXYZ > &point_cloud, ray_config_t *config, ray_measurment_t *rays)
double get_phi(t_pose &i)
double timestamp
ray_config_t cfg
double min_orientation(const std::vector< t_posePtr > &vec)
double max_x(const std::vector< t_posePtr > &vec)
ray_history h_rays
void InitRayDefinition(ray_definition *src)
void ClearRays(ray_measurment_t *rays, ray_config_t *ray_config)
CvMemStorage * data_storage
double m_phi
void RemoveOverlappingPoints(ray_config_t *config, ray_measurment_t *rays)
This structure contains global flags parameters.
CvMemStorage * range_storage
bool fp_s
first point of the scan
double min_x(const std::vector< t_posePtr > &vec)


lidar_egomotion
Author(s): Jorge Almeida
autogenerated on Mon Mar 2 2015 01:32:10