no_collision_alg.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author 
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 of the License, or
00009 // at your option) any later version.
00010 //
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 // 
00019 // IMPORTANT NOTE: This code has been generated through a script from the 
00020 // iri_ros_scripts. Please do NOT delete any comments to guarantee the correctness
00021 // of the scripts. ROS topics can be easly add by using those scripts. Please
00022 // refer to the IRI wiki page for more information:
00023 // http://wikiri.upc.es/index.php/Robotics_Lab
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 //include no_collision_alg main library
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     // private attributes and methods
00056     static const float MIN_LASER_RANGE_ = 0.005f; //[m]
00057     // node configuration attributes
00058     float MIN_SAFE_DISTANCE_; // [m]
00059     float LASER_SAFE_DIST_; // [m]
00060     float VT_MAX_; // [m/s]
00061     float T_ACC_; // [m/s2]
00062     float ANGLE_TOL_; // [rad]
00063 
00064     float MIN_SAFE_ANGLE_; // [rad]
00065     float VR_MAX_; // [rad/s]
00066     float R_ACC_; // [rad/s2]
00067     float DIST_TOL_; // [meters]
00068   
00069     float OA_CONE_ANGLE_; // [rad]
00070 
00071     float MAX_ANGLE_TO_STOP_; //[rad]
00072 
00073     // translational parameters
00074     float current_vt_; // [m/s]
00075     float target_vt_;//[m/s]
00076     float desired_vt_;//[m/s]
00077     float acc_dist_;//[m]
00078     float deacc_dist_;//[m]
00079     float target_dist_;//[m]
00080     float current_dist_;//[m]
00081     TrajStates vt_state_;
00082 
00083     // rotational parameters
00084     float current_vr_; // [rad/s]
00085     float target_vr_;//[rad/s]
00086     float desired_vr_;//[rad/s]
00087     float acc_angle_;//[rad]
00088     float deacc_angle_;//[rad]
00089     float target_angle_;//rad]
00090     float current_angle_;//[rad]
00091     TrajStates vr_state_;
00092     float heading;//[rad]
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     // here define all no_collision_alg interface methods to retrieve and set
00177     // the driver parameters
00184     void setGoal(const geometry_msgs::Pose & local_goal);
00185 
00195     bool isGoalReached(void);
00196 
00197     void getDistance2Goal(geometry_msgs::Pose &current_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


iri_no_collision
Author(s):
autogenerated on Fri Dec 6 2013 21:10:48