Go to the documentation of this file.00001 #ifndef _c_manage_trajectory_H_
00002 #define _c_manage_trajectory_H_
00003
00012
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 #include <numeric>
00029 #include <trajectory_planner/c_trajectory.h>
00030 #include <mtt/TargetList.h>
00031 #include <trajectory_planner/traj_info.h>
00032
00033 typedef struct{
00034
00035 double x;
00036 double y;
00037
00038 double theta;
00039 }t_desired_coordinates;
00040
00041 typedef struct{
00042 std::vector<double> x;
00043 std::vector<double> y;
00044 int id;
00045 }t_obstacle;
00046
00047
00048
00049 #define DONT_INTERSECT 0
00050 #define DO_INTERSECT 1
00051 #define COLLINEAR 2
00052 #define _SPEED_REQUIRED_ 0.25
00053 #define _SPEED_SAFFETY_ 0.05
00054 #define _USE_MATH_DEFINES
00055 #define _TRAJECTORY_LIB_DEBUG_ 1
00056
00057
00058 using namespace std;
00059
00060 class c_manage_trajectory
00061 {
00062 public:
00063 c_manage_trajectory(void)
00064 {
00065 chosen_traj.index=-1;
00066 AP.x=-1.0; AP.y=0.0; AP.theta=M_PI/8;
00067 current_node=0;
00068 #if _TRAJECTORY_LIB_DEBUG_
00069 printf("Constructor...\n");
00070 #endif
00071 };
00072
00073 ~c_manage_trajectory()
00074 {
00075 #if _TRAJECTORY_LIB_DEBUG_
00076 printf("Destructor...\n");
00077 #endif
00078 };
00079
00080
00081 std::vector<c_trajectoryPtr> vt;
00082 t_vehicle_description vehicle_description;
00083 t_desired_coordinates AP;
00084 double inter_axis_distance;
00085 int current_node;
00086 std::vector<visualization_msgs::Marker> static_marker_vec;
00087 std::vector<t_obstacle> vo;
00088 struct{
00089 int index;
00090 }chosen_traj;
00091
00092
00093 t_func_output set_speed_vector(trajectory_planner::traj_info* info);
00094 t_func_output get_traj_info_msg_from_chosen(trajectory_planner::traj_info* info);
00095 t_func_output set_vehicle_description(double w, double lb, double lf, double ht, double hb);
00096 t_func_output set_obstacles(mtt::TargetList& msg);
00097 int lineSegmentIntersection(double Ax, double Ay,double Bx, double By,double Cx, double Cy,double Dx, double Dy,double *X, double *Y);
00098 t_func_output compute_DLO(c_trajectoryPtr& trajectory, std::vector<t_obstacle>& vo);
00099 t_func_output compute_trajectories_scores();
00100 t_func_output compute_vis_marker_array(visualization_msgs::MarkerArray* marker_array);
00101 t_func_output create_static_markers();
00102 t_func_output create_new_trajectory(vector<double> alpha_in, vector<double> arc_in, vector<double> speed_in);
00103 t_func_output set_inter_axis_distance(double val);
00104 t_func_output compute_DAP(c_trajectoryPtr& trajectory,t_desired_coordinates& AP);
00105 void draw_on_node(c_trajectoryPtr& trajectory,std::vector<visualization_msgs::Marker>* marker_vec, int* marker_count,double z_high, double value, double normalized_value, string string_init);
00106 double compute_ADAP(c_trajectoryPtr& trajectory,t_desired_coordinates& AP, int i);
00107 t_func_output set_attractor_point(double x, double y, double theta);
00108 t_func_output compute_global_traj_score(c_trajectoryPtr& trajectory);
00109 t_func_output compute_chosen_traj();
00110 int set_chosen_traj(int n);
00111
00112 private:
00113
00114 };
00115 typedef boost::shared_ptr<c_manage_trajectory> c_manage_trajectoryPtr;
00116 #endif