Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 2011-09-23 22:20:46 -0500

sam gravatar image

I figure out 'we have been kicked off the network by another node with the same name' by tring two sample code:

node_test.cpp:

 #include "ros/ros.h"

 int main(int argc, char **argv)
 {
    //ROS的初始化
    ros::init(argc, argv, "basic_node");
    ROS_INFO("%s","Hello 1!");
    //讓ROS進入無窮迴圈,但能進行事件處理
    ros::spin();
    return 0;
 }

node_test2.cpp

 #include "ros/ros.h"

 int main(int argc, char **argv)
 {
    //ROS的初始化
    ros::init(argc, argv, "basic_node");
    ROS_INFO("%s","Hello 2!");
    //讓ROS進入無窮迴圈,但能進行事件處理
    ros::spin();
    return 0;
 }

When I run the first,and second.

The first will crash on following messages:

 sam@/home/sam/code/ros/node/basic_node$ ./bin/basicNode
 [ INFO] [1316859193.830963744]: Hello 1!
 [ WARN] [1316859279.686228002]: Shutdown request received.
 [ WARN] [1316859279.686357767]: Reason given for shutdown: [new node      registered with same name]

 sam@/home/sam/code/ros/node/basic_node$

Thank you~