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

Adding both a timer and subscription to the executor seems to cause error_loop() to run

asked 2021-08-20 10:16:40 -0600

jarain78 gravatar image

updated 2021-08-20 10:17:35 -0600

Hi all, I'm working with micro-ros and I'm trying to add in my script a timer and subscription, but always it cause an error in error_loop when it’s execued. It's posible to have them both in the same script?.

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

RCCHECK(rclc_executor_add_subscription(&executor, &subscriber, &msg_cmd_vel, &subscription_callback, ALWAYS));

RCCHECK(rclc_executor_add_timer(&executor, &timer));

Thank you for your help.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-08-23 01:37:45 -0600

Pablogs gravatar image

You are initing the executor with 1 handle (check the 3th argument) and then adding a sub and a timer.

Just do:

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

edit flag offensive delete link more

Comments

Hi Pablo, thank you for replying, your suggestion has solved my problem.

jarain78 gravatar image jarain78  ( 2021-08-23 14:40:19 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2021-08-20 10:16:40 -0600

Seen: 307 times

Last updated: Aug 23 '21