pose_follower.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * Software License Agreement (BSD License)
4 *
5 * Copyright (c) 2009, Willow Garage, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * * Neither the name of Willow Garage, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 * Author: Eitan Marder-Eppstein
36 *********************************************************************/
37 #ifndef POSE_FOLLOWER_POSE_FOLLOWER_H_
38 #define POSE_FOLLOWER_POSE_FOLLOWER_H_
39 #include <ros/ros.h>
40 #include <tf2/convert.h>
42 #include <tf2/utils.h>
44 #include <tf2_ros/buffer.h>
47 #include <geometry_msgs/Pose.h>
48 #include <geometry_msgs/PoseStamped.h>
49 #include <geometry_msgs/Twist.h>
50 #include <nav_msgs/Odometry.h>
51 #include <pose_follower/PoseFollowerConfig.h>
52 #include <dynamic_reconfigure/server.h>
54 
55 namespace pose_follower {
57  public:
58  PoseFollower();
59  ~PoseFollower();
60  void initialize(std::string name, tf2_ros::Buffer* tf, costmap_2d::Costmap2DROS* costmap_ros);
61  bool isGoalReached();
62  bool setPlan(const std::vector<geometry_msgs::PoseStamped>& global_plan);
63  bool computeVelocityCommands(geometry_msgs::Twist& cmd_vel);
64 
65  private:
66  inline double sign(double n){
67  return n < 0.0 ? -1.0 : 1.0;
68  }
69 
70  geometry_msgs::Twist diff2D(const geometry_msgs::Pose& pose1, const geometry_msgs::Pose& pose2);
71  geometry_msgs::Twist limitTwist(const geometry_msgs::Twist& twist);
72  double headingDiff(double pt_x, double pt_y, double x, double y, double heading);
73 
74  bool transformGlobalPlan(const tf2_ros::Buffer& tf, const std::vector<geometry_msgs::PoseStamped>& global_plan,
75  const costmap_2d::Costmap2DROS& costmap, const std::string& global_frame,
76  std::vector<geometry_msgs::PoseStamped>& transformed_plan);
77 
78  void odomCallback(const nav_msgs::Odometry::ConstPtr& msg);
79  bool stopped();
80  void publishPlan(const std::vector<geometry_msgs::PoseStamped> &path, const ros::Publisher &pub);
81  void reconfigureCB(pose_follower::PoseFollowerConfig &config, uint32_t level);
82 
86  boost::mutex odom_lock_;
88  nav_msgs::Odometry base_odom_;
90  unsigned int current_waypoint_;
91  std::vector<geometry_msgs::PoseStamped> global_plan_;
93  dynamic_reconfigure::Server<pose_follower::PoseFollowerConfig> *dsrv_;
94 
95  // Parameters
102  int samples_;
107  };
108 };
109 #endif
void odomCallback(const nav_msgs::Odometry::ConstPtr &msg)
ros::Publisher global_plan_pub_
Definition: pose_follower.h:85
base_local_planner::TrajectoryPlannerROS collision_planner_
Definition: pose_follower.h:92
void publishPlan(const std::vector< geometry_msgs::PoseStamped > &path, const ros::Publisher &pub)
bool transformGlobalPlan(const tf2_ros::Buffer &tf, const std::vector< geometry_msgs::PoseStamped > &global_plan, const costmap_2d::Costmap2DROS &costmap, const std::string &global_frame, std::vector< geometry_msgs::PoseStamped > &transformed_plan)
double headingDiff(double pt_x, double pt_y, double x, double y, double heading)
void initialize(std::string name, tf2_ros::Buffer *tf, costmap_2d::Costmap2DROS *costmap_ros)
bool setPlan(const std::vector< geometry_msgs::PoseStamped > &global_plan)
geometry_msgs::Twist diff2D(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
std::vector< geometry_msgs::PoseStamped > global_plan_
Definition: pose_follower.h:91
void reconfigureCB(pose_follower::PoseFollowerConfig &config, uint32_t level)
bool computeVelocityCommands(geometry_msgs::Twist &cmd_vel)
dynamic_reconfigure::Server< pose_follower::PoseFollowerConfig > * dsrv_
Definition: pose_follower.h:93
geometry_msgs::Twist limitTwist(const geometry_msgs::Twist &twist)
costmap_2d::Costmap2DROS * costmap_ros_
Definition: pose_follower.h:84
nav_msgs::Odometry base_odom_
Definition: pose_follower.h:88


pose_follower
Author(s): Eitan Marder-Eppstein
autogenerated on Sat Aug 27 2022 02:54:17