ros2.Crystal Is there a not_composable Time example?

asked 2019-03-04 00:57:47 -0500

Obeseturtle gravatar image

updated 2019-03-04 01:36:55 -0500

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

I found lamba and member_function timer examples but could not find one for not_composable. 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.

edit retag flag offensive close merge delete

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.

tfoote gravatar image tfoote  ( 2019-03-04 01:21:52 -0500 )edit

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

Obeseturtle gravatar image Obeseturtle  ( 2019-03-04 01:37:51 -0500 )edit

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.

tfoote gravatar image tfoote  ( 2019-03-04 02:26:55 -0500 )edit

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.

Obeseturtle gravatar image Obeseturtle  ( 2019-03-04 02:34:52 -0500 )edit

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

tfoote gravatar image tfoote  ( 2019-03-04 02:37:12 -0500 )edit

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.

Obeseturtle gravatar image Obeseturtle  ( 2019-03-04 02:38:07 -0500 )edit

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.

Obeseturtle gravatar image Obeseturtle  ( 2019-03-04 02:42:43 -0500 )edit

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?

Obeseturtle gravatar image Obeseturtle  ( 2019-03-04 02:47:44 -0500 )edit