ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Nodes not connecting through remap in launch file

asked 2019-03-26 09:52:26 -0600

THordijk gravatar image

updated 2019-03-27 04:36:08 -0600

Hello I am using ROS kinetic with ensenso/ros_driver and akio/mask_rcnn_ros, both the master branch. Running on Ubuntu 16.04 kernel version 4.15.0-46-generic.

I am using an Nvidia RTX 2080 ti with cuda 418.39

I am trying to connect the ensenso_camera_node to the mask_rcnn_node using a launch file in which I remap the input of the model to the output of the camera.

<launch>
    <remap from="~input" to="/rectified/left/image"/>  
    <arg name="configuratie" value="$(find ensenso_camera)/configs/configuratie.json"/>
    <node pkg="ensenso_camera" type="ensenso_camera_node" name="ensenso_camera_node">
    <param name="settings" value="$(arg configuratie)"/>
    </node>
    <node pkg="ensenso_camera" type="request_data" name="image_data"></node>
    <node pkg="tf" type="static_transform_publisher" name="ensenso_optical_frame" 
           args="0 0 0 0 0 0 world ensenso_optical_frame 100"/>
    <node pkg="mask_rcnn_ros" type="mask_rcnn_node" name="mask_rcnn"></node>
</launch>

The nodes are started without an error, however, when I check with roswtf it states that either the input of the model is not connected, or that the camera and the model should be connected but aren't depending on the position of the remap statement in the launch file.

WARNING The following node subscriptions are unconnected:
    * /mask_rcnn:
       * /mask_rcnn/input

or

ERROR The following nodes should be connected but aren't:
   * /ensenso_camera_node->/mask_rcnn (/camera_image)

I am guessing that I am making a mistake in the remapping of the topics but my experience with ROS is about as much as can be seen above so I am not sure. Hopefully someone can help me out with this.

Thanks in advance!

Environment:

ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/home/riwo-rack-pc/ROS_Mask_rcnn/src:/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROSCONSOLE_CONFIG_FILE=/home/riwo-rack- 
pc/ROS_Mask_rcnn/src/ros_comm/tools/rosconsole/config/rosconsole.config
ROS_VERSION=1
LD_LIBRARY_PATH=/home/riwo-rack-pc/ROS_Mask_rcnn/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux- 
gnu
PATH=/home/riwo-rack-pc/ROS_Mask_rcnn/devel/bin:/opt/ros/kinetic/bin:/home/riwo-rack-pc/bin:/home/riwo-rack- 
pc/.local/bin:/home/riwo-rack- 
pc/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/sbin/
ROSLISP_PACKAGE_DIRECTORIES=/home/riwo-rack-pc/ROS_Mask_rcnn/devel/share/common-lisp
ROS_DISTRO=kinetic
PYTHONPATH=/home/riwo-rack-pc/ROS_Mask_rcnn/devel/lib/python2.7/dist- 
packages:/opt/ros/kinetic/lib/python2.7/dist-packages
PKG_CONFIG_PATH=/home/riwo-rack- 
pc/ROS_Mask_rcnn/devel/lib/pkgconfig:/opt/ros/kinetic/lib/pkgconfig:/opt/ros/kinetic/lib/x86_64-linux-gnu/pkgconfig
CMAKE_PREFIX_PATH=/home/riwo-rack-pc/ROS_Mask_rcnn/devel:/opt/ros/kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros

As a reponse to the comments:

With the remap still in place the rosnode info mask_rcnn returns:

Node [/mask_rcnn]
Publications: 
 * /mask_rcnn/result [mask_rcnn_ros/Result]
 * /mask_rcnn/visualization [sensor_msgs/Image]
 * /rosout [rosgraph_msgs/Log]

Subscriptions: 
 * /mask_rcnn/input [unknown type]

Services: 
 * /mask_rcnn/get_loggers
 * /mask_rcnn/set_logger_level


contacting node http://riworackpc-System-Product-Name:45449/ ...
Pid: 7733
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS

With remap removed rosnode list returns:

/ensenso_camera_node
/ensenso_optical_frame
/image_stream_node
/mask_rcnn
/rosout

rostopic list returns:

/access_tree/cancel
/access_tree/feedback
/access_tree/goal
/access_tree/result
/access_tree/status
/calibrate_hand_eye/cancel
/calibrate_hand_eye/feedback
/calibrate_hand_eye/goal
/calibrate_hand_eye/result
/calibrate_hand_eye/status
/calibrate_workspace/cancel
/calibrate_workspace/feedback
/calibrate_workspace/goal ...
(more)
edit retag flag offensive close merge delete

Comments

Maybe the mask_rcnn node is a lazy subscriber which means it only subscribes to the input topics (/rectified/left/image) when another node is subscribing to its output topic (/mask_rcnn/result, /mask_rcnn/visualization). Have you tried having a node which subscribes to its output topic?

ZeroSan gravatar image ZeroSan  ( 2019-03-27 05:02:04 -0600 )edit

I have tried to open the visualization topic in rviz, that is about it. Would a dummy node that simply requests data cause a different reaction?

THordijk gravatar image THordijk  ( 2019-03-27 05:08:22 -0600 )edit

@ZeroSan: that is a good thing to check, but looking at the source I don't believe this is the case.

gvdhoorn gravatar image gvdhoorn  ( 2019-03-27 05:32:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2019-03-26 11:57:21 -0600

gvdhoorn gravatar image

updated 2019-03-27 05:36:38 -0600

Edit: seems the ~ does make this work, at least for me.

I don't have an Ensenso to test with, but with the Simple Publisher and Subsciber from this tutorial (edited to use the same topic names as the nodes the OP uses), the following works for me:

<launch>
  <node pkg="..." type="simple_pub.py" name="ensenso_camera_node" />
  <node pkg="..." type="simple_sub.py" name="mask_rcnn">
    <remap from="~input" to="/rectified/left/image"/>
  </node>
</launch>

Output of rostopic list with this running:

/rectified/left/image
/rosout
/rosout_agg

which is what I would expect: the input topic no longer "exists" (as it's been completely remapped to /rectified/left/image).


Original answer:

<launch>
     <remap from="~input" to="/rectified/left/image"/>
     ...
</launch>

This won't work: the ~ there is typically used to refer to the private namespace of a node. Your remap tag is however not a child of any node, so this remapping doesn't make sense.

You'll want to move the remap down to where the mask_rcnn_node node is being launched:

<node pkg="mask_rcnn_ros" type="mask_rcnn_node" name="mask_rcnn">
  <remap from="input" to="/rectified/left/image" />
</node>

and drop the ~.

edit flag offensive delete link more

Comments

Thank you very much for the reply. I changed the launch file as per your instructions, however, the result that it returns remains the same. I also tried changing the topic name in the mask_rcnn_node to input without the ~ but that did not help either. Could this problem be caused elsewhere? Is it perhaps not possible to remap to an existing topic?

Could it be caused by differences in encoding types passed through the topic and expected by the subscriber? This should be uniform, I think, as I changed it as described on the original git repo, but i don't want to exclude any possible reason.

THordijk gravatar image THordijk  ( 2019-03-27 01:53:10 -0600 )edit

with your nodes running do rosnode info mask_rcnn it will list at the top what the node is subscribed to and what it's publishing.

Reamees gravatar image Reamees  ( 2019-03-27 02:30:35 -0600 )edit

@THordijk: can you show us the output of rosnode list and rostopic list if you don't add the remap?

gvdhoorn gravatar image gvdhoorn  ( 2019-03-27 04:12:37 -0600 )edit

I have managed the same, the problem that i am now running into is the encoding that the camera driver provides and what is expected by the model. So the connection issue seems resolved, I now have a new hurdle to pass. Thank you very much for the help!

THordijk gravatar image THordijk  ( 2019-03-27 06:01:30 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-03-26 08:53:47 -0600

Seen: 890 times

Last updated: Mar 27 '19