Callback not getting triggered when running with valgrind
I want to profile multiple nodes in my system, I've already profiled a few nodes successfully by adding the valgrind prefix like so:
def generate_launch_description():
return LaunchDescription([
Node(
package="fov_filtering",
namespace='',
executable="fov_filtering_app",
name="fov_filtering_node",
output="screen",
prefix=['valgrind --tool=callgrind'],
The steps I follow are the following:
- Build relevant packages with Debug flag
- Run relevant rosbag with the data that the callback subscribes to
- Run the launch file with the valgrind prefix
- Stop nodes and visualize the callgrind file in kcachegrind
I am printing out a message to the console everytime the callbacks get triggered as a sanity check. For some mysterious reason the callback of some nodes is not triggered. I am sure that all the parameters and topic names are correct because I am copy-pasting the regular launch file into a new one with the prefix "profiling_" which only differs in the prefix added.
For reference, this is the signature and binding of a callback which is getting triggered:
subscriber_ = this->create_subscription<sensor_msgs::msg::PointCloud2>("/radar/input/cloud", 10,
std::bind(&RadarTrackingNode::callback, this, std::placeholders::_1));
...
void RadarTrackingNode::callback(const sensor_msgs::msg::PointCloud2::SharedPtr cloud)
And this is the signature and binding of a callback which is not getting triggered:
subscription_ = this->create_subscription<sensor_msgs::msg::PointCloud2>(pointcloud_topic, 20, std::bind(&Main::_callback, this, std::placeholders::_1));
...
void Main::_callback(const sensor_msgs::msg::PointCloud2::SharedPtr sensor_point_cloud);
To be clear I can see the callgrind
file, the problem is that since the callback is never triggered I don't see it in the call graph.
Any ideas of what can be the source of the problem or what can I try to solve it?