Jolin,<div><br></div><div>While you're right that the intended server is move_base, I'm afraid its not as simple as just rosrunning the move_base node. You'll first need to configure it for your platform following this tutorial: <meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://www.ros.org/wiki/navigation/Tutorials/RobotSetup">http://www.ros.org/wiki/navigation/Tutorials/RobotSetup</a>. Unless someone has the navigation stack configured for a Pioneer 3 already and wants to share?</div>
<div><br></div><div>Hope all is well,</div><div><br></div><div>Eitan<br><br><div class="gmail_quote">2010/11/4 Jolin Jia <span dir="ltr"><<a href="mailto:pplin86@gmail.com">pplin86@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br><br>I am learning sending a simple navigation goal to the robot in the website of <a href="http://www.ros.org/wiki/navigation/Tutorials/SendingSimpleGoals" target="_blank">http://www.ros.org/wiki/navigation/Tutorials/SendingSimpleGoals</a>. And I found the simple_navigation_goals package is just the client. There must be a server. So I write the code of server, but I am shamed that I don't very understand the operating mechanism of the server. The file for the server is as following:<br>

=======================================simple_navigation_server.cpp==============================<br>#include <ros/ros.h><br>#include <move_base_msgs/MoveBaseAction.h><br>#include <actionlib/server/simple_action_server.h><br>

#include <geometry_msgs/PoseStamped.h><br>#include "geometry_msgs/Twist.h"<br>class simple_server<br>{<br>public:<br>  simple_server(std::string name):as_(nh_,name),action_name_(name)<br>  {<br>    // Register the goal and feeback callbacks<br>

    as_.registerGoalCallback(boost::bind(&simple_server::goalCB, this));<br>    as_.registerPreemptCallback(boost::bind(&simple_server::preemptCB, this));<br>    sub_ = nh_.subscribe("/random_number",1,&simple_server::analysisCB,this);<br>

    cmd.linear.x = cmd.linear.y = cmd.angular.z = 0;<br><br>    // ¹ã²¥ÃüÁî<br>    cmd_pub_ = nh_.advertise<geometry_msgs::Twist>("/p3robot/cmd",1);<br>  }<br>  void goalCB()<br>  {<br>    ROS_INFO("%s : received a new goal",action_name_.c_str());<br>

    as_.acceptNewGoal();<br>    ROS_INFO("end of receiving the new goal");<br>  }<br>  void preemptCB()<br>  {<br>    ROS_INFO("%s : preempted",action_name_.c_str());<br>    as_.setPreempted();<br>  }<br>

  void analysisCB(const geometry_msgs::PoseStamped::ConstPtr& msg)<br>  {<br>    ROS_INFO("get in analysisCB");<br>    if(!as_.isActive())<br>      return;<br>    //feedback_.feedback.base_position.header = msg->header;<br>

    //feedback_.feedback.base_position.pose.position.x = msg->pose.position.x;<br>    //feedback_.feedback.base_position.pose.orientation.w = msg->pose.orientation.w;<br>    cmd.linear.x = msg->pose.position.x;<br>

    ROS_INFO("the position value is %d \n ",msg->pose.position.x);<br>    cmd_pub_.publish(cmd);  <br>    //as_.setSucceeded(result_);<br>  }<br>protected:<br>  ros::NodeHandle nh_;<br>  actionlib::SimpleActionServer<move_base_msgs::MoveBaseAction> as_;<br>

  std::string action_name_;<br>  geometry_msgs::PoseStamped goal_;<br>  move_base_msgs::MoveBaseActionFeedback feedback_;<br>  move_base_msgs::MoveBaseActionResult result_;<br>  ros::Subscriber sub_;<br>  <br>  ros::Publisher cmd_pub_;<br>

  <br>  geometry_msgs::Twist cmd;<br>}; <br><br>int main(int argc, char** argv)<br>{<br>  ros::init(argc,argv,"simple_server");<br>  simple_server serverInstance("move_base");<br>  ros::spin();<br><br>

  return 0;<br>}<br>============================end of the file=================================<br><br>When I type "roscore"¡¢ "rosrun simple_navigation_goals simple_navigation_server <br>"¡¢ "rosrun simple_navigation_goals simple_navigation_goals"£¬I can find that the client has sending a goal, and the server can receive the goal, but it can't enter into the function of "preemptCB" and "analysisCB", that's to say I can't publish the "/p3robot/cmd" cmd. I think there must be some problem in the server file. <br>

<br>Then I am trying another way. I find the "move_base" package is really a server. But when I type "rosrun move_base move_base" and  "rosrun simple_navigation_goals simple_navigation_goals", I find the client always gets the "Waiting for the move_base action server to come up" outputs. This means the client can't get touched the server. But the "move_base" node is really a server named "move_server". What is the problem?<br>

<br>Thanks in advanced!<br>
<br>_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
<br></blockquote></div><br></div>