00001 #ifndef _c_trajectory_H_ 00002 #define _c_trajectory_H_ 00003 00012 //INCLUDES 00013 #include <ros/ros.h> 00014 #include <stdio.h> 00015 #include <vector> 00016 #include <math.h> 00017 #include <visualization_msgs/Marker.h> 00018 #include <visualization_msgs/MarkerArray.h> 00019 #include <tf/transform_listener.h> 00020 #include <pcl_ros/transforms.h> 00021 #include <pcl/ros/conversions.h> 00022 #include <pcl/point_cloud.h> 00023 #include <pcl/point_types.h> 00024 #include <pcl/segmentation/extract_polygonal_prism_data.h> 00025 #include <pcl/filters/extract_indices.h> 00026 #include <pcl/filters/project_inliers.h> 00027 #include <pcl/filters/voxel_grid.h> 00028 00029 typedef enum {SUCCESS, FAILURE}t_func_output; 00030 00031 //Defines 00032 #define PFLN printf("FILE %s LINE %d\n",__FILE__, __LINE__); 00033 #define _USE_MATH_DEFINES 00034 #define _TRAJECTORY_LIB_DEBUG_ 1 00035 00036 00037 // Namespaces 00038 using namespace std; 00039 00040 typedef struct{ 00041 double width; 00042 double lenght_back; 00043 double lenght_front; 00044 double height_top; 00045 double height_bottom; 00046 }t_vehicle_description; 00047 00048 00049 typedef struct{ 00050 double x[2]; 00051 double y[2]; 00052 }t_lines; 00053 00054 00055 typedef struct{ 00056 double x; 00057 double y; 00058 }t_point; 00059 00060 class c_trajectory 00061 { 00062 public: 00063 c_trajectory(double D_in) 00064 { 00065 D = D_in; 00066 #if _TRAJECTORY_LIB_DEBUG_ 00067 printf("Constructor - Defining D...\n"); 00068 #endif 00069 }; 00070 00071 ~c_trajectory() 00072 { 00073 #if _TRAJECTORY_LIB_DEBUG_ 00074 printf("Destructor...\n"); 00075 #endif 00076 }; 00077 00078 // ----- Variables ------ 00079 // Local coordinates 00080 vector<vector<t_lines> > v_lines; 00081 vector<t_point> collision_pts; 00082 vector<double> lx; 00083 vector<double> ly; 00084 vector<double> ltheta; 00085 vector<tf::Transform> ltrans; 00086 00087 // Global coordinates 00088 vector<double> x; 00089 vector<double> y; 00090 vector<double> theta; 00091 00092 struct{ 00093 double DAP; //distance to application point 00094 double ADAP; //angular difference related to the application point 00095 double DLO; 00096 double DAPnorm; // normalized 00097 double ADAPnorm; // normalized 00098 double DLOnorm; 00099 double FS; 00100 double overall_norm; 00101 }score; 00102 00103 int closest_node; 00104 00105 // Input parameters 00106 vector<double> alpha; 00107 vector<double> arc; 00108 vector<double> speed; 00109 double D; 00110 00111 // Other paramenters 00112 vector<double> total_arc; 00113 00114 // ------ Functions ------ 00115 t_func_output generate(vector<double> alpha_in, vector<double> arc_in, vector<double> speed_in, t_vehicle_description& vd); 00116 t_func_output compute_transformation(); 00117 void create_markers(std::vector<visualization_msgs::Marker>* marker_vec, int* marker_count, int num_traj); 00118 00119 00120 private: 00121 00122 00123 }; 00124 typedef boost::shared_ptr<c_trajectory> c_trajectoryPtr; 00125 00126 #endif