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

ServerConfig accepts an sdf::Root DOM object #1333

Merged
merged 18 commits into from Apr 1, 2022

Conversation

nkoenig
Copy link
Contributor

@nkoenig nkoenig commented Feb 11, 2022

Signed-off-by: Nate Koenig nate@openrobotics.org

🎉 New feature

Summary

Requires: gazebosim/sdformat#841

I have a downstream program that is using Gazebo as a library. This program runs a world with a number of models. Each model can have different starting conditions, which is mostly just pose information for now but can be expanded to joint positions and forces.

A key aspect is consistent and reproducible behavior. To meet this goal, I would like to start Gazebo with all models at their specified locations, and not rely on asynchronous spawning. This goal can be accomplished by sending the Server a complete SDF DOM.

I have modified the ServerConfig to accept an sdf::Root object as an alternative to the file and string options.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • 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.

Signed-off-by: Nate Koenig <nate@openrobotics.org>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Feb 11, 2022
@osrf-triage osrf-triage added this to Inbox in Core development Feb 11, 2022
Signed-off-by: Nate Koenig <nate@openrobotics.org>
@scpeters scpeters moved this from Inbox to In review in Core development Feb 14, 2022
Signed-off-by: Nate Koenig <nate@openrobotics.org>
@nkoenig
Copy link
Contributor Author

nkoenig commented Feb 16, 2022

The findFuelResourceSdf function in Util.cc is a direct copy from Server.cc, and the new resolveSdfWorldFile function is a copy of the code removed from Server.cc's constructor.

@mjcarroll
Copy link
Contributor

Since we are expanding the number of ways that sdf can be injected into the server config, do you think it would make sense to introduce an enum like:

enum class SdfSource {
  kSdfString,
  kSdfFile,
  kSdfRoot
}

To make it easier to check and make switch statements around the branching logic?

@mjcarroll
Copy link
Contributor

Also, not for gazebo6, since it would screw up API, but for main I think we could remove the "SdfString" and "SdfFile" accessors/mutators and make ServerConfig users always parse the Sdf into a root before construction the server config.

Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

Two nits and a question

src/Util_TEST.cc Outdated Show resolved Hide resolved
include/ignition/gazebo/Util.hh Outdated Show resolved Hide resolved
include/ignition/gazebo/ServerConfig.hh Outdated Show resolved Hide resolved
Signed-off-by: Nate Koenig <nate@openrobotics.org>
@nkoenig
Copy link
Contributor Author

nkoenig commented Feb 16, 2022

Since we are expanding the number of ways that sdf can be injected into the server config, do you think it would make sense to introduce an enum like:

enum class SdfSource {
  kSdfString,
  kSdfFile,
  kSdfRoot
}

To make it easier to check and make switch statements around the branching logic?

Added the enum in f32555b

include/ignition/gazebo/ServerConfig.hh Outdated Show resolved Hide resolved
include/ignition/gazebo/ServerConfig.hh Outdated Show resolved Hide resolved
src/ServerConfig_TEST.cc Show resolved Hide resolved
src/Util.cc Outdated Show resolved Hide resolved
Nate Koenig added 2 commits February 16, 2022 14:17
Signed-off-by: Nate Koenig <nate@openrobotics.org>
@nkoenig
Copy link
Contributor Author

nkoenig commented Feb 16, 2022

Needs a release of sdformat12.

@chapulina chapulina added the needs upstream release Blocked by a release of an upstream library label Mar 1, 2022
@ahcorde
Copy link
Contributor

ahcorde commented Mar 16, 2022

@osrf-jenkins retest this please

Signed-off-by: Nate Koenig <nate@openrobotics.org>
@nkoenig
Copy link
Contributor Author

nkoenig commented Mar 16, 2022

@osrf-jenkins retest this please

@nkoenig
Copy link
Contributor Author

nkoenig commented Mar 16, 2022

@osrf-jenkins rerun tests please

@chapulina
Copy link
Contributor

@osrf-jenkins run tests ⬅️ I believe that's the magic incantation

@nkoenig
Copy link
Contributor Author

nkoenig commented Mar 16, 2022

I love magic

@chapulina
Copy link
Contributor

humm no, that didn't work. It could be because GitHub is having webhook issues right now:

https://www.githubstatus.com/

@nkoenig
Copy link
Contributor Author

nkoenig commented Mar 16, 2022

That also explains why github actions didn't start when I triggered a rerun.

@chapulina
Copy link
Contributor

I manually clicked retry on the Jenkins builds. GitHub Actions seems to be down too.

Here's where the incantation is documented, for future reference:

https://ignitionrobotics.org/docs/all/ci#triggering-ci

@nkoenig
Copy link
Contributor Author

nkoenig commented Mar 17, 2022

@osrf-jenkins run tests

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #1333 (72958cb) into ign-gazebo6 (4121a5c) will increase coverage by 0.05%.
The diff coverage is 86.41%.

@@               Coverage Diff               @@
##           ign-gazebo6    #1333      +/-   ##
===============================================
+ Coverage        63.04%   63.10%   +0.05%     
===============================================
  Files              303      303              
  Lines            24385    24419      +34     
===============================================
+ Hits             15374    15410      +36     
+ Misses            9011     9009       -2     
Impacted Files Coverage Δ
include/ignition/gazebo/ServerConfig.hh 100.00% <ø> (ø)
include/ignition/gazebo/Util.hh 100.00% <ø> (ø)
src/Server.cc 89.72% <81.48%> (+3.58%) ⬆️
src/Util.cc 92.16% <83.33%> (-1.38%) ⬇️
src/ServerConfig.cc 90.79% <100.00%> (+0.43%) ⬆️

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 4121a5c...72958cb. Read the comment docs.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

LGTM, just some small nits about documentation

/// The provided SDF filename may be a Fuel URI, relative path, name
/// of an installed Gazebo world filename, or an absolute path.
/// \param[in] _sdfFile An SDF world filename such as:
/// 1. "shapes.sdf" - This is referencing an installed world file.
Copy link
Contributor

Choose a reason for hiding this comment

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

It could also be a relative path to a file in the current directory.

/// of an installed Gazebo world filename, or an absolute path.
/// \param[in] _sdfFile An SDF world filename such as:
/// 1. "shapes.sdf" - This is referencing an installed world file.
/// 2. "../shapes.sdf" - This is referencing a relative world file.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's worth mentioning what it's relative to. It could be either the running directory or any path in IGN_GAZEBO_RESOURCE_PATH

@chapulina
Copy link
Contributor

Merging it with my documentation comments not addressed, they're minor.

@chapulina chapulina merged commit 39a0ce3 into ign-gazebo6 Apr 1, 2022
Core development automation moved this from In review to Done Apr 1, 2022
@chapulina chapulina deleted the server-config-root-dom branch April 1, 2022 20:03
chapulina added a commit that referenced this pull request Apr 13, 2022
* GzSceneManager: Prevent crash 💥 when inserted from menu (#1371)

Signed-off-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: ahcorde <ahcorde@gmail.com>

Co-authored-by: ahcorde <ahcorde@gmail.com>

* Prepare version 6.7.0 (#1373)

* Prepare version 6.7.0

Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>

* Populate GUI plugins that are empty (#1375)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* Fix visualization python tutorial (#1377)

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Add xyz and rpy offset to published odometry pose (#1341)

* Added xyz and rpy offset to published pose

Signed-off-by: Aditya <aditya050995@gmail.com>

* Added headless rendering tutorial (#1386)

* Added headless rendering tutorial

Signed-off-by: Nate Koenig <nate@openrobotics.org>

* Update tutorials/headless_rendering.md

Co-authored-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>

* Update tutorials/headless_rendering.md

Co-authored-by: Louise Poubel <louise@openrobotics.org>
Signed-off-by: Nate Koenig <nate@openrobotics.org>

* Mention ogre2

Signed-off-by: Nate Koenig <nate@openrobotics.org>

* Added note about software rendering

Signed-off-by: Nate Koenig <nate@openrobotics.org>

* add 'on linux systems'

Signed-off-by: Nate Koenig <nate@openrobotics.org>

* Add xyz and rpy offset to published odometry pose (#1341)

* Added xyz and rpy offset to published pose

Signed-off-by: Aditya <aditya050995@gmail.com>
Signed-off-by: Nate Koenig <nate@openrobotics.org>

Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Louise Poubel <louise@openrobotics.org>
Co-authored-by: Aditya Pande <aditya050995@gmail.com>

* Allow to turn on/off lights (#1343)

Signed-off-by: ahcorde <ahcorde@gmail.com>
Co-authored-by: Louise Poubel <louise@openrobotics.org>

* Add gazebo Entity id to rendering sensor's user data (#1381)

Adds the gazebo::Entity id to a rendering::Sensor's UserData object. The main use case is so that we can get back the corresponding gazebo Entity in the rendering thread when processing sensors.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

Co-authored-by: Nate Koenig <nkoenig@users.noreply.github.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Don't mark entities with a ComponentState::NoChange component as modified (#1391)

Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>

* Disable ModelCommandAPI_TEST.RgbdCameraSensor on macOS (#1397)

Disabling test since it's very flaky.

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>

* Disable PeerTracker.PeerTrackerStale on macOS (#1398)

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>

* Toggle Light visuals (#1387)

Signed-off-by: ahcorde <ahcorde@gmail.com>

* Prevent hanging when world has only non-world plugins (#1383)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Component inspector: refactor Pose3d C++ code into a separate class (#1400)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* add initial_position param to joint controller system (#1406)

Similar to the <initial_position> parameter in the JointTrajectoryController system, this PR adds an <initial_position> parameter to the JointPositionController to let users specifies the initial target pos for a joint.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* Fix JointStatePublisher topic name for nested models (#1405)

The joint-state-publisher system currently assumes it's always attached to the top level model and hence generates an incorrect topic name for nested models. This PR updates it to generate the correct topic name.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* Added user command to set multiple entities (#1394)

Signed-off-by: ahcorde <ahcorde@gmail.com>
Signed-off-by: Louise Poubel <louise@openrobotics.org>

Co-authored-by: Louise Poubel <louise@openrobotics.org>

* Disable tests that are expected to fail on Windows (#1408)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* Fortress: Install Ogre 2.2, simplify docker (#1395)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* SceneBroadcaster: only send changed state information for change events (#1392)

Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>

Co-authored-by: Louise Poubel <louise@openrobotics.org>

* Add wheel slip user command (#1241)

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>

* Distortion camera integration test (#1374)

Signed-off-by: William Lew <WilliamMilesLew@gmail.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Co-authored-by: Louise Poubel <louise@openrobotics.org>

* Add the Model Photo Shoot system, port of Modelpropshop plugin from Gazebo classic (#1331)

This system can be used to generate thumbnails of models. In comparison to the Modelpropshop plugin in Gazebo classic, this adds the ability to generate thumbnails after randomizing the joint positions of the model.

Signed-off-by: Marco A. Gutierrez <marco@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>

* Referring to Fuel assets within a heightmap (#1419)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* Disable sensors in sensors system when battery is drained (#1385)

Added a new parameter <disable_on_drained_battery> to the sensors system. If set to true, sensors will be disabled if the model is out of battery.

It listens to the battery state of charge from the battery plugin, and if the charge reaches zero, all child sensors and nested sensors are set to be inactive.

Signed-off-by: Ian Chen <ichen@osrfoundation.org>

* 🏁🎈 5.4.0 (#1420)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

* ServerConfig accepts an sdf::Root DOM object (#1333)

Signed-off-by: Nate Koenig <nate@openrobotics.org>

Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>

* Preparing 6.8.0 release (#1425)

* Prepareing 6.8.0 release

Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>

* Update changelog after merging forward port

Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>

* Add Gaussian noise to Odometry Publisher (#1393)

* Added gaussian noise and odometry with covariance publisher

Signed-off-by: Aditya <aditya050995@gmail.com>

Co-authored-by: Louise Poubel <louise@openrobotics.org>

* Fix deprecation warnings for ModelPhotoShoot (#1437)

Signed-off-by: Louise Poubel <louise@openrobotics.org>

Co-authored-by: ahcorde <ahcorde@gmail.com>
Co-authored-by: Jose Luis Rivero <jrivero@osrfoundation.org>
Co-authored-by: Aditya Pande <aditya050995@gmail.com>
Co-authored-by: Nate Koenig <nkoenig@users.noreply.github.com>
Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>
Co-authored-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
Co-authored-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Co-authored-by: William Lew <WilliamMilesLew@gmail.com>
Co-authored-by: Marco A. Gutiérrez <marcogg@marcogg.com>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
@osrf-triage
Copy link

This pull request has been mentioned on Gazebo Community. There might be relevant details there:

https://community.gazebosim.org/t/new-ignition-releases-2022-04-13-fortress-edifice/1367/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress needs upstream release Blocked by a release of an upstream library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants