Skip to content

Add visual geometry mesh URL#2854

Open
felixvd wants to merge 18 commits intomoveit:masterfrom
felixvd:add-visual-geometry-url
Open

Add visual geometry mesh URL#2854
felixvd wants to merge 18 commits intomoveit:masterfrom
felixvd:add-visual-geometry-url

Conversation

@felixvd
Copy link
Copy Markdown
Contributor

@felixvd felixvd commented Aug 28, 2021

Description

Remember this lightning talk?

Screenshot from 2021-08-28 13-12-23

I finally got around to implementing this. CollisionObjects can now have a visual geometry, and the pick-place demo now picks up a beer bottle from a table:

2021-08-28.visual.geom.32.mp4

The collision geometry is as simple as before. See the new GUI fields on the left:

Screenshot from 2021-08-28 13-28-09

There are some limitations about this PR:

  • All meshes need to have the same scale, because they are scaled by the parameter in the Rviz display. This is because I initially thought that adding visual_geometry_mesh_scaling_factor to each AttachedBody would make the constructor too long, since it is already a little ridiculous. But in retrospect, I should have done it. Or added a VisualGeometry object that both world.cpp and AttachedBody objects use. But I'm low on time, so it is how it is for now.

  • There are no tests, even though it's easy to lose the geometry during copying (thanks for finding the last bug @simonschmeisser ). I also won't have the time to write any ;(

I would merge this because the functionality is useful, but I would prefer the scale to be defined per object. I don't know when I can make this change though, so if anyone feels so inclined, please be my guest. It should be straightforward to follow the changes in this PR and add a per-object scaling factor.

Some other notes:

  • I split PlanningSceneRender into a visual and collision node, like the rviz Robot. I originally tried to avoid adding another scene node, but changed my mind after trying it. This is definitely the better way.

  • I am increasingly convinced that the separation into robot and scene is (and creates) cruft and should go. The conversion from world objects to AttachedBody objects is probably where it is the most obvious. Unifying them would go a long way to de-cluttering the PlanningScene code base. I would refer to Tesseract's messages (and maybe environment) to improve on this. No need to reinvent the wheel. This has come up before (e.g. Representation of Attached vs Non-Attached objects in planning_scene #1980 ) and relates to the scene graph discussions.

  • The tutorial demo sadly doesn't use this prettier table. Maybe @simonschmeisser will add color for the visual mesh and tackle this some day :)

  • @simonschmeisser I boldly added your name to a TODO in the code that you seemed most knowledgeable about.

Fixes #2284. Depends on a PR in moveit_msgs and is required for the PR to moveit_tutorials.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI

Copy link
Copy Markdown
Contributor

@simonschmeisser simonschmeisser left a comment

Choose a reason for hiding this comment

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

some small first remarks while looking at the code as reference for another PR

std::string visual_geometry_mesh_url_;

/** \brief The pose of the visual geometry (mesh). */
Eigen::Isometry3d visual_geometry_pose_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Eigen::Isometry3d visual_geometry_pose_;
Eigen::Isometry3d visual_geometry_pose_ = Eigen::Isometry3d::Identity();

then you can skip that later

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this creates issues with Eigen::Isometry3d being forward declared (but I don't think it is ...) you could also set the value in the constructor and move the constructor to the cpp file (where it actually belongs ...)

Comment on lines +90 to +91
obj->visual_geometry_mesh_url_ = "";
obj->visual_geometry_pose_ = Eigen::Isometry3d::Identity();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
obj->visual_geometry_mesh_url_ = "";
obj->visual_geometry_pose_ = Eigen::Isometry3d::Identity();

we did that in the header already, see above

Comment on lines +265 to +266
obj->visual_geometry_mesh_url_ = "";
obj->visual_geometry_pose_ = Eigen::Isometry3d::Identity();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
obj->visual_geometry_mesh_url_ = "";
obj->visual_geometry_pose_ = Eigen::Isometry3d::Identity();

same here, strings are always empty when created

@simonschmeisser
Copy link
Copy Markdown
Contributor

simonschmeisser commented Oct 2, 2021

Requires felixvd/moveit_msgs#1 (or moveit/moveit_msgs#129 ) as well

Open Todos:

  • Less noise
  • There is some jumping around when attaching/detaching objects, something is strange with transformations
  • Decide when to enable/disable mesh_use_embedded_material
  • Check if the pretty table works ✨

Seriously though, textured objects now work. The tinting sometimes looks really horrible sometimes just a bit horrible, not sure how to fix that

@tylerjw tylerjw mentioned this pull request Oct 14, 2021
6 tasks
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 20, 2021

Codecov Report

Merging #2854 (a97026d) into master (ab42a1d) will increase coverage by 0.04%.
The diff coverage is 71.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2854      +/-   ##
==========================================
+ Coverage   61.56%   61.60%   +0.04%     
==========================================
  Files         370      370              
  Lines       33147    33220      +73     
==========================================
+ Hits        20405    20461      +56     
- Misses      12742    12759      +17     
Impacted Files Coverage Δ
...tection/include/moveit/collision_detection/world.h 96.67% <ø> (-3.33%) ⬇️
...g_scene_interface/src/planning_scene_interface.cpp 52.20% <ø> (+1.10%) ⬆️
moveit_core/planning_scene/src/planning_scene.cpp 63.73% <56.53%> (-0.35%) ⬇️
moveit_core/collision_detection/src/world.cpp 89.85% <84.62%> (-0.36%) ⬇️
...t_state/include/moveit/robot_state/attached_body.h 100.00% <100.00%> (ø)
...bot_state/include/moveit/robot_state/robot_state.h 84.36% <100.00%> (ø)
moveit_core/robot_state/src/attached_body.cpp 75.76% <100.00%> (ø)
moveit_core/robot_state/src/conversions.cpp 65.79% <100.00%> (+0.79%) ⬆️
moveit_core/robot_state/src/robot_state.cpp 52.59% <100.00%> (+0.04%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab42a1d...a97026d. Read the comment docs.

@simonschmeisser
Copy link
Copy Markdown
Contributor

grafik

So colored or textured objects are still not that impressive but it works. Tinting is to strong but I don't understand how to influence that yet.

Let the reviews begin! I will squash some of the commits before merging.

@simonschmeisser simonschmeisser self-requested a review November 27, 2021 22:08
@simonschmeisser simonschmeisser marked this pull request as ready for review November 27, 2021 22:09
@felixvd
Copy link
Copy Markdown
Contributor Author

felixvd commented Nov 29, 2021

So colored or textured objects are still not that impressive

Speak for yourself!!! I think they look great. Thanks a lot for pursuing this PR.

@ahmadabouelainein
Copy link
Copy Markdown

Has this feature been discarded or is still pending?

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.

Add visual representation to CollisionObjects

3 participants