-
Notifications
You must be signed in to change notification settings - Fork 9
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
Planning scene transcription #23
Conversation
demo file had to be changed to utilise the loaded drake pipeline and the KTOpt plugin
For some reaosn demo cmake is not being configured.
Adds an error message if the robot description in the planner manager has not yet been set. Will not proceed to service any motion planning request until robot description has been set.
This commit wants tests if the initialized subscriber's callback is executed to set the robot description.
For now, loading urdf from drake models rather than ros subcription
This remains untested, build complete
This commit tested a complete motion plan request from the planning pipeline benchmark. It visualises resulting plan on RViZ
Cleanup configs
This commit made a few changes based on the comments fomr reviews. Additionally joint velocties are also set in the robot state.
Hacked MeshCat together
Hi @sea-bass @sjahr, following is an update I have transcribed a basic planning scene with a box somewhere within the vicinity of the robot, big enough that it matters, small enough that it can find a solution. I have a basic transcription (PlanningScene to SceneGraph) up on the latest commit. sanity check: KTOPT plans and cube is visualised in meshcat. However, I am unable to test it as it keeps running into a segmentation fault. The current hypothesis is that the planning scene doesn't yet have all the information to iterate through at the time the MutlibodyPlant and SceneGraph are created (setRobotDescription). This is happening when the planner manager is asked for a planning context. Any suggestions on debugging? On a broader note, I know @sea-bass is in favor of writing tests for each part of the code. I have postponed this up until I have a basic (box-test) planning scene transcription. If I had to start setting these up, could you also point me towards resources. |
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.
See my comment about trying to not rely on raw pointers to see about the segfault.
As for testing references, you could maybe borrow from here?
https://github.com/moveit/moveit2/blob/main/moveit_core/planning_scene/test/test_planning_scene.cpp
SceneGraph<double>* scene_graph_{}; | ||
MultibodyPlant<double>* plant_{}; | ||
std::unique_ptr<Diagram<double>> diagram_; | ||
std::unique_ptr<Context<double>> diagram_context_; | ||
Context<double>* plant_context_{}; | ||
Context<double>* visualizer_context_{}; |
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.
my first suspicion as to why you're getting segfaults is that storing these raw pointers as member variables is actually very memory unsafe and likely something went out of scope.
I think you should actually try removing scene_graph_
, plant_
, plant_context_
, and visualizer_context_
from the member variables -- we recently ran into this at work.
The correct usage is to leverage the diagram_
smart pointer you have to do extractions like these in the function scopes that require them:
const auto& plant =
dynamic_cast<const drake::multibody::MultibodyPlant<double>&>(diagram_->GetSubsystemByName("plant"));
auto& plant_context = diagram_->GetMutableSubsystemContext(plant, diagram_context_.get());
(and there's probably a similar usage for retrieving the scene graph)
I know it seems like a lot, but I think this is how Drake is intended to be used based on our tireless comb through the source code in lieu of there being very little examples to borrow from.
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.
Thanks for this, I did see them use this in their examples initially, but I went for whatever was compiling. I'll refactor accordingly and test.
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.
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.
Still need to test it but here are some small clean-up comments you should address before we merge it 😃
Oh an it looks like you need to rebase on main |
Actually, I meant to bring this up. @kamiradi I think you might be making things difficult for yourself by continuing to use the same EDIT: Another day, another using the wrong account 😅 |
Yeah, I was about to ask general best practices on git and open source, because I may not be using the tool like I am supposed to. I'll bring it up in our next meeting. |
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.
Just run pre-commit and we can go ahead and merge this!
@sea-bass @sjahr. Any idea how I can run the pre-commit script inside the docker container. When I run it inside the container, since it is a submodule it raises a "not a git repository error". I tried running it locally on my machine, but that means I run it with clang-format-12 (I believe 14 is required), and does not autoformat the code. I don't have the option of upgrading it as it may lead to other dependencies being upgraded which may break other projects. Any workarounds? |
Is the .git folder, or the pre-commit-config.yaml file ignored in the dockerignore file and not mounted into the container? Or otherwise just not mounted as a volume? That would be a thing to check right away. Else, I can look into this. In the meantime, just change the clang-format version in your precommit file! |
Seems like it is... dumb question, are you running this from the workspace root, or from the |
I think I know what is happening, I am currently working with moveit_drake as a gitsubmodule as part of another moveit_drake_contrib package I created at the start of the project. Which is why it does not have a .git folder but a placeholder file within docker. I'll reclone the repository and it should work within docker. |
Nope that wasnt the issue, I still get "not a git directory" from within docker |
I just tried it out by building the regular Docker container. I had to do the following:
Then, in the container:
|
This PR works on transcribing a Moveit planning scene to Drake's scene graph.
Edit: @sea-bass @sjahr This PR is out of the draft stage. It accomplishes the following
MinimumDistanceLowerBoundConstraint
to the optimization problem. This does the necessary collision checking.Open for reviews