Unable to use move_base trajectory planner sending goal by code
Hi all, I apply movebase 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 /movebase/NavfnROS/plan publish empty messages, while /movebasesimple/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
Asked by daddy88 on 2013-03-13 12:52:28 UTC
Comments
Have you published your plan correctly?
Asked by RB on 2015-02-12 09:31:45 UTC