gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Enable use of ign gazebo -s on Windows

Open traversaro opened this issue 1 year ago • 8 comments

🎉 New feature

This PR enable the use of ign gazebo -s on Windows. Similarly to what is done in macOS, as ign gazebo and ign gazebo -g are not supported, those options are explicitly disable to give a nice error to the users.

Summary

Summary of changes:

  • Add src/cmd directory also on Windows
  • Correctly mark export visibility in ign.hh and ModelCommandAPI.hh
  • Ensure that the correct directory if used in cmdgazebo.rb.in to load the gazebo plugin
  • Fix the logic to copy the unversion versions of the plugins
  • Fix UNIT_ign_TEST to work correctly on Windows
  • Disable generation of test-only ruby scripts for ign-tools when using multiple config CMake generators, and consequently disable UNIT_ign_TEST and UNIT_ModelCommandAPI_TEST` when using multiple config CMake generators.
  • As only ign gazebo -s is working, explicitly disable ign gazebo -g and ign gazebo as done on macOS .

Test it

Note, the following instructions are not complete as a version of libignition-common4 with https://github.com/gazebosim/gz-common/pull/389 needs to be released before the tests work again.

Personally, I tested it with conda-forge provided depedencies. I created an environment with:

mamba create -n igngaz vs2019_win-64 cmake ninja pkg-config libignition-cmake2 libsdformat12 libignition-plugin1 libignition-transport11 libignition-msgs8 libignition-common4 libignition-fuel-tools7 libignition-gui6 libignition-physics5 libignition-sensors6 libignition-rendering6 libignition-math6 libignition-tools1 libprotobuf qt-main tinyxml2

Then, I compiled ign-gazebo with:

mamba activate igngaz
git clone https://github.com/traversaro/ign-gazebo
cd ign-gazebo
git checkout fixigngazeboserveronwin
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP:BOOL=ON ..

After that, I was able to run correctly the server:

mamba activate igngaz
ign gazebo --verbose -s shapes.sdf

To verify the server was running correctly, I run in another terminal:

(igngaz) C:\Users\STraversaro>ign model --list

Requesting state for world [shapes]...

Available models:
    - ground_plane
    - box
    - cylinder
    - sphere
    - capsule
    - ellipsoid

Checklist

  • [x] Signed all commits for DCO
  • [ ] Added tests
  • [ ] Added example and/or tutorial
  • [ ] 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.

traversaro avatar Jul 05 '22 19:07 traversaro

Codecov Report

Merging #1574 (d00c62b) into ign-gazebo6 (25bdef6) will decrease coverage by 0.66%. The diff coverage is n/a.

:exclamation: Current head d00c62b differs from pull request most recent head bacff19. Consider uploading reports for the commit bacff19 to get more accurate results

@@               Coverage Diff               @@
##           ign-gazebo6    #1574      +/-   ##
===============================================
- Coverage        64.69%   64.02%   -0.67%     
===============================================
  Files              321      317       -4     
  Lines            26055    25649     -406     
===============================================
- Hits             16855    16422     -433     
- Misses            9200     9227      +27     
Impacted Files Coverage Δ
src/gui/Gui.cc 61.97% <0.00%> (-10.17%) :arrow_down:
src/systems/user_commands/UserCommands.cc 53.33% <0.00%> (-4.77%) :arrow_down:
src/systems/physics/Physics.cc 70.37% <0.00%> (-1.07%) :arrow_down:
src/systems/log/LogRecord.cc 78.13% <0.00%> (-1.02%) :arrow_down:
src/Util.cc 92.53% <0.00%> (-0.58%) :arrow_down:
src/ServerConfig.cc 90.69% <0.00%> (-0.31%) :arrow_down:
.../plugins/component_inspector/ComponentInspector.cc 5.33% <0.00%> (-0.29%) :arrow_down:
src/Model.cc 95.77% <0.00%> (-0.23%) :arrow_down:
src/ServerPrivate.cc 82.81% <0.00%> (-0.16%) :arrow_down:
src/EntityComponentManager.cc 89.36% <0.00%> (-0.03%) :arrow_down:
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Jul 05 '22 21:07 codecov[bot]

@ahcorde I worked on this locally, I still need to push the local version in the repo, sorry!

traversaro avatar Jul 18 '22 17:07 traversaro

@ahcorde I worked on this locally, I still need to push the local version in the repo, sorry!

The PR is now updated. I update the original post to reflect the changes, note that the unreleased change https://github.com/gazebosim/gz-common/pull/389 is required to actually get the UNIT_ign_TEST test to pass.

traversaro avatar Jul 19 '22 21:07 traversaro

It seems that there is some not intentional interaction with INTEGRATION_log_system.

traversaro avatar Jul 20 '22 07:07 traversaro

It seems that there is some not intentional interaction with INTEGRATION_log_system.

I tried to reproduce the problem locally, but in my case that test fails also when I am on the master branch (commit 8c66ef339c98e9f829503dce7fc539abc9065ad9):

197: Running command [IGN_GAZEBO_SYSTEM_PLUGIN_PATH=/home/straversaro/gz-sim/build3/lib LD_LIBRARY_PATH=/home/straversaro/gz-sim/build3/lib:/usr/local/lib:${LD_LIBRARY_PATH} ign gazebo -s  -r -v 4 --iterations 5 --record /home/straversaro/gz-sim/test/worlds/log_record_dbl_pendulum.sdf]
197: The 'ign' command provides a command line interface to the ignition tools.
197:
197:   ign <command> [options]
197:
197: List of available commands:
197:
197:   help:          Print this help text.
197:   fuel:          Manage simulation resources.
197:   gui:           Launch graphical interfaces.
197:   msg:           Print information about messages.
197:   plugin:        Print information about plugins.
197:   sdf:           Utilities for SDF files.
197:   topic:         Print information about topics.
197:   service:       Print information about services.
197:   log:           Record or playback topics.
197:
197: Options:
197:
197:   --force-version <VERSION>  Use a specific library version.
197:   --versions                 Show the available versions.
197:   --commands                 Show the available commands.
197: Use 'ign help <command>' to print help for a command.
197:
197: /home/straversaro/gz-sim/test/integration/log_system.cc:397: Failure
197: Expected equality of these values:
197:   nEntries + 1
197:     Which is: 1
197:   entryCount(logPath)
197:     Which is: 0
197: /home/straversaro/gz-sim/test/integration/log_system.cc:402: Failure
197: Expected equality of these values:
197:   1ul
197:     Which is: 1
197:   entriesDiff.size()
197:     Which is: 0
1/2 Test #197: INTEGRATION_log_system ...........***Exception: SegFault  1.48 sec

traversaro avatar Jul 20 '22 21:07 traversaro

It seems that there is some not intentional interaction with INTEGRATION_log_system.

I tried to reproduce the problem locally, but in my case that test fails also when I am on the master branch (commit 8c66ef3):

Ah, I think I know the problem here. I am using WSLg, so the problems:

  • https://github.com/gazebosim/gz-sim/issues/1116
  • https://github.com/gazebosim/gz-sim/issues/920

Are still presents. In theory https://github.com/gazebosim/gz-sim/issues/1116 was fixed, but thre is still not release of gz-rendering that contains the fix.

traversaro avatar Jul 21 '22 07:07 traversaro

@ahcorde I worked on this locally, I still need to push the local version in the repo, sorry!

The PR is now updated. I update the original post to reflect the changes, note that the unreleased change gazebosim/gz-common#389 is required to actually get the UNIT_ign_TEST test to pass.

gz-common4 4.5.2 was released some days ago, containing this change: https://github.com/gazebosim/gz-common/releases/tag/ignition-common4_4.5.2 .

traversaro avatar Aug 28 '22 17:08 traversaro

Still some failureso on Linux/macOS, and some new warnings on Windows.

traversaro avatar Aug 29 '22 06:08 traversaro

@osrf-jenkins run tests please

scpeters avatar Oct 17 '22 20:10 scpeters

@traversaro , I have a windows build setup from these instructions. I'm using powershell on windows 11. When I run ign gazebo -s shapes.sdf the command exits immediately. Alternatively, when I run ign model --list, the command does run.

Any thoughts, or extra information I should provide?

nkoenig avatar Oct 18 '22 17:10 nkoenig

I would expect everything to work also on Powershell, but just to check: can you try if the commands are working fine on Command Prompt?

traversaro avatar Oct 18 '22 18:10 traversaro

Note, the following instructions are not complete as a version of libignition-common4 with gazebosim/gz-common#389 needs to be released before the tests work again.

I think I understood the problem: this PR was merged and a new release of ign-common4 was released (i.e. 4.5.2, see https://github.com/gazebosim/gz-sim/pull/1574#issuecomment-1229516235), but the related package of conda-forge was not updated and is still stick to 4.5.1 (probably due to https://github.com/conda-forge/libignition-gazebo-feedstock/issues/24). We can manually bump ign-common4, also to simplify the test of https://github.com/conda-forge/libignition-gazebo-feedstock/pull/49 .

traversaro avatar Oct 19 '22 17:10 traversaro

We can manually bump ign-common4, also to simplify the test of conda-forge/libignition-gazebo-feedstock#49 .

Related PR: https://github.com/conda-forge/libignition-common-feedstock/pull/54 .

traversaro avatar Oct 19 '22 17:10 traversaro

I found that the installed cmdmodel6.rb and cmdgazebo6.rb files were identical. Both files contained the model command code. Will the conda-forge PR you linked to fix this?

nkoenig avatar Oct 19 '22 20:10 nkoenig

I found that the installed cmdmodel6.rb and cmdgazebo6.rb files were identical. Both files contained the model command code. Will the conda-forge PR you linked to fix this?

No, that seems a different issue, hopefully fixed by https://github.com/gazebosim/gz-sim/pull/1574/commits/124c13dc8fcf3b37859e2883d874443c996c03c2 .

traversaro avatar Oct 19 '22 21:10 traversaro

Sorry, it seems I did something wrong while trying to fix the DCO checks. Probably it is easier for me to open a new PR.

traversaro avatar Oct 19 '22 21:10 traversaro

I opened https://github.com/gazebosim/gz-sim/pull/1764 to have a PR with a clean history. I think we can close this one and continue the discussion on https://github.com/gazebosim/gz-sim/pull/1764 .

traversaro avatar Oct 19 '22 21:10 traversaro