Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use SteadyTimer in message_filters #1247

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TimeSequencer : public SimpleFilter<M>
* \param delay The minimum time to hold a message before passing it through.
* \param update_rate The rate at which to check for messages which have passed "delay"
* \param queue_size The number of messages to store
* \param nh (optional) The NodeHandle to use to create the ros::Timer that runs at update_rate
* \param nh (optional) The NodeHandle to use to create the ros::SteadyTimer that runs at update_rate
*/
template<class F>
TimeSequencer(F& f, ros::Duration delay, ros::Duration update_rate, uint32_t queue_size, ros::NodeHandle nh = ros::NodeHandle())
Expand All @@ -105,7 +105,7 @@ class TimeSequencer : public SimpleFilter<M>
* \param delay The minimum time to hold a message before passing it through.
* \param update_rate The rate at which to check for messages which have passed "delay"
* \param queue_size The number of messages to store
* \param nh (optional) The NodeHandle to use to create the ros::Timer that runs at update_rate
* \param nh (optional) The NodeHandle to use to create the ros::SteadyTimer that runs at update_rate
*/
TimeSequencer(ros::Duration delay, ros::Duration update_rate, uint32_t queue_size, ros::NodeHandle nh = ros::NodeHandle())
: delay_(delay)
Expand Down Expand Up @@ -213,22 +213,22 @@ class TimeSequencer : public SimpleFilter<M>
}
}

void update(const ros::TimerEvent&)
void update(const ros::SteadyTimerEvent&)
{
dispatch();
}

void init()
{
update_timer_ = nh_.createTimer(update_rate_, &TimeSequencer::update, this);
update_timer_ = nh_.createSteadyTimer(ros::WallDuration(update_rate_.toSec()), &TimeSequencer::update, this);
Copy link
Member

Choose a reason for hiding this comment

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

Can WallDuration really not be initialized from a Duration? That seems like an API fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC it can't... but I didn't check that again and did it explicitly just to be sure...

}

ros::Duration delay_;
ros::Duration update_rate_;
uint32_t queue_size_;
ros::NodeHandle nh_;

ros::Timer update_timer_;
ros::SteadyTimer update_timer_;

Connection incoming_connection_;

Expand Down