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

Revision history [back]

click to hide/show revision 1
initial version

Folks! I have solved the problem! Not sure if this is the correct way, but it works now.

The following was added as a "global" variable declaration (yes, yes global are a bad idea, I know!)

unsigned int num_handles = 1 + 1;   // 1 subscriber, 1 publisher (but what about timer??

After that, this line:

RCCHECK(rclc_executor_init(&executor, &support.context, 1, &allocator));

has been changed as follows:

RCCHECK(rclc_executor_init(&executor, &support.context, num_handles, &allocator));

Yeah, I know I could have hardcoded it, but at least this provides some context and clarity in the source code. Currently I'm cleaning this code up and then I will create a pull request to the github repo, for everyone else in this community to find and use. Hopefully my struggles with this and the contributions to the original repo will help someone else in the future!