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

Add parameter default_planning_scene to load planning scene geometry on startup #2949

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

pac48
Copy link
Contributor

@pac48 pac48 commented Aug 5, 2024

Description

This PR adds a new parameter to the move_group node that allows users to specify a planning scene file to load on startup. The parameter is a string containing the absolute file path. The parameter can be set with either $(find-pkg-share pkg-wth-planning-file) for XML or ament_index_python.packages.get_package_share_directory in Python to facilitate specifying the path. If the parameter is not specified, the move_group node will behave as it previously did. If there is an error loading the file, the node will exit with a fatal error.

Checklist

  • Extend the tutorials / documentation reference
  • Create tests, which fail without this PR reference

Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
Signed-off-by: Paul Gesel <paul.gesel@picknik.ai>
@sjahr sjahr self-requested a review August 6, 2024 08:54
std::string path = nh->get_parameter("default_planning_scene").as_string();
std::fstream file_stream;
file_stream.open(path, std::fstream::in);
if (!file_stream.is_open() || !ps->loadGeometryFromStream(file_stream))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is too dangerous because you're not locking the planning scene when writing to it (see

).
You can get thread safe access like this:

{
  planning_scene_monitor::LockedPlanningSceneRW ps = planning_display_->getPlanningSceneRW();
  if (ps)
     FANCY MODIFICATIONS
} // End scope to release lock

Copy link

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions bot added the stale Inactive issues and PRs are marked as stale and may be closed automatically. label Sep 23, 2024
@sjahr
Copy link
Contributor

sjahr commented Oct 11, 2024

@pac48 Should we close this?

@github-actions github-actions bot removed the stale Inactive issues and PRs are marked as stale and may be closed automatically. label Oct 14, 2024
@pac48
Copy link
Contributor Author

pac48 commented Oct 21, 2024

@sjahr We should try to merge this. I think the change to the test should either be deleted or more effort has to be put in to make it not flaky.

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