-
Notifications
You must be signed in to change notification settings - Fork 308
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
SPAWNER: Wait for the clock to be available before proceeding #432
SPAWNER: Wait for the clock to be available before proceeding #432
Conversation
30c657f
to
7b96109
Compare
It looks like the same issue was fixed upstream for C++ in |
I can make a similar fix in rospy if you think it is "safe" and has no side-effects. |
Actually, @matthew-reynolds , the change that you pointed is actually the opposite to what this change is suggesting. In the referenced change, the service wait fails because it uses the ros::Duration as opposed to the ros::WallDuration. The former takes in consideration the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I misunderstood the problem. I thought by "wait_for_service
times out prematurely" you meant that there was a problem with wait_for_service
. The issue is really that, in our use-case, the timeout should not start counting down until the system is "ready", which we're measuring by seeing whether Gazebo's clock is running.
That makes sense to me, seems like a reasonable change. Since rospy.get_rostime()
should only return 0 when the /use_sim_time
param is true, can we leverage that to provide more precise log messages?
controller_manager/scripts/spawner
Outdated
# Wait for the clock to be published | ||
while rospy.get_rostime() == rospy.Time(0): | ||
rospy.loginfo_throttle(30, "Waiting for the ROS Clock to be available...") | ||
rospy.sleep(0.2) | ||
rospy.loginfo("ROS Clock acquired. Proceeding to load the controller(s).") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's wrap this in a check of the /use_sim_time
param, and then update "ROS Clock" to "/clock" or "Simulated clock" or something along those lines?
I think that would be clearer, and it would prevent a confusing log message about "acquiring the clock" on wall-time systems.
@guillaumeautran @mikepurvis Bump. Is this approach being used at Clearpath? Assuming it's seen some use and has had a positive impact, we should try to get it tidied up and merged. Edit: And re-targetted to Noetic |
I think this is a useful feature we could incorporate, happy to cherry-pick to melodic too but indeed let's aim the PR to noetic first. If @matthew-reynolds is happy I'm happy to merge & release to Noetic |
7b96109
to
80a387a
Compare
Very sorry for dropping the ball on this one. I know its been a while..... @matthew-reynolds WRT wrapping the check in the Here is what I am thinking:
|
I think that's fine. In general I agree,
Shouldn't this be the other way ( |
The statement: |
This patch is to resolve an issue when the simulated clock is not published right away (coming from a remote gazebo instance for example). If the clock is not published right away, the rosservice wait_for_service times out prematurely and the controllers fail to be loaded since the system is not yet ready (no Gazebo clock). With no, gazebo system, the clock will be ready immediately and the spawner will proceed. Issue: ros-controls#431
80a387a
to
3fa6dd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the parameter is not defined, the default should be
False
doh. Been too long since I wrote Python ROS.
LGTM, thanks :) We'll let Bence take a look and merge if he's happy.
Perfect. Thanks much! |
ping @bmagyar for review. |
This patch is to resolve an issue when the simulated clock is not published right away (coming from a remote gazebo instance for example).
If the clock is not published right away, the rosservice wait_for_service times out prematurely and the controllers fail to be loaded since the system is not yet ready (no Gazebo clock).
With no, gazebo system, the clock will be ready immediately and the spawner will proceed.
Issue: #431