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

Complete scene return for component = 0 (#1067) #1424

Merged
merged 14 commits into from
May 14, 2019

Conversation

j-petit
Copy link
Contributor

@j-petit j-petit commented Apr 2, 2019

Description

When calling the /get_planning_scene service with component = 0, the service will return the full scene instead of an empty one (proposed in #1067)
I identified a single place in the codebase where a call to the service with all components takes place and replaced it with a call with components = 0. I am not to happy about writing it out as it is (that's why I had to add the comment), maybe someone can give me a hint to make it more understandable intuitively.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extended the tutorials / documentation, if necessary reference
  • Document API changes relevant to the user in the moveit/MIGRATION.md notes
  • Decide if this should be cherry-picked to other current ROS branches

Copy link
Contributor

@felixvd felixvd left a comment

Choose a reason for hiding this comment

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

Nice work, thanks.

I think what @v4hn meant was not if there is a call to the service that requests the whole scene, but that there might be a place in the code where get_planning_scene is called and an empty scene is expected as a response. E.g. a loop that requests parts of the scene when they need to be updated, and sends an empty service request otherwise.

It seems that no one is certain, so rather than hunting through the entire code base, it might be more efficient to check if performance drops after this change.

I did not test this locally, for the record.

@j-petit
Copy link
Contributor Author

j-petit commented Apr 8, 2019

I searched through the codebase thoroughly and am quite confident that there are no calls to the service where an empty scene response is expected. The service is called only through an intermediate function which always requests the full scene. Nevertheless, I would still like to do the performance check but I don't know what exactly do you mean when referring to performance and how would you measure it. Could you give me a hint how to do this?

@felixvd
Copy link
Contributor

felixvd commented Apr 8, 2019

The keyword is code benchmarking, and I would simply test if calling the get_planning_scene service is slower with req.components.components = 0 and req.components.components = UINT_MAX. If you call the service from a Python script a bunch of times and time the execution, that should be enough. There are much better tools for this, but I don't know them. This might be overkill anyway; someone with more compiler knowledge would know if this will affect performance.

Apart from that, I also had a look through the code and couldn't find any calls to this service except the PlanningSceneMonitor::requestPlanningSceneState wrapper which you changed. I think the change itself is fine.

To document it, I would personally add the same comment to the PlanningSceneRequest msg file and maybe a line like "get_planning_scene service now returns the whole scene if no components are specified" to the migration notes. Maybe some maintainers can give their opinion and request those changes. Apart from that and the first paragraph, I think this is fine.

That said, I haven't tested it.

@j-petit
Copy link
Contributor Author

j-petit commented Apr 18, 2019

The keyword is code benchmarking, and I would simply test if calling the get_planning_scene service is slower with req.components.components = 0 and req.components.components = UINT_MAX. If you call the service from a Python script a bunch of times and time the execution, that should be enough. There are much better tools for this, but I don't know them. This might be overkill anyway; someone with more compiler knowledge would know if this will affect performance.

I did some measurements and the difference is tiny. So I think we are good to go from this aspect.

To document it, I would personally add the same comment to the PlanningSceneRequest msg file and maybe a line like "get_planning_scene service now returns the whole scene if no components are specified" to the migration notes. Maybe some maintainers can give their opinion and request those changes. Apart from that and the first paragraph, I think this is fine.

I think that the comment is better fit in the service description (moveit_msgs/srv/GetPlanningScene.srv) as this is a property of the service and not the message itself?

@felixvd
Copy link
Contributor

felixvd commented Apr 18, 2019

Yes, the service description file is the right place. I got confused copying things around.

Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a comment

Choose a reason for hiding this comment

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

LGTM in general, with two small corrections:

  1. This should target master branch, not melodic-devel. You should be able to change the target branch on this same PR.
  2. IMO a change like this should go in MIGRATION.md, which I'd prefer to have in this PR.

@j-petit j-petit changed the base branch from melodic-devel to master May 3, 2019 08:10
MIGRATION.md Outdated Show resolved Hide resolved
@j-petit
Copy link
Contributor Author

j-petit commented May 3, 2019

[Resolved]
Sorry, when trying to get a clean PR through incorporating changes from master to my devel-branch, I messed it up. Cleaning up now...

MIGRATION.md Outdated
@@ -6,6 +6,7 @@ API changes in MoveIt! releases
- Extended the return value of `MoveitCommander.MoveGroup.plan()` from `trajectory` to a tuple of `(success, trajectory, planning_time, error_code)` to better match the C++ MoveGroupInterface ([790](https://github.com/ros-planning/moveit/pull/790/))
- `moveit_rviz.launch`, generated by MSA, provides an argument `rviz_config` to configure the rviz config to be used. The old boolean config argument was dropped. ([1397](https://github.com/ros-planning/moveit/pull/1397))
- Moved the example package `moveit_controller_manager_example` into [moveit_tutorials](https://github.com/ros-planning/moveit_tutorials)
- Requests to `get_planning_scene` service without explicitely setting "components" now returns full scene
Copy link
Contributor

Choose a reason for hiding this comment

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

-> explicitly

Copy link
Contributor

Choose a reason for hiding this comment

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

-> return

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, missed my spelling mistakes.

Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

One more typo. Code is a little bit too verbose. I suggested (and pushed) an alternative.

MIGRATION.md Show resolved Hide resolved
ps->getPlanningSceneMsg(res.scene, req.components);

// all scene components are returned if none are specified
if (!req.components.components)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested a more compact code snippet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks!

@rhaschke rhaschke added the awaits 2nd review one maintainer approved this request label May 4, 2019
@BryceStevenWilley
Copy link
Contributor

Travis failed because it looks like rosdep (or maybe github) was down a few days ago. I'm going to close and re-open this PR to retrigger the build.

@BryceStevenWilley
Copy link
Contributor

Attempting to fix flaky CI here.

@BryceStevenWilley
Copy link
Contributor

Trying one more time to get Travis to pass.

@rhaschke rhaschke merged commit 0eae58c into moveit:master May 14, 2019
@j-petit j-petit deleted the complete_scene_return branch May 14, 2019 11:43
@tylerjw tylerjw mentioned this pull request Jun 24, 2020
20 tasks
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.

None yet

4 participants