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

Fix ros1 topic discovery function not being called frequently at startup #68

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

achim-k
Copy link
Collaborator

@achim-k achim-k commented Nov 23, 2022

Public-Facing Changes
Fix ros1 topic discovery function not being called frequently at startup

Description
Topic discovery was called for the first time at max_update_ms (defaults to 5s) after startup. This patch fixes this and also adds a minimum duration of 100ms between two consecutive topic discoveries

Edit: Also fixes the _maxUpdateTimer member never being set from the ROS param

@@ -59,7 +60,7 @@ class FoxgloveBridge : public nodelet::Nodelet {
std::placeholders::_1, std::placeholders::_2));
_server->start(address, static_cast<uint16_t>(port));

_updateTimer = getMTNodeHandle().createTimer(ros::Duration(max_update_ms / 1e3),
_updateTimer = getMTNodeHandle().createTimer(ros::Duration(MIN_UPDATE_PERIOD_MS / 1e3),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why create a timer here at all? I think you can just directly call updateAdvertisedTopics()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True, much simpler. Also just noticed that _maxUpdateMs was never set from the parameter, so we always used the default value

@@ -269,7 +270,8 @@ class FoxgloveBridge : public nodelet::Nodelet {

// Schedule the next update using truncated exponential backoff, up to `_maxUpdateMs`
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Schedule the next update using truncated exponential backoff, up to `_maxUpdateMs`
// Schedule the next update using truncated exponential backoff, between `MIN_UPDATE_PERIOD_MS` and `_maxUpdateMs`

@jhurliman jhurliman merged commit 0b6d658 into main Nov 23, 2022
@jhurliman jhurliman deleted the achim/fix_ros1_timer branch November 23, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants