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

Hydro devel #25

Merged
merged 4 commits into from
May 1, 2015
Merged

Hydro devel #25

merged 4 commits into from
May 1, 2015

Conversation

dornhege
Copy link
Contributor

Fixing a couple of things with handling convex meshes. Mainly that qhull only returns proper triangles when called with "Qt".
It might be a good idea to also incorporate this into indigo, which I can't test.

@skohlbr
Copy link

skohlbr commented Feb 27, 2015

I merged the patch into Indigo (https://github.com/team-vigir/geometric_shapes/tree/indigo-devel) and tested. Unfortunately, I still get the infinite recursion as described in moveit/moveit_ros#567. I'm not sure if things improved (i.e. if it crashes only 5% as opposed to 10% of the time or so :) ). I double checked the code from the PR is indeed used and it still crashes.

I can't easily make my test available, but it mainly involves adding a mesh collision object and repeatedly moving it around.

This causes a process to run out of file handles,
where the next fopen call returns nullptr, which is passed
into qhull, which segfaults.
Fixes moveit/moveit_ros#481 and
fixes moveit/moveit_ros#526.
@mikeferguson
Copy link
Contributor

@dornhege I chatted with Ioan today, and will try to get this (and indigo devel) merged and released over the upcoming weekend.

@dornhege
Copy link
Contributor Author

dornhege commented Mar 5, 2015

Sounds good!

@davetcoleman
Copy link
Member

I'm testing this now on Indigo

@davetcoleman
Copy link
Member

I ran this just now and I'm not sure how to verify it improves anything. It seems to not have changed anything - the PlanningScenePlugin is still slow to load large meshes over ROS messages. What should I look for?

My demo:
screenshot from 2015-03-05 10 49 49

@dornhege
Copy link
Contributor Author

dornhege commented Mar 5, 2015

It depends, which of the commits you're checking. Nothing speeds things up, technically it should make it slower as triangulation is enabled.
The main thing would be: Enable sending the monitored scene and watch the file handles in /proc//fd without the last commit these should keep incrementing.
The wrong triangle generation for meshes is not in the planning scene's mesh, but in the ones generated for them, i.e. bodies::ConvexMesh. There was no display, yet, so I displayed them manually as triangle marker. Without 2545... they are broken. 840ce... adds a function that also orients faces for display. This has to be called manually.

@davetcoleman
Copy link
Member

I'm checking all of the commits. I'm loading each (high res) mesh into my node's planning scene then pushing it over the planning scene topic (using the planning scene monitor) to rviz where I have the PlanningScenePlugin displaying them like in the picture above. Its still not clear to me what was previously broken, I was assuming this PR would increase performance (an issue that I have).

I did notice a slight speed up when I first merged just the file handle fix (in the indigo-devel commit), but the other commits in this PR are unclear to me still.

Sorry if I'm being slow to understand!

@dornhege
Copy link
Contributor Author

dornhege commented Mar 5, 2015

Sorry, no performance improvements :(
When you define padding/scaling parameters for, e.g., a point cloud octomap updater, from these meshes, a bodies::ConvexMesh object is created. This is, where scaling and padding are applied, and that is the mesh, which has broken triangles. As that is never displayed, no one ever knew this. The triangles are also not used by any code in moveit, so besides the undefined behavior, nothing is observable.
I have a hacked point_containment_filter that sends markers for these. I can push that from my work machine tomorrow if you're interested.

@davetcoleman
Copy link
Member

I've observed incorrect/invisible collisions before in the collision_detection, but are you saying this convex mesh isn't used for that purpose?

In an ideal world we'd have a checkbox in the PlanningScene plugin in Rviz that allows us to visualize the convex mesh version of the planning scene...

@dornhege
Copy link
Contributor Author

dornhege commented Mar 6, 2015

I've put my debug code in here:
https://github.com/dornhege/moveit_ros/tree/visualize_convex_mesh

It sends a scaled_bodies marker. Without the patch these look broken.

Unfortunately, when padding is used, there is no proper and simple way to produce a correctly padded mesh. The current implementation is not correct, and the planeProjection function that I added is also not fully correct.
The mesh isn't directly used in the library, which is why this never mattered, although the way that the padding is currently applied can get unexpected results for meshes with acute angles, but that is a different issue.

I have only looked in scaling/padding for removing things from the octomap. That is where this is used. I'm not sure if it is used for collision tests.

@mikeferguson mikeferguson mentioned this pull request Mar 15, 2015
6 tasks
@davetcoleman
Copy link
Member

I like that you've made a visualizer for the padded meshes - I'm really into creating effective debug visualizations for MoveIt! components. I'd like to look into this myself but, since I don't have a direct application for it at the moment, can't find time to work on the new feature. But would you be interested in cleaning this up more such that there is an optional feature for publishing this mesh, that is enabled/disabled based on some parameter or flag? Then we could merge this into the main code

@dornhege
Copy link
Contributor Author

I wouldn't mind cleaning this up at all. My motivation was to visualize what's going on. However, I won't have time/knowledge to do this really properly. I'm basically missing a nice entry point for the visualization. Right now I just hook into the main maskContainment method in the point_containment_filter and bring up a publisher, which is quite ugly.

This should still be fine for debugging purposes, if it is parametrized, i.e., during normal operation it won't matter performance-wise. If you believe that a cleaned-up version of this will be merged, I'll do it.

@davetcoleman
Copy link
Member

@mikeferguson you said:

I chatted with Ioan today, and will try to get this (and indigo devel) merged and released over the upcoming weekend.

any progress? I'm ok with merging this PR as I've been running it for a month with no problems.

we should also get it merged into the indigo branch

@dornhege I'm always happy to merge passive features (that can be turned on) that help improve visualization and debugging. I believe a cleaned-up version of your commit will be merged

@@ -660,13 +660,35 @@ bool bodies::ConvexMesh::containsPoint(const Eigen::Vector3d &p, bool verbose) c
if (bounding_box_.containsPoint(p))
{
Eigen::Vector3d ip(i_pose_ * p);
ip = mesh_data_->mesh_center_ + (ip - mesh_data_->mesh_center_) * scale_;
ip = mesh_data_->mesh_center_ + (ip - mesh_data_->mesh_center_) / scale_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this in sync with the scale of other objects? Not sure division is what we want

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to be clear: This will scale the mesh UP, i.e. a scale of 1.5 will make it appear 1.5 times larger. This is what we want, right? If I understand what's happening here correctly, it transforms the coordinates to the internally unscaled mesh, thus they need to be scaled down.

I believe the main reason this was never discovered is that the bounding_box check happens before. The bounding_box is already scaled up and thus catches many cases.

Copy link

Choose a reason for hiding this comment

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

I believe this issue demonstrates a bug due to scale being inverted prior to above fix: moveit/moveit_ros#537

@isucan
Copy link
Contributor

isucan commented Mar 31, 2015

This looks fine to me, but I would feel much better if someone tried this and confirmed it works. My main concern is with the usage of scale -- perhaps I did not understand how it works, but it should be kept in sync with how it is used for other bodies.

@dornhege
Copy link
Contributor Author

dornhege commented Apr 9, 2015

@davetcoleman I have cleaned the visualize_convex_mesh branch and opened moveit/moveit_ros#574.

@mikeferguson
Copy link
Contributor

Seems everyone who has tested this is happy with the changes -- as we are running out of time before hydro is EOL, I'll merge and release

mikeferguson added a commit that referenced this pull request May 1, 2015
@mikeferguson mikeferguson merged commit fce1da0 into moveit:hydro-devel May 1, 2015
mikeferguson added a commit that referenced this pull request May 1, 2015
Forward port #25 into indigo-devel
@mikeferguson
Copy link
Contributor

ported to indigo-devel here: #34

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

5 participants