Skip to content

[Feature] Pause simulation while dragging interactive markers and via service calls#32

Merged
josephduchesne merged 9 commits intoavidbots:masterfrom
robustify:simulation-pausing
Oct 16, 2017
Merged

[Feature] Pause simulation while dragging interactive markers and via service calls#32
josephduchesne merged 9 commits intoavidbots:masterfrom
robustify:simulation-pausing

Conversation

@robustify
Copy link
Copy Markdown
Contributor

This PR makes the Update method of the World class skip the plugin, physics, and timekeeper update steps if an interactive marker is currently being dragged.

It seems to work without breaking anything, but I only tested it with the default world launched with server.launch.

Also, is there a more elegant way of pausing the simulation that I am unaware of?

@@ -97,12 +97,15 @@ World::~World() {
}

void World::Update(Timekeeper &timekeeper) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it might be cleaner here to create a SetPaused(bool) method on World and check World::paused_ rather than looking into InteractiveMarkerManager. I'm just wondering how we handle multiple things wishing to pause simulation (e.g. the pause/resume button idea, or some other system that wishes to pause sim).

The actual pause logic here should work fine.

@josephduchesne
Copy link
Copy Markdown
Collaborator

Also, is there a more elegant way of pausing the simulation that I am unaware of?

I think this is it. There may be a more elegant integration if we add runtime simulation speed controls at some point in the future (since that would be related to pause/resume). Currently sim speed can only be configured on launch.

@robustify
Copy link
Copy Markdown
Contributor Author

I just finished a std_srvs::Empty service to toggle paused state and an initial version of an Rviz tool that calls said service. To do this, I implemented a TogglePaused method in World that switches a paused_ property, similar to what you suggested.

I think we should have an independent pause flag for the interactive markers though, otherwise the simulation will resume on a MOUSE_UP, which defeats the use case of pause simulation --> move model --> rotate model --> resume simulation.

Besides the special case of the interactive marker dragging, I think a service interface resolves the issue of multiple other entities requesting pauses and resumes. However, it might be good and necessary to be able to explicitly set the pause state as opposed to simply toggling. Maybe three separate services: pause, resume, and toggle?

@josephduchesne
Copy link
Copy Markdown
Collaborator

josephduchesne commented Oct 15, 2017

I like the pause/resume/toggle idea. Maybe abstract IsPaused() to a method that can contain the paused_ (service_paused_ ?) + interactive markers check? That way it's clear what the intent is and we don't put pause specific logic in the update method.

@robustify
Copy link
Copy Markdown
Contributor Author

Agreed, and done.

@robustify robustify changed the title [Feature] Pause simulation while dragging interactive markers [Feature] Pause simulation while dragging interactive markers and via service calls Oct 16, 2017
@josephduchesne josephduchesne merged commit d4e975c into avidbots:master Oct 16, 2017
@josephduchesne
Copy link
Copy Markdown
Collaborator

Looks good! I tried it with turtlebot_flatland's roslaunch turtlebot_flatland turtlebot_in_flatland.launch and used the nav goal to drive the turtlebot around and it works well even in RViz. The tool de-selection doesn't work obviously (since RViz doesn't have the de-select feature you added), but that's about it.

@robustify robustify deleted the simulation-pausing branch November 26, 2017 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants