Skip to content

Conversation

@tkmtnt7000
Copy link
Member

I add topic hz converter.
Unlike topic_tools/throttle, this node can increase and stabilize the frequency of a particular topic.
For example, a topic in sensor_msgs/Image that is publishing at 10 Hz can be set to 30 Hz by continuing to publish the previous image topic.

And this node support multiple topic type.

Copy link
Member

@k-okada k-okada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add test code

by the way, why we need this?

  1. if we use approximate sync, increasing time window
    http://wiki.ros.org/message_filters#ApproximateTime_Policy

  2. if we ros node that expecting to run 30hz, but it run main code based on topic call back.

(defmethod intelligent-action
 (:init () (ros::subscribe "image" #'send self :cb))
 (:cb (msg) (setq cb-msg msg) (do-intelligent-job)) ;; expecting to run 30hz
)

Then you should write 30hz, loop and use latest sensor topics somethign like

(defmethod intelligent-action
 (:init () (ros::subscribe "image" #'send self :cb))
 (:cb (msg) (setq cb-msg msg))
(setq r (ros::rate 30))
(whille (ros::ok)
  (do-intelligent-job (*ia* . cb-msg)) ;; call do-intelligent-job 30hz, with latest image sensor data
  (send r :sleeep)
  (ros::spin-once))

Sometime peope uses one-shot-subscriber for this purpose

(whille (ros::ok)
  (setq cb-msg (one-short-subscriber "image"))
  (do-intelligent-job cb-msg) ;; call do-intelligent-job 30hz, with latest image sensor data
  (send r :sleeep)
  (ros::spin-once))

but it is not a good practice.

@knorth55
Copy link
Member

@tkmtnt7000 can we use #1748 instead of this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants