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

Fix enviroment system loading mechanism #1842

Merged
merged 33 commits into from
Oct 3, 2023
Merged

Conversation

arjo129
Copy link
Contributor

@arjo129 arjo129 commented Dec 20, 2022

🦟 Bug fix

Fixes #

Summary

Currently, there is an issue with the way the Environment loader plugin loads data. In particular it directly writes to the ECM. While this makes sense intuitively, it does not work in practice as the GUI runs on a client process while systems that use it run on the server. This PR fixes this issue by introducing a topic through which the GUI may load Environment Data on the server.

Depends on:

TODO:

  • This commit breaks the visualization plugin. Fix it so the visualization plugin runs the data sampling off the server plugin.

Signed-off-by: Arjo Chakravarty arjo@openrobotics.org

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Currently, there is an issue with the way the Environment loader plugin loads data. In particular it directly writes to the ECM. While this makes sense intuitively, it does not work in practice as the GUI runs on a client process while systems that use it run on the server. This PR fixes this issue by introducing a topic through which the GUI may load Environment Data on the server.

TODO:
- [ ] This commit breaks the visuallization plugin. Fix it so the visuallization plugin runs the data sampling off the server plugin.

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Dec 20, 2022
@osrf-triage osrf-triage added this to Inbox in Core development Dec 20, 2022
arjo129 added a commit to gazebosim/gz-msgs that referenced this pull request Dec 20, 2022
Required by gazebosim/gz-sim#1842

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
@azeey azeey moved this from Inbox to In progress in Core development Jan 9, 2023
Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
arjo129 added a commit to gazebosim/gz-msgs that referenced this pull request Jan 25, 2023
Required by gazebosim/gz-sim#1842

Signed-off-by: Arjo Chakravarty <arjo@openrobotics.org>
@azeey
Copy link
Contributor

azeey commented Feb 13, 2023

@arjo129 are you actively working on this?

@arjo129
Copy link
Contributor Author

arjo129 commented Feb 14, 2023

I have not had any hours to work on this this month. However if I get some time at the end of the week I will probably revisit this. Theres still a fair deal of work needed on the visuallization side and some testing to be done.

Visuallization still goes 💥

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Vis still not working

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Now left with one more crash that needs debugging when "play" is hit.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Also refactored the visualization tool out.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 marked this pull request as ready for review February 23, 2023 07:19
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129 arjo129 added the needs upstream release Blocked by a release of an upstream library label Feb 23, 2023
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@mabelzhang mabelzhang self-requested a review February 27, 2023 18:34
@azeey azeey moved this from In progress to In review in Core development Apr 10, 2023
Copy link
Contributor

@mabelzhang mabelzhang left a comment

Choose a reason for hiding this comment

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

Note to self: 1 file left to look at (src/systems/environment_preload/EnvironmentPreload.cc)
Wanted to put in the review to get this going in case I don't have more time rest of the week to look at that file.

How does one test this? I see in gz-sim/examples/worlds, these files exist:
environmental_data.csv
environmental_sensor.sdf
Do those files test this PR?

src/gui/plugins/environment_loader/EnvironmentLoader.cc Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.hh Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.hh Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.cc Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.cc Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.cc Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.cc Outdated Show resolved Hide resolved
src/systems/environment_preload/VisualizationTool.cc Outdated Show resolved Hide resolved
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@azeey
Copy link
Contributor

azeey commented Aug 21, 2023

@arjo129 Do you have time to resolve the conflicts and address any remaining feedback?

@arjo129
Copy link
Contributor Author

arjo129 commented Aug 21, 2023

Yep. Should be able to fix this by friday.

arjo129 and others added 5 commits August 22, 2023 20:59
Co-authored-by: Mabel Zhang <mabel@openrobotics.org>
Signed-off-by: Arjo Chakravarty <arjo129@gmail.com>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
This commit automatically loads the environment preload plugin if it is
missing.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129
Copy link
Contributor Author

arjo129 commented Aug 25, 2023

As promised, this is ready for review. CI is failing because we need an upstream release.

I solved the issue where we were unable to load the environment from the empty world. Here is an example of how to use the plugin:
out.webm

First search for Environment Loader. Load the plugin. You will also need the Pointcloud and Environment Visuallization plugins to load the visuallization. Once these panels are loaded simply hit load the example file in (found in the examples/ directory) hit load, set the parameters and then refresh the Pointcloud list.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

I notice a couple of issues when testing. Not sure if these are caused by or in the scope of this PR:

  1. If I launch gazebo unpaused (with -r) then open the Environment Visualization plugin, the GUI crashes.

    1. gz sim -r environmental_sensor.sdf
    2. Open Environment Visualization gui plugin -> crash
  2. I need to have the Environment Visualization and Point Cloud GUI plugins already open before hitting Play to see the point cloud visualization. If I open the Point Cloud GUI plugin after hitting Play, I don't see the visualization.

    1. gz sim environmental_sensor.sdf
    2. Open Environment Visualization gui plugin
    3. Hit Play
    4. Open Point Cloud gui plugin
    5. Click on refresh button in the Point Cloud gui plugin -> No point cloud visualization

examples/worlds/environmental_sensor.sdf Outdated Show resolved Hide resolved
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
arjo129 added a commit to gazebosim/gz-math that referenced this pull request Aug 28, 2023
`TimeVaryingVolumetricGrid`

This is needed to resolve a bug in gazebosim/gz-sim#1842 (review). In particular part of the issue is poor API design. Ideally `CreateSession` would return an `Option<Session>`, however it returns a `Session` even if it is not possible to create the session (for instance if it is too far ahead in time or an empty grid). Hence downstream users need a way to verify session validity.

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
However fix depends on gazebosim/gz-math#551

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@arjo129
Copy link
Contributor Author

arjo129 commented Aug 28, 2023

I've fixed issue 1 you mentioned. It was caused by an incorrect access to the session object. The fix does require this pull request though: gazebosim/gz-math#551.

Issue 2 sounds like expected behavior. The reason for this is that the example environment.csv file only has 90 seconds worth of data. So it is likely that by the time you opened the PointCloud plugin the data had run out and hence the plugin stopped publishing data. I've added a gzerr log in e3ed11a that tells you when data has run out.

@azeey
Copy link
Contributor

azeey commented Aug 28, 2023

I think it's best to remove beta from this since it probably won't make it in time for the code freeze. We can merge immediately after.

@azeey azeey removed the beta Targeting beta release of upcoming collection label Aug 28, 2023
@iche033
Copy link
Contributor

iche033 commented Aug 28, 2023

I've fixed issue 1 you mentioned

Confirmed that issue 1 is fixed!

Issue 2 sounds like expected behavior.

Got it. The error msg popped up as soon as I opened the Environment Visualization plugin. Looking at environmental_data.csv, the timestamp is only up to 1 (presumably seconds) so I see that makes sense.

@iche033
Copy link
Contributor

iche033 commented Aug 28, 2023

needs a gz-math7 release.

azeey pushed a commit to gazebosim/gz-math that referenced this pull request Aug 29, 2023
…metricGrid` (#551)

This is needed to resolve a bug in gazebosim/gz-sim#1842 (review). In particular part of the issue is poor API design. Ideally `CreateSession` would return an `Option<Session>`, however it returns a `Session` even if it is not possible to create the session (for instance if it is too far ahead in time or an empty grid). Hence downstream users need a way to verify session validity.


Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@iche033
Copy link
Contributor

iche033 commented Aug 31, 2023

@osrf-jenkins run tests please

@arjo129
Copy link
Contributor Author

arjo129 commented Sep 1, 2023

Let me investigate these tests...I will not be able to address thing immediately. I think we should merge this after code freeze as said by @azeey

Signed-off-by: Arjo Chakravarty <arjoc@intrinsic.ai>
@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Merging #1842 (4e9be7e) into gz-sim7 (b0ddc34) will decrease coverage by 0.44%.
Report is 58 commits behind head on gz-sim7.
The diff coverage is 53.31%.

❗ Current head 4e9be7e differs from pull request most recent head 9daebc8. Consider uploading reports for the commit 9daebc8 to get more accurate results

@@             Coverage Diff             @@
##           gz-sim7    #1842      +/-   ##
===========================================
- Coverage    65.01%   64.57%   -0.44%     
===========================================
  Files          353      357       +4     
  Lines        28618    29119     +501     
===========================================
+ Hits         18606    18804     +198     
- Misses       10012    10315     +303     
Files Changed Coverage Δ
include/gz/sim/EntityComponentManager.hh 100.00% <ø> (ø)
include/gz/sim/Link.hh 100.00% <ø> (ø)
include/gz/sim/Server.hh 100.00% <ø> (ø)
include/gz/sim/Util.hh 100.00% <ø> (ø)
include/gz/sim/rendering/WrenchVisualizer.hh 0.00% <0.00%> (ø)
.../plugins/component_inspector/ComponentInspector.cc 5.57% <0.00%> (-0.05%) ⬇️
.../gui/plugins/transform_control/TransformControl.cc 6.01% <0.00%> (-0.12%) ⬇️
...lization_capabilities/VisualizationCapabilities.cc 3.67% <0.00%> (-0.02%) ⬇️
src/rendering/RenderUtil.cc 36.60% <0.00%> (-2.43%) ⬇️
src/rendering/WrenchVisualizer.cc 0.00% <0.00%> (ø)
... and 34 more

... and 1 file with indirect coverage changes

Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

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

looks good to me

@arjo129 arjo129 merged commit f6efeef into gz-sim7 Oct 3, 2023
6 of 8 checks passed
@arjo129 arjo129 deleted the arjo/fix/environment_system branch October 3, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden needs upstream release Blocked by a release of an upstream library
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants