-
Notifications
You must be signed in to change notification settings - Fork 13
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
Tracking issue: SDF Support in rmf_site #210
Comments
I wonder if it would make sense to extract a clone of the world and then directly override the components for these transparency settings, and then export that replicated world instead of the original? I think it's very unlikely that the user ever intends to have a glass floor. |
Same for this, maybe after we duplicate the world, we can delete all outline meshes from that world before exporting? |
A third option would be to add a warning. This is what I've seen most software do for scenarios like this. |
It's very simple to remove transparency from a floor then export it. I didn't do it because we do allow the possibility of setting transparent walls to support glass walls and I thought we might want ot keep the option open for transparent floors as well but I'll do that. WRT the outlines, The |
This seems like the perfect candidate for something that should go into the in-app log. Also the kind of thing that belongs in the diagnostic tool. |
Yap we have warnings in place for this case! However, I believe |
I managed to make this a bit less painful and removed the dependency on an
I am quite unhappy with the amount of duplicated code that this resulted in, but hopefully on the With these changes we can get rid of some of the steps and now the testing procedure becomes:
This is for testing legacy projects. For new projects with the site editor, those should be saved as And once Harmonic is released as binaries we won't need any special steps. |
This issue tracks what's been done and what's currently missing for SDF support in
rmf_site_editor
, to make it a full replacement for the legacyrmf_traffic_editor
workflow.Why
By adding a capability in site editor to export SDF models and worlds, we can integrate it with our current pipeline and start to get some real usage and feedback from it. Users can use rmf_site to have an accurate 3D preview of what their world would be like then export it to Gazebo.
What
The plan is to have a minimal implementation of the features offered by
rmf_traffic_editor
to build functional sites, as well as what is offered byrmf_building_map_tools
to export them to Gazebo worlds.How
There are three large parts to this effort, ordered by increasing controversiality. 2) and 3) are split in two different branches if we decide to not go for 3).
Feature parity with traffic editor
This is the least controversial and area that we should be working on regardless. We need to make sure that all the features offered by traffic editor are offered by site editor, and the ones that are not offer a good migration path.
On the top of my head, areas to check:
mutex
is still pending. As mentioned in the PR some features might need validation as well.rmf_demos
, the campus, that currently fails to import.Export SDF
This is where the bulk of the work lies and where I took some decisions on how to approach it.
A large part of the problem is how do we export the meshes for what we see in the world?
In the legacy workflow, we used to add
include
tags for each model in the world and manually generateobj
meshes for items such as floors and walls by doing the triangulation, calculating the texture coordinates etc.This works but in my opinion is not too optimal for a variety of reasons:
<include>
tags.For these reasons I took the executive decision to rethink how we export meshes.
I created a crate (warning it's very experimental!) to export arbitrary bevy meshes to GLB files. The idea is that we can take anything that is rendered and throw it in a GLB exactly as it is, so we are guaranteed to have parity between what we see in the site editor and what is exported.
The site editor then collates all static meshes in each level into a single large file, and all non static meshes into separate files.
This has a few benefits:
There are however some drawbacks:
Materials are exported exactly the way they are rendered but in some cases this might not be desirable. For example, floors are set to semi-transparent by default when a drawing is added to make sure the users can see both. For this reason exported floors will be semi transparent which might not be what the user expects.I solved this by despawning drawings in headless SDF export mode. It's not ideal but worlds are not cloneable so the alternatives were cloning the materials, ovewriting the transparency or skipping the transparency updating system in headless mode.Same for meshes, I still have to test to be sure but I suspect the outlines might be exported if it was to be rendered while exporting.I checked and it seems outlines are not part of the mesh.bevy_gltf_export
library which uses a "crude"HashMap<Vec<u8>, Index>
to reuse binary buffers between differen meshes without which the static meshes would be very large.rmf_site_format
takes care of converting a site to an SDF world and this can be done regardless of the site editor. However, loading assets and spawning meshes requires a full site editor running, this part of the export is done in the site editor itself. This is especially tricky for meshes since rmf_site_format needs to export a world that refers to a specific mesh with a certain name, and the site editor needs to make sure it follows the same naming convention. This works for now but is a bit brittle.In general I'm quite convinced that this is a good way forward but there are still rough edges. As I will discuss later.
Headless mode
The (current) idea is to make
rmf_site_editor
a drop in replacement forrmf_building_map_tools
. If we analyze the map building pipeline we can see that map building is a several step process:All of this is done at build time of the map package.
The idea is that to replace this workflow we would need the site editor to also have the capability of being run in headless mode and export the world as an SDF.
This is the part that is most hacked together right now. In my POC implementation I added a (non wasm) command line argument
--headless-export [file_name]
. When the site editor is ran with it, it will not initialize a window and run until all the models either have spawned or failed spawning, finally it will send a save event and save the whole package including world meshes and navgraphs to the requested path.This is a bit hacky however, and not really CPU efficient since I believe most of the time the application is I/O bound and doesn't need to actually do much since it's fetching models. It currently seem to take a quite significant amount of time but I'm not exactly sure why. I suspect it's because for each model it needs to try to fetch them from fuel in a few different formats and that can take some time.
Current caveats and rough edges.
Trimesh-trimesh contach hash table bucket overflow
and I believe the static collision mesh is too big. But anyway airport terminal shouldn't be our main demo since it also includes a lot of collada assets.include
tag whenever the model name is eitherTeleportIngestor
orTeleportDispenser
but this is obviously not ideal and we should get rid of it. We should have proper support for these anyway at some point so we can revisit once there is a concept or an ingestor, dispenser, or in general workcell in the site editor.include
tag but ideally at some point we would have concept of a robot in the site editor, at which point we can use those properties to generate a proper tag.<plugin>
tags since their serialization / deserialization must allow for arbitrary trees so we need to bypass / lose a lot of the benefits ofserde
. At the end of the day the amount of code added is still less than the size ofrmf_building_map_tools
with almost the same functionality, but still.Finally, since the data format in rmf_site is different from the legacySolved by switching to json..building.yaml
and it usesron
, it was necessary to create a new node for serving the building map. This node usesrclrs
so it also needs rclrs to be compiled and sourced.Test it!
As mentioned in the caveats testing is a bit involved right now. Specifically you will need to:
rmf_site
to your workspace, branchluca/headless_sdf_export_poc
.rmf_demos
:luca/site_editor_poc
rmf_simulation
:luca/ecs_plugin_sandbox
rmf_traffic_editor
:luca/site_editor_support
rmf_ros2
:luca/event_based_updates
rmf_visualization
:luca/event_based_states
ros_gz
branchiron
to your workspace.export GZ_VERSION=harmonic
in your terminal to make theros_gz_bridge
compile against harmonicIt should work! I tested the following:
rmf-web
visualization and control of doors and lifts (latter pending Hammer/adapter lift request qos rmf-web#930) as well as trajectory visualization. Only missing part here is the visualization of named waypoints.Note that the linked
rmf_demos
branch switches the whole pipeline (world building, as well asbuilding_map_server
) to use.site.json
files.In the branch itself I converted and committed
office.site.json
andhotel.site.json
so these two demos (and only these two demos) should work.Other worlds can be trivially converted but I avoided it in the interest of not committing too many files.
The text was updated successfully, but these errors were encountered: