Go to the documentation of this file.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 #ifndef _no_collision_alg_h_
00026 #define _no_collision_alg_h_
00027
00028 #include <iri_no_collision/NoCollisionConfig.h>
00029 #include "mutex.h"
00030
00031
00032 #include <geometry_msgs/Point.h>
00033 #include <sensor_msgs/LaserScan.h>
00034 #include <geometry_msgs/Twist.h>
00035 #include <nav_msgs/Odometry.h>
00036
00037 typedef enum {traj_acc,traj_speed,traj_deacc,traj_idle} TrajStates;
00038
00044 class NoCollisionAlgorithm
00045 {
00046 protected:
00053 CMutex alg_mutex_;
00054
00055
00056 static const float MIN_LASER_RANGE_ = 0.005f;
00057
00058 float MIN_SAFE_DISTANCE_;
00059 float LASER_SAFE_DIST_;
00060 float VT_MAX_;
00061 float T_ACC_;
00062 float ANGLE_TOL_;
00063
00064 float MIN_SAFE_ANGLE_;
00065 float VR_MAX_;
00066 float R_ACC_;
00067 float DIST_TOL_;
00068
00069 float OA_CONE_ANGLE_;
00070
00071 float MAX_ANGLE_TO_STOP_;
00072
00073
00074 float current_vt_;
00075 float target_vt_;
00076 float desired_vt_;
00077 float acc_dist_;
00078 float deacc_dist_;
00079 float target_dist_;
00080 float current_dist_;
00081 TrajStates vt_state_;
00082
00083
00084 float current_vr_;
00085 float target_vr_;
00086 float desired_vr_;
00087 float acc_angle_;
00088 float deacc_angle_;
00089 float target_angle_;
00090 float current_angle_;
00091 TrajStates vr_state_;
00092 float heading;
00093
00094 ros::Time current_time_;
00106 void fromCartesian2Polar(const geometry_msgs::Point & p, float & module, float & angle);
00107
00108 void fromPolar2Cartesian(const float & module, const float & angle, geometry_msgs::Point &p);
00109
00110 void updateTranslationTrajParams(void);
00111
00112 void updateRotationTrajParams(void);
00113 public:
00120 typedef iri_no_collision::NoCollisionConfig Config;
00121
00128 Config config_;
00129
00138 NoCollisionAlgorithm(void);
00139
00145 void lock(void) { alg_mutex_.enter(); };
00146
00152 void unlock(void) { alg_mutex_.exit(); };
00153
00161 bool try_enter(void) { return alg_mutex_.try_enter(); };
00162
00174 void config_update(const Config& new_cfg, uint32_t level=0);
00175
00176
00177
00184 void setGoal(const geometry_msgs::Pose & local_goal);
00185
00195 bool isGoalReached(void);
00196
00197 void getDistance2Goal(geometry_msgs::Pose ¤t_goal);
00198
00199 void setTranslationalSpeed(const double vt);
00200
00201 void setRotationalSpeed(const double vr);
00202
00218 bool movePlatform(const sensor_msgs::LaserScan & laser,const geometry_msgs::Pose & local_goal,geometry_msgs::Twist &twist);
00219
00232 bool isGoalTraversable(const sensor_msgs::LaserScan & laser,
00233 const geometry_msgs::Point & goal);
00234
00241 ~NoCollisionAlgorithm(void);
00242 };
00243
00244 #endif