Skip to content
Snippets Groups Projects
Commit bc67ecb2 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Added check return value of getGoalPose

parent 3bd06341
No related branches found
No related tags found
1 merge request!7Cleaned up the code:
...@@ -468,10 +468,23 @@ bool AckermannPlannerROS::computeVelocityCommands(geometry_msgs::Twist& cmd_vel) ...@@ -468,10 +468,23 @@ bool AckermannPlannerROS::computeVelocityCommands(geometry_msgs::Twist& cmd_vel)
{ {
//ROS_INFO_STREAM("linear.x " << cmd_vel.linear.x << " deadzone: " << current_config_.trans_vel_deadzone ); //ROS_INFO_STREAM("linear.x " << cmd_vel.linear.x << " deadzone: " << current_config_.trans_vel_deadzone );
// get the position of the goal // get the position of the goal
base_local_planner::getGoalPose(*tf_, if(!base_local_planner::getGoalPose(*tf_,
transformed_plan, transformed_plan,
costmap_ros_->getGlobalFrameID(), costmap_ros_->getGlobalFrameID(),
goal_pose); goal_pose))
{
ROS_WARN_NAMED("ackermann_local_planner", "Ackermann planner failed to produce path.");
std::vector<geometry_msgs::PoseStamped> empty_plan;
publish_global_plan(empty_plan);
cmd_vel.linear.x = 0.0;
cmd_vel.linear.y = 0.0;
cmd_vel.angular.z = 0.0;
this->stuck=false;
new_segment=false;
replan_count=0;
stuck_count=0;
return false;
}
// get the distance to the goal // get the distance to the goal
double dist=base_local_planner::getGoalPositionDistance(current_pose_,goal_pose.pose.position.x,goal_pose.pose.position.y); double dist=base_local_planner::getGoalPositionDistance(current_pose_,goal_pose.pose.position.x,goal_pose.pose.position.y);
if(dist>current_config_.xy_goal_tolerance && dist<2*current_config_.xy_goal_tolerance) if(dist>current_config_.xy_goal_tolerance && dist<2*current_config_.xy_goal_tolerance)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment