00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef COLLVOID_CLEARPATH_H
00031 #define COLLVOID_CLEARPATH_H
00032
00033 #include "collvoid_local_planner/Utils.h"
00034
00035
00036 #define RAYRAY 0
00037 #define RAYSEGMENT 1
00038 #define SEGMENTSEGMENT 2
00039 #define SEGMENTLINE 3
00040 #define RAYLINE 4
00041 #define LINELINE 5
00042
00043 #define HRVOS 0
00044 #define RVOS 1
00045 #define VOS 2
00046
00047
00048
00049 namespace collvoid {
00050
00051 VO createObstacleVO(Vector2& position1, const std::vector<Vector2>& footprint1, Vector2& vel1, Vector2& position2, const std::vector<Vector2>& footprint2);
00052 VO createObstacleVO(Vector2& position1, double radius1,Vector2& vel1, Vector2& position2, double radius2);
00053
00054 VO createObstacleVO(Vector2& position1, double radius1, const std::vector<Vector2>& footprint1, Vector2& obst1, Vector2& obst2);
00055
00056
00057
00058 VO createVO(Vector2& position1, const std::vector<Vector2>& footprint1, Vector2& position2, const std::vector<Vector2>& footprint2, Vector2& vel2);
00059 VO createRVO(Vector2& position1, const std::vector<Vector2>& footprint1, Vector2& vel1, Vector2& position2, const std::vector<Vector2>& footprint2, Vector2& vel2);
00060 VO createHRVO(Vector2& position1, const std::vector<Vector2>& footprint1, Vector2& vel1, Vector2& position2, const std::vector<Vector2>& footprint2, Vector2& vel2);
00061
00062 VO createVO(Vector2& position1, const std::vector<Vector2>& footprint1, Vector2& vel1, Vector2& position2, const std::vector<Vector2>& footprint2, Vector2& vel2, int TYPE);
00063
00064
00065
00066 VO createVO(Vector2& position1, double radius1, Vector2& vel1, Vector2& position2, double radius2, Vector2& vel2, int TYPE);
00067
00068 VO createVO(Vector2& position1, double radius1, Vector2& position2, double radius2, Vector2& vel2);
00069 VO createRVO(Vector2& position1, double radius1, Vector2& vel1, Vector2& position2, double radius2, Vector2& vel2);
00070 VO createHRVO(Vector2& position1, double radius1, Vector2& vel1, Vector2& position2, double radius2, Vector2& vel2);
00071
00072
00073
00074 VO createTruncVO (VO& vo, double time);
00075
00076
00077
00078
00079 bool isInsideVO(VO vo, Vector2 point, bool use_truncation);
00080 bool isWithinAdditionalConstraints(const std::vector<Line>& additional_constraints, const Vector2& point);
00081 void addCircleLineIntersections(std::vector<VelocitySample>& samples, const Vector2& pref_vel, double max_speed, bool use_truncation, const Vector2& point, const Vector2& dir);
00082 void addIntersectPoint(std::vector<VelocitySample>& samples, const Vector2& pref_vel, double max_speed, bool use_truncation, Vector2 point, const std::vector<VO>& truncated_vos);
00083 void addRayVelocitySamples(std::vector<VelocitySample>& samples, const Vector2& pref_vel, Vector2 point1, Vector2 dir1, Vector2 point2, Vector2 dir2, double max_speed, int TYPE);
00084
00085 Vector2 calculateClearpathVelocity(std::vector<VelocitySample>& samples, const std::vector<VO>& truncated_vos, const std::vector<Line>& additional_constraints, const Vector2& pref_vel, double max_speed, bool use_truncation);
00086
00087
00088 void createSamplesWithinMovementConstraints(std::vector<VelocitySample>& samples, double cur_vel_x, double cur_vel_y, double cur_vel_theta, double acc_lim_x, double acc_lim_y, double acc_lim_theta, double min_vel_x, double max_vel_x, double min_vel_y, double max_vel_y, double min_vel_theta, double max_vel_theta, double heading, Vector2 pref_vel, double sim_period, int num_samples, bool holo_robot);
00089
00090
00091 double calculateVelCosts(const Vector2& test_vel, const std::vector<VO>& truncated_vos, const Vector2& pref_vel, double max_speed, bool use_truncation);
00092 Vector2 calculateNewVelocitySampled(std::vector<VelocitySample>& samples, const std::vector<VO>& truncated_vos, const Vector2& pref_vel,double max_speed, bool use_truncation);
00093
00094
00095
00096
00097
00098
00099
00100
00101 std::vector<Vector2> minkowskiSum(const std::vector<Vector2> polygon1, const std::vector<Vector2> polygon2);
00102
00103
00104 bool compareVectorsLexigraphically(const ConvexHullPoint& v1, const ConvexHullPoint& v2);
00105 double cross(const ConvexHullPoint& O, const ConvexHullPoint& A, const ConvexHullPoint& B);
00106
00107
00108
00109 std::vector<ConvexHullPoint> convexHull(std::vector<ConvexHullPoint> P, bool sorted);
00110
00111 bool compareVelocitySamples(const VelocitySample& p1, const VelocitySample& p2);
00112
00113 Vector2 intersectTwoLines(Vector2 point1, Vector2 dir1, Vector2 point2, Vector2 dir2);
00114 Vector2 intersectTwoLines(Line line1, Line line2);
00115
00116
00117 }
00118
00119
00120 #endif