54 EBandPlannerROS::EBandPlannerROS() : costmap_ros_(NULL),
tf_(NULL), initialized_(false) {}
102 eband_->setVisualization(eband_visual_);
105 eband_trj_ctrl_->setVisualization(eband_visual_);
108 eband_visual_->initialize(pn, costmap_ros);
113 drs_->setCallback(cb);
119 ROS_DEBUG(
"Elastic Band plugin initialized.");
123 ROS_WARN(
"This planner has already been initialized, doing nothing.");
137 eband_->reconfigure(config);
139 ROS_ERROR(
"Reconfigure CB called before eband planner initialization");
144 ROS_ERROR(
"Reconfigure CB called before trajectory controller initialization!");
149 ROS_ERROR(
"Reconfigure CB called before eband visualizer initialization");
160 ROS_ERROR(
"This planner has not been initialized, please call initialize() before using this planner");
170 std::vector<int> start_end_counts (2, (
int)
global_plan_.size());
174 ROS_WARN(
"Could not transform the global plan to the frame of the controller");
182 ROS_WARN(
"Transformed plan is empty. Aborting local planner!");
193 ROS_ERROR(
"Setting plan to Elastic Band method failed!");
197 ROS_DEBUG(
"Global plan set to elastic band for optimization");
207 std::vector<eband_local_planner::Bubble> current_band;
208 if(
eband_->getBand(current_band))
223 ROS_ERROR(
"This planner has not been initialized, please call initialize() before using this planner");
230 geometry_msgs::PoseStamped global_pose_msg;
231 std::vector<geometry_msgs::PoseStamped> tmp_plan;
234 ROS_DEBUG(
"Reading current robot Position from costmap and appending it to elastic band.");
237 ROS_WARN(
"Could not retrieve up to date robot pose from costmap for local planning.");
243 tmp_plan.assign(1, global_pose_msg);
247 if(!
eband_->addFrames(tmp_plan, add_frames_at))
249 ROS_WARN(
"Could not connect robot pose to existing elastic band.");
254 ROS_DEBUG(
"Checking for new path frames in moving window");
256 std::vector<geometry_msgs::PoseStamped> append_transformed_plan;
261 ROS_WARN(
"Could not transform the global plan to the frame of the controller");
269 ROS_WARN(
"Transformed plan is empty. Aborting local planner!");
273 ROS_DEBUG(
"Retrieved start-end-counts are: (%d, %d)", plan_start_end_counter.at(0), plan_start_end_counter.at(1));
277 append_transformed_plan.clear();
297 ROS_DEBUG(
"Adding %d new frames to current band", (
int) append_transformed_plan.size());
302 ROS_DEBUG(
"Sucessfully added frames to band");
306 ROS_WARN(
"Failed to add frames to existing band");
314 ROS_DEBUG(
"Calling optimization method for elastic band");
315 std::vector<eband_local_planner::Bubble> current_band;
316 if(!
eband_->optimizeBand())
318 ROS_WARN(
"Optimization failed - Band invalid - No controls availlable");
320 if(
eband_->getBand(current_band))
326 eband_->getBand(current_band);
330 ROS_DEBUG(
"Failed to to set current band to Trajectory Controller");
337 ROS_DEBUG(
"Failed to to set current odometry to Trajectory Controller");
342 geometry_msgs::Twist cmd_twist;
345 ROS_DEBUG(
"Failed to calculate Twist from band in Trajectory Controller");
351 ROS_DEBUG(
"Retrieving velocity command: (%f, %f, %f)", cmd_twist.linear.x, cmd_twist.linear.y, cmd_twist.angular.z);
356 std::vector<geometry_msgs::PoseStamped> refined_plan;
357 if(
eband_->getPlan(refined_plan))
363 if(
eband_->getBand(current_band))
375 ROS_ERROR(
"This planner has not been initialized, please call initialize() before using this planner");
411 base_odom_.twist.twist.linear.x = msg->twist.twist.linear.x;
412 base_odom_.twist.twist.linear.y = msg->twist.twist.linear.y;
413 base_odom_.twist.twist.angular.z = msg->twist.twist.angular.z;
bool getRobotPose(tf::Stamped< tf::Pose > &global_pose) const
boost::shared_ptr< EBandPlanner > eband_
bool isGoalReached()
Check if the goal pose has been achieved.
boost::shared_ptr< EBandTrajectoryCtrl > eband_trj_ctrl_
tf::TransformListener * tf_
pointer to Transform Listener
static void poseStampedTFToMsg(const Stamped< Pose > &bt, geometry_msgs::PoseStamped &msg)
EBandPlannerROS()
Default constructor for the ros wrapper.
std::string getGlobalFrameID()
PLUGINLIB_EXPORT_CLASS(BAGReader, nodelet::Nodelet)
bool setPlan(const std::vector< geometry_msgs::PoseStamped > &orig_global_plan)
Set the plan that the controller is following; also reset eband-planner.
double trans_stopped_vel_
lower bound for absolute value of velocity (with respect to stick-slip behaviour) ...
double xy_goal_tolerance_
parameters to define region in which goal is treated as reached
Implements the Elastic Band Method for SE2-Manifold (mobile Base)
double yaw_goal_tolerance_
Plugin to the ros base_local_planner. Implements a wrapper for the Elastic Band Method.
dynamic_reconfigure::Server< eband_local_planner::EBandPlannerConfig > drs
std::vector< geometry_msgs::PoseStamped > transformed_plan_
bool computeVelocityCommands(geometry_msgs::Twist &cmd_vel)
Given the current position, orientation, and velocity of the robot, compute velocity commands to send...
boost::shared_ptr< EBandVisualization > eband_visual_
ros::Publisher g_plan_pub_
publishes modified global plan
void odomCallback(const nav_msgs::Odometry::ConstPtr &msg)
Odometry-Callback: function is called whenever a new odometry msg is published on that topic...
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
~EBandPlannerROS()
Destructor for the wrapper.
std::vector< geometry_msgs::PoseStamped > global_plan_
void initialize(std::string name, tf::TransformListener *tf, costmap_2d::Costmap2DROS *costmap_ros)
Initializes the ros wrapper.
void publishPlan(const std::vector< geometry_msgs::PoseStamped > &path, const ros::Publisher &pub)
std::vector< int > plan_start_end_counter_
void reconfigureCallback(EBandPlannerConfig &config, uint32_t level)
Reconfigures node parameters.
ros::Publisher l_plan_pub_
publishes prediction for local commands
costmap_2d::Costmap2DROS * costmap_ros_
pointer to costmap
ros::Subscriber odom_sub_
subscribes to the odometry topic in global namespace
boost::shared_ptr< drs > drs_
dynamic reconfigure server ptr
bool transformGlobalPlan(const tf::TransformListener &tf, const std::vector< geometry_msgs::PoseStamped > &global_plan, costmap_2d::Costmap2DROS &costmap, const std::string &global_frame, std::vector< geometry_msgs::PoseStamped > &transformed_plan, std::vector< int > &start_end_counts_from_end)
Transforms the global plan of the robot from the planner frame to the local frame. This replaces the transformGlobalPlan as defined in the base_local_planner/goal_functions.h main difference is that it additionally outputs counter indicating which part of the plan has been transformed.
nav_msgs::Odometry base_odom_