safe_trajectory_planner_ros.h
Go to the documentation of this file.
00001 /*
00002  * safe_trajectory_planner.h
00003  *
00004  *  Created on: Mar 25, 2010
00005  *      Author: duhadway
00006  */
00007 
00008 #ifndef SAFE_TRAJECTORY_PLANNER_ROS_H_
00009 #define SAFE_TRAJECTORY_PLANNER_ROS_H_
00010 
00011 #include <ros/ros.h>
00012 #include <costmap_2d/costmap_2d.h>
00013 #include <costmap_2d/costmap_2d_publisher.h>
00014 #include <costmap_2d/costmap_2d_ros.h>
00015 #include <base_local_planner/world_model.h>
00016 #include <base_local_planner/point_grid.h>
00017 #include <base_local_planner/costmap_model.h>
00018 #include <base_local_planner/voxel_grid_model.h>
00019 #include <safe_teleop_base/safe_trajectory_planner.h>
00020 
00021 #include <tf/transform_datatypes.h>
00022 
00023 #include <nav_msgs/Odometry.h>
00024 #include <geometry_msgs/PoseStamped.h>
00025 #include <geometry_msgs/Twist.h>
00026 #include <geometry_msgs/Point.h>
00027 
00028 #include <tf/transform_listener.h>
00029 
00030 #include <boost/thread.hpp>
00031 
00032 #include <string>
00033 
00034 #include <angles/angles.h>
00035 
00036 #include <nav_core/base_local_planner.h>
00037 
00038 
00039 namespace safe_teleop {
00040 
00041 #if ROS_VERSION_MINIMUM(1, 14, 0) // ROS_MELODIC
00042 typedef tf2_ros::Buffer TFListener;
00043 #else
00044 typedef tf::TransformListener TFListener;
00045 #endif
00046 
00051   class SafeTrajectoryPlannerROS {
00052     public:
00059       SafeTrajectoryPlannerROS(TFListener* tf, costmap_2d::Costmap2DROS* costmap_ros);
00060 
00064       ~SafeTrajectoryPlannerROS();
00065 
00072       bool computeVelocityCommands(const geometry_msgs::Twist::ConstPtr& vel, geometry_msgs::Twist& cmd_vel);
00073 
00074     private:
00079       bool stopped();
00080 
00088       double distance(double x1, double y1, double x2, double y2);
00089 
00094       bool transformGlobalPlan(std::vector<geometry_msgs::PoseStamped>& transformed_plan);
00095 
00099       void publishPlan(const std::vector<geometry_msgs::PoseStamped>& path, const ros::Publisher& pub, double r, double g, double b, double a);
00100 
00101       void odomCallback(const nav_msgs::Odometry::ConstPtr& msg);
00102 
00103       void cmdCallback(const geometry_msgs::Twist::ConstPtr& vel);
00104 
00105       std::vector<double> loadYVels(ros::NodeHandle node);
00106 
00107       ros::NodeHandle nh_;
00108 
00109       base_local_planner::WorldModel* world_model_; 
00110       SafeTrajectoryPlanner* tc_; 
00111       costmap_2d::Costmap2DROS* costmap_ros_; 
00112       costmap_2d::Costmap2D costmap_; 
00113       TFListener* tf_; 
00114       std::string global_frame_; 
00115       double max_sensor_range_; 
00116       nav_msgs::Odometry base_odom_; 
00117       std::string robot_base_frame_; 
00118       double rot_stopped_velocity_, trans_stopped_velocity_;
00119       double inscribed_radius_, circumscribed_radius_;
00120       ros::Publisher l_plan_pub_;
00121       ros::Publisher u_plan_pub_;
00122       ros::Subscriber odom_sub_, user_sub_;
00123 
00124       ros::Publisher cmd_pub_;
00125       ros::Subscriber cmd_sub_;
00126 
00127       boost::recursive_mutex odom_lock_;
00128       double max_vel_th_, min_vel_th_;
00129   };
00130 
00131 }
00132 
00133 
00134 #endif /* SAFE_TRAJECTORY_PLANNER_ROS_H_ */


safe_teleop_base
Author(s):
autogenerated on Thu Mar 14 2019 02:49:46