Skip to content
This repository has been archived by the owner on Nov 13, 2017. It is now read-only.

rviz plugin: stop execution + update of start state to current #713

Merged
merged 6 commits into from
Jul 18, 2016

Conversation

rhaschke
Copy link
Contributor

@rhaschke rhaschke commented Jul 15, 2016

This PR combines ideas of #709 and #710 (and would replaces those PRs) to allow

I consider this work-in-progress. @davetcoleman Should we address this comment like suggested?

@rhaschke rhaschke mentioned this pull request Jul 15, 2016
@@ -88,7 +88,7 @@ class PlanningSceneDisplay : public rviz::Display
void queueRenderSceneGeometry();

// pass the execution of this function call to a separate thread that runs in the background
void addBackgroundJob(const boost::function<void()> &job, const std::string &name);
void addBackgroundJob(const boost::function<void()> &job, const std::string &name, bool ownThread=false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to this change, the PR is not ABI compatible. However, this is only related to the rviz plugin, which shouldn't be linked elsewhere. However, if in doubt, we can also target jade-devel.

Copy link
Member

Choose a reason for hiding this comment

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

The only thing that bothers me about this is that its not using ROS's underscore variable convention ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where do you want to have the underscores? As far as I understand it, only member variables should be suffixed by an underscore. Is there anything else?

Copy link
Contributor

Choose a reason for hiding this comment

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

all other argument names in this file use underscore notation, so please change ownThread to own_thread.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that breaking ABI in this code is well-justified by safety concerns.
You are not using addBackgroundJob anywhere though. :-)
Also, it might be a good idea to have a separate function name for that, instead of extending the existing one with orthogonal code. spawnBackgroundJob?
Alternatively, we could simply stick with the boost::thread one-liner you used in this request.
But then it might still be a good idea to have explicit comments above each of these lines to explain why this should not be addBackgroundJob.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@v4hn @davetcoleman Whatever you prefer. Please vote ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on a one-line spawnBackgroundJob function and a comment above that explains why this sometimes makes sense to use instead of addBackgroundJob.
I would be interested in a real explanation myself :-)

Copy link
Member

Choose a reason for hiding this comment

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

+1 to @v4hn's comment

@davetcoleman
Copy link
Member

I think its a good idea to address #709 (comment) but I understand if you don't have the cycles for it right now

@@ -55,14 +55,20 @@ void MotionPlanningFrame::planButtonClicked()
void MotionPlanningFrame::executeButtonClicked()
{
ui_->execute_button->setEnabled(false);
planning_display_->addBackgroundJob(boost::bind(&MotionPlanningFrame::computeExecuteButtonClicked, this), "execute");
boost::thread(boost::bind(&MotionPlanningFrame::computeExecuteButtonClicked, this));
Copy link
Member

Choose a reason for hiding this comment

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

Why use boost threads when this class already has its own background job framework setup? Seems like a departure of the functional style of the rest of the class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Executing the motion in the (single) background thread blocks visual updates of the scene robot.

Unfortunately, this is only mentioned in the commit log. I will add a source-code comment.

@@ -55,14 +55,22 @@ void MotionPlanningFrame::planButtonClicked()
void MotionPlanningFrame::executeButtonClicked()
{
ui_->execute_button->setEnabled(false);
planning_display_->addBackgroundJob(boost::bind(&MotionPlanningFrame::computeExecuteButtonClicked, this), "execute");
// executing the motion in the (single) background thread, blocks visual updates of the scene robot
boost::thread(boost::bind(&MotionPlanningFrame::computeExecuteButtonClicked, this));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are visual updates blocked? I suppose planning scene updates don't get through?
Maybe we could have two callback queues, one for callback related functions and one for handling of user interaction?
I suppose it is a good idea to have a uniform way to run background computation on button pressed throughout rviz-moveit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without separate threads for this, the background-job-thread was mainly blocked with waiting for the trajectory execution to finish. Everything else going to the background job simply needs to wait as well - which doesn't make sense.
To have a more uniform "look&feel", I augmented addBackgroundJob() with an extra option ownThread defaulting to false. For some reason the use of this code got lost when cleaning up my messy local repo. However, you suggested to go with boost::thread only. I have a slight preference for that too. Please vote for an option!

@rhaschke
Copy link
Contributor Author

I addressed all comments. Remaining issue is to turn ExecuteService in ExecuteAction and of course deal with #716.

@rhaschke rhaschke force-pushed the wip-stop-execution branch 2 times, most recently from f07c9f5 to efab226 Compare July 16, 2016 18:33
@rhaschke
Copy link
Contributor Author

Further cleaned up and rebased.
Disabling QueryStartState by default as suggested in #710.
Relies on #717.
For correct working of start-state updates, we need to fix #716 as well.
Could be merged now.

void MotionPlanningFrame::onFinishedExecution(bool success)
{
// visualize result of execution
if (success) ui_->result_label->setText("Executed");
Copy link
Member

Choose a reason for hiding this comment

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

you should line break after if() statement per ROS style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@davetcoleman
Copy link
Member

+1

rhaschke and others added 4 commits July 17, 2016 19:49
executing the motion in the (single) background thread blocks visual updates of the scene robot
…ot's current state."

when planning+executing
This property is "only" used by people playing around with planning internals,
e.g. the people maintaining the code..

The "average" user does not expect to be able to manipulate the start state of the motion-request
te makes from rviz - it doesn't make sense if you want to actually move the robot.
Therefore, disable the start-state by default to reduce the initial complexity
the average user is confronted with.
@rhaschke rhaschke merged commit 6a18450 into indigo-devel Jul 18, 2016
@rhaschke rhaschke deleted the wip-stop-execution branch July 18, 2016 08:26
rhaschke added a commit that referenced this pull request Jul 18, 2016
- cleanup structure of updateQueryStateHelper
- updateStartStateToCurrent after execution
- visualization: stop execution button
- suppress warning "Execution of motions should always start at the robot's current state." when planning+executing
- rviz display: disable Query Start State by default
@davetcoleman
Copy link
Member

since this is a relatively major change (new GUI button) to a stable (indigo) release I think you should announce this on the mailing list

also, please be sure to cherry-pick to jade and kinetic

thanks!

davetcoleman added a commit that referenced this pull request Jul 18, 2016
@wkentaro
Copy link
Contributor

@davetcoleman @rhaschke Thanks for working for this!

@davetcoleman
Copy link
Member

the thanks goes to @rhaschke !

@rhaschke
Copy link
Contributor Author

rhaschke commented Jul 18, 2016

please be sure to cherry-pick to jade and kinetic

Dave, you already merge-committed #718 into jade-devel. I would have loved to use a squashing commit only, i.e. forwarding jade-devel to the cherry-pick branch.
Anybody minds to rebase jade-devel there?

The same I would do for kinetic. For me this eases reading the git graph:
Merge commits are unique contributions, while cherry-picks could be committed directly.
I just had to use a PR to let Travis do the compile checking.

@rhaschke
Copy link
Contributor Author

since this is a relatively major change (new GUI button) to a stable
(indigo) release I think you should announce this on the mailing list

Dear Dave,
before announcing on the mailing list, I would like to finish #716,
which is a major pre-requisite for #713 to work correctly.
Hopefully, I find some time this evening to continue on that.
In the same vein, I'm planning to merge those changes to Kinetic only as
a bundle.

@davetcoleman
Copy link
Member

I just had to use a PR to let Travis do the compile checking.

Please make note of that in your PR if you don't want it actually merged yet.

Dave, you already merge-committed #718 into jade-devel.

Yes, I hadn't seen the PR until after I made that comment

You're announcement timeline sounds good, thanks!

rhaschke added a commit that referenced this pull request Jul 20, 2016
rhaschke added a commit that referenced this pull request Jul 21, 2016
otamachan pushed a commit to otamachan/moveit_ros that referenced this pull request Oct 22, 2017
- cleanup structure of updateQueryStateHelper
- updateStartStateToCurrent after execution
- visualization: stop execution button
- suppress warning "Execution of motions should always start at the robot's current state." when planning+executing
- rviz display: disable Query Start State by default
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants