empty string can be passed to ros::init as node name
furushchev opened this issue · 2 comments
In the current code, ros node is initialized at https://github.com/ros-naoqi/naoqi_driver/blob/master/src/ros_env.hpp#L93.
In this line, when this node is launched by roslaunch
, ROS_NAMESPACE
is set on environment variable, so ns_env
is not NULL
, so node name which is passed to ros::init
is a return value of ::naoqi::ros_env::getPrefix()
, but without passing argument --namespace=
, ::naoqi::ros_env::getPrefix()
returns empty string (https://github.com/ros-naoqi/naoqi_driver/blob/master/src/external_registration.cpp#L73), which means ros node is initialized with empty node name.
Since, initializing ros node with empty string is totally invalid (see ros/ros_comm#891), current naoqi_driver
advertises topics under wrong namespace and also is registered to ros graph with invalid name.
In current code, also arguments passed from ROS tools (e.g. roslaunch
) are totally removed before passing them to ros::init
by ros::removeROSArgs
(https://github.com/ros-naoqi/naoqi_driver/blob/master/src/external_registration.cpp#L34, (I really cannot understand why it is necessary)), so remapping node name by roslaunch
does also not work at all.
- Why arguments from command line are not just passed through
ros::init
? - Why ros node name must be specified by
::naoqi::ros_env::getPrefix()
, not by ROS remapping?
Hi, i'm facing this issue when launching naoqi for Pepper robot. naoqi-driver thread is crashing with this error :
terminate called after throwing an instance of 'ros::InvalidNameException'
what(): The node name must not be empty
Did you manage to overcome this error ?
(I'm using pepper_robot repo with pepper_full.launch)
From what I understand, this is looks like a clear flaw to me. Do you mind opening a pull request?
The latest change in this regard, was made here:
d325cda
Also, the reasoning for all this complex behavior of removing ros args etc. comes due to the fact that the initial code ought to be executed completely ROS agnostic within a libqi framework.