jsk-ros-pkg / jsk_roseus

ROS EusLisp Client
http://wiki.ros.org/roseus/Tutorials
17 stars 56 forks source link

[feature request] Support timer #237

Open garaemon opened 9 years ago

garaemon commented 9 years ago

like ros::Timer in roscpp http://wiki.ros.org/roscpp/Overview/Timers

garaemon commented 9 years ago

Of course, we can do it like

(while (ros::ok)
  (ros::sleep)
  (ros::spin-once)
  (proc))
k-okada commented 9 years ago

humm, I didn't know this feature, rospy also have same function http://wiki.ros.org/rospy/Overview/Time#Timer, ok I'll try.

◉ Kei Okada

On Wed, Feb 18, 2015 at 1:09 AM, Ryohei Ueda notifications@github.com wrote:

Of course, we can do it like

(while (ros::ok) (ros::sleep) (ros::spin-once) (proc))

— Reply to this email directly or view it on GitHub https://github.com/jsk-ros-pkg/jsk_roseus/issues/237#issuecomment-74693669 .

garaemon commented 9 years ago

It's a really good feature. For example, I use it to send UDP packets periodically https://github.com/jsk-ros-pkg/jsk_common/blob/master/jsk_network_tools/scripts/silverhammer_highspeed_streamer.py#L39

and publish diagnostic information periodically https://github.com/jsk-ros-pkg/jsk_common/blob/master/jsk_topic_tools/src/timered_diagnostic_updater.cpp#L45

(About diagnostic information, I know there is better way to do that with official diagnostic_updater)

We can write "background job" with timer and If we can implement it without threads (for example add simple hook before ros::spin-once in roseus.cpp), roseus can be almost concurrent.