Unable to use move_base trajectory planner sending goal by code [closed]
Hi all, I apply move_base tutorial to a Pioneer 3DX robot for a university project. My project create a costmap, search object into the scene and set goal that the robot have to reach. My problem is the follow: when I set the goal by code, local planner doesn't work. Topic /move_base/NavfnROS/plan publish empty messages, while /move_base_simple/goal is set correctly. But, if I set goal pose with Rviz (with 2D Nav Goal button), all is working properly.
Anyone know what I do wrong? Here my configuration file for move_base:
...
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<remap from="/odom" to="/pose" />
<remap from="cmd_vel" to="planner" />
<param name="controller_frequency" value="5.0" />
<param name="planner_frequency" value="5.0" />
<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
<rosparam file="$(find base_nav)/launch/costmap_common_params.yaml" command="load" />
<rosparam file="$(find base_nav)/launch/costmap_common_params.yaml" command="load" />
<rosparam file="$(find base_nav)/launch/costmap_local_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find base_nav)/launch/costmap_global_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find base_nav)/launch/base_local_planner_params.yaml" command="load" ns="TrajectoryPlannerROS" />
</node>
and here the way to publish goal by code:
...
goal_pub_ = nh_.advertise<geometry_msgs::PoseStamped>(goal_topic, rate);
geometry_msgs::PoseStamped goal;
goal.header.stamp = ros::Time::now();
goal.header.frame_id = "/map";
goal.pose.position.x = object_centroid[0]+object_max[0]-object_min[0]+distanceFromObjectX;
goal.pose.position.y = object_centroid[1];
goal.pose.position.z = object_centroid[2];
goal.pose.orientation.x = 0.0;
goal.pose.orientation.y = 0.0;
goal.pose.orientation.z = 1.0;
goal.pose.orientation.w = 0.0;
goal_pub_.publish(goal);
Thanks
Have you published your plan correctly?