-
Notifications
You must be signed in to change notification settings - Fork 116
rviz plugin: stop execution + update of start state to current #713
Conversation
@@ -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); |
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.
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.
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.
The only thing that bothers me about this is that its not using ROS's underscore variable convention ;-)
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.
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?
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.
all other argument names in this file use underscore notation, so please change ownThread
to own_thread
.
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 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
.
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.
@v4hn @davetcoleman Whatever you prefer. Please vote ;-)
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.
+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 :-)
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.
+1 to @v4hn's comment
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)); |
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.
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.
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.
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)); |
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.
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.
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.
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!
I addressed all comments. Remaining issue is to turn ExecuteService in ExecuteAction and of course deal with #716. |
f07c9f5
to
efab226
Compare
void MotionPlanningFrame::onFinishedExecution(bool success) | ||
{ | ||
// visualize result of execution | ||
if (success) ui_->result_label->setText("Executed"); |
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.
you should line break after if() statement per ROS style
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.
Fixed.
+1 |
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.
efab226
to
181e180
Compare
- 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
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! |
cherry-picked #713 from indigo-devel
@davetcoleman @rhaschke Thanks for working for this! |
the thanks goes to @rhaschke ! |
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. The same I would do for kinetic. For me this eases reading the git graph: |
Dear Dave, |
Please make note of that in your PR if you don't want it actually merged yet.
Yes, I hadn't seen the PR until after I made that comment You're announcement timeline sounds good, thanks! |
- 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
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?