geometry_msgs :: PoseStampedスタート。 Start.header.seq = 0 ; Start.header.stamp =時間(0 )。 Start.header.frame_idは = " マップ" ; Start.pose.position.x = X1; Start.pose.position.y = Y1; Start.pose.position.z = 0.0 。 Start.pose.orientation.x = 0.0 。 Start.pose.orientation.y = 0.0 。 Start.pose.orientation.w = 1.0 ; geometry_msgs :: PoseStampedゴール。 Goal.header.seq= 0 ; Goal.header.stamp =時間(0 )。 Goal.header.frame_idは = " マップ" ; Goal.pose.position.x = X2; Goal.pose.position.y = Y2。 Goal.pose.position.z = 0.0 。 Goal.pose.orientation.x = 0.0 。 Goal.pose.orientation.y = 0.0 。 Goal.pose.orientation.w = 1.0 ; ServiceClient check_path = nh_.serviceClient <nav_msgs :: GetPlan>(" make_plan " ); nav_msgs :: GetPlan SRV。 srv.request.start = スタート。 srv.request.goal = ゴール。 srv.request.tolerance = 1.5 ; ROS_INFO(" 計画を作成した:%d "、(check_path.call(SRV)?1:0 )); ROS_INFO(" 計画サイズ:%のD " 、srv.response.plan.poses.size())。 move_base_msgs :: MoveBaseGoal move_goal。 move_goal.target_pose.header.frame_id = " マップ" ; move_goal.target_pose.header.stamp =時間(0 )。 move_goal.target_pose.pose.position.x = X。 move_goal.target_pose.pose.position.y = Y。 move_goal.target_pose.pose.position.z = 0.0 。 move_goal.target_pose.pose.orientation.x = 0.0 。 move_goal.target_pose.pose.orientation.y = 0.0 。 move_goal.target_pose.pose.orientation.w = 1.0 ; ROS_INFO(" 送信ゴール" ); ac_.sendGoal(move_goal、後押し::バインド(&ExploreAction :: doneCb、この、_1、_2));
参考:
https://answers.ros.org/question/264369/move_base-make_plan-service-is-returning-an-empty-path/