Ask Your Question

mjbogusz's profile - activity

2018-02-25 03:04:08 -0500 received badge  Famous Question (source)
2017-11-03 22:17:02 -0500 received badge  Notable Question (source)
2017-10-18 12:16:43 -0500 received badge  Supporter (source)
2017-10-18 12:16:34 -0500 marked best answer ROS2: subscription/service/timer callbacks not being called

TL;DR:

rclcpp::Node-inheriting class registers some subscribers, services and a timer in its constructor; not a single callback is being called (apparently).

Details

I've recently refactored a working (4 nodes, C++) but non-composable code [1] (global function callbacks etc) into rclcpp::Node-inheriting classes, so that they can be run together.

The code structure is just like in demos/examples - nodes pass their names to super constructors, initialize whathever they're responsible for (e.g. sensors) and register subscriptions, services and timers. For running them separately I've created simple entry points just like in the examples - auto node = std::make_shared<NodeClass>(args...) and then rclcpp::spin(node).

Now, while one of the nodes [2] that only publishes data works as intended, the other one [3] that listens for data/requests does not (note that both register a timer!). As you can see in the code, I've added couts in the beggining of every callback function.

The expected behaviour would be some outputs from the node's constructor and at least one output from the timer callback (Loop!), however, the latter does not happen. There's no output from any subscription/service callback either (they're called from a separate control app/node [4]).

I've tried disabling most callbacks to reduce the case to the simplest one, but it didn't solve the issue.

More info

C++ nodes are being run on a BeagleBone Green Wireless, Python node is being run on a x86_64 laptop, both connected to the same WiFi.

In both cases I'm using ROS2 Beta 3 compiled from source.

Entry points

They're located in main.cpp files of their respective packages, right next to the Node class files.

  1. Working node [5] (rclcpp::shutdown() was disabled for testing only)
  2. Not working node [6]

Refs

  1. https://github.com/GroupOfRobots/RysR...
  2. https://github.com/GroupOfRobots/RysR...
  3. https://github.com/GroupOfRobots/RysR...
  4. https://github.com/GroupOfRobots/RysR...
  5. https://github.com/GroupOfRobots/RysR...
  6. https://github.com/GroupOfRobots/RysR...

Edit1: added 'Entry points' section and links

2017-10-18 12:16:34 -0500 received badge  Scholar (source)
2017-10-16 17:26:47 -0500 received badge  Popular Question (source)
2017-10-16 15:48:49 -0500 commented question ROS2: subscription/service/timer callbacks not being called

They're right next to their respective *Node class files - I've updated the question to include links to them.

2017-10-16 15:47:13 -0500 edited question ROS2: subscription/service/timer callbacks not being called

ROS2: subscription/service/timer callbacks not being called TL;DR: rclcpp::Node-inheriting class registers some subscri

2017-10-16 13:46:56 -0500 asked a question ROS2: subscription/service/timer callbacks not being called

ROS2: subscription/service/timer callbacks not being called TL;DR: rclcpp::Node-inheriting class registers some subscri