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

Ros2 pub/sub code logging only appearing in c++

asked 2019-12-20 11:59:40 -0600

RobotJINI gravatar image

I am looking at adding some code to the publisher and subscriber base code.

Lets start at the beginning, it looks to me that both python and c++ use the same underlying subscription.cpp/hpp code in rclcpp and for python its just wrapped. If i’m wrong thats the issue.

Moving on:

I modified subscription.hpp in rclcpp to print a message in the void handle_message function (everytime you receive a message) it is logged under the RCLCPP_INFO flag so it should print by default.

When I run the pub sub tutorial in python I get no extra print messages.

When I run the pub sub tutorial in c++ I get the print messages.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-12-20 12:30:58 -0600

sloretz gravatar image

Lets start at the beginning, it looks to me that both python and c++ use the same underlying subscription.cpp/hpp code in rclcpp and for python its just wrapped. If i'm wrong thats the issue.

That's the issue. rclcpp and rclpy are both wrapping a C library called rcl. A change in rclcpp won't affect rclpy.

There's a helpful diagram on this page: http://docs.ros2.org/eloquent/develop...

image description

edit flag offensive delete link more

Comments

I can't tell you the number of times I use that diagram to explain ROS2 to folks. Whoever at OR made that did a very good job.

stevemacenski gravatar image stevemacenski  ( 2019-12-20 14:22:01 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-12-20 11:59:40 -0600

Seen: 337 times

Last updated: Dec 20 '19