Robotics StackExchange | Archived questions

ros2.Crystal Is there a not_composable Time example?

I am currently learning how to use timers and rclcpp::Time in ROS2.

I found lamba and memberfunction timer examples but could not find one for notcomposable. I was wondering if there was an example on how to use ROS timer in ROS2 using the not composable method.

The examples can be found using the following link.

Also, I want to learn how to use rclcpp::Time(Simulated or Clock which uses the system time), and wanted to know if in ROS2, if it is better to use system time or ROS like Simulated time.

Asked by Obeseturtle on 2019-03-04 01:57:47 UTC

Comments

Please link to the examples you're referring to as well as edit your question to be a little bit clearer. It's not obvious to me for what you're asking for an example.

For your second question please ask it as a second question. A more fully worded question will get better answers.

Asked by tfoote on 2019-03-04 02:21:52 UTC

Understood. Thank you for your feed back. I have edited the original question, I hope it helps.

Asked by Obeseturtle on 2019-03-04 02:37:51 UTC

What is 'not_composable' to you? That sounds like a node type, but the other terms are for callback types.

Ros time can be either simulated or system time. If you're running on a love system it's usually recovered to have the system time active. But if you're not, then simulated time is better.

Asked by tfoote on 2019-03-04 03:26:55 UTC

not_composable to me means that: I do not have to inherit other classes. I can create nodes by using rclcpp::. I am using rclcp::Clock but, I have to either create a callback for it or use it in a loop. Thus the reason I wanted to see an example to see if I was doing it wrong.

Asked by Obeseturtle on 2019-03-04 03:34:52 UTC

The timer callbacks don't care what class they're being invoked on, they just have to have the right signature.

Asked by tfoote on 2019-03-04 03:37:12 UTC

I also noticed that if i used .sec I would get an extremely large number like Time :1551685328 Example: rclcpp::Clock ros_clock(RCL_ROS_TIME); Time ros_now = ros_clock.now(); std::cout << "Time :" << ros_now.sec << std::endl; I am still learning about ROS2, I would benefit by seeing an example.

Asked by Obeseturtle on 2019-03-04 03:38:07 UTC

Thank you tfoote for both answers. I will study up on love system, timer callbacks, and signatures. Since I do not know the meaning of these keywords, it means that my issue may be caused by not fully understanding ROS time and what it is intended to be used for.

Asked by Obeseturtle on 2019-03-04 03:42:43 UTC

Do you have any recommendations on what to read to learn more about ROS2 time? Or should I learn about roscpp Tme first before jumping in to RCLCPP time?

Asked by Obeseturtle on 2019-03-04 03:47:44 UTC

Answers