Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Add Ignition simulation plugins and demos #152

Merged
merged 47 commits into from
Nov 17, 2020

Conversation

luca-della-vedova
Copy link
Member

@luca-della-vedova luca-della-vedova commented Oct 14, 2020

This (large!) PR introduces support for Ignition Gazebo in RMF demos, it includes:

  • Updates to map generation CMakeLists to generate Ignition maps as well.
  • Ignition gazebo launch files, they are the same as the official launch files but have a _ign suffix (i.e. office.launch.xml becomes office_ign.launch.xml).
  • Plugins refactorization: All the rmf_demos_plugins have been refactored in common library + ignition / gazebo wrapper, the same way it has been done in traffic_editor.
  • A few additional dependencies to be built from source, including ros_ign, used for synchronizing Ignition and ROS clock, as well as menge_core used for crowd simulation (no crowd simulation demos have been generated yet).
  • Updated documentation on how to install Ignition from either binaries or source.

For now all the simulations run with the DART physics engine. Support for the higher performance TPE is in progress, there is still a few features pending in the core libraries.

Testing any of the environments should be as simple as building the new packages in the yaml file, running sudo apt install ignition-dome and appending use_ignition:=1 when launching demos through the ros2 launch.

Kevinskwk and others added 30 commits May 28, 2020 21:57
…gn demo

Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
…d refactor with existing Gazebo plugins (#124)

* Create initial TeleportIngestor and TeleportDispenser Ignition plugins

New ignition plugins mimic behavior of the existing Gazebo plugins with
the same name. Also created empty new rmf_plugins_common package which
will house code common to both the Ignition and Gazebo plugins.

* Create modularized TeleportDispenser Ignition and Gazebo plugins

Modify Gazebo plugin to mimic asynchronous control flow of the Ignition
plugin. Refactor both plugins to separate the ROS node and message
passing from the simulation aspects, moving the former to the new
TeleportDispenserCommon class.

Currently, the TeleportDispenser state and any publishers/subscribers
are in the TeleportDispenserCommonClass, while any functions to locate
and move objects are located in the respective Ignition/Gazebo plugin
classes.

* Create modularized TeleportIngestor Ignition and Gazebo plugins

Modify Gazebo plugin to mimic asynchronous control flow of the Ignition
plugin. Refactor both plugins to separate the ROS node and message
passing from the simulation aspects, moving the former to the new
TeleportIngestorCommon class.

* Miscellaneous minor enhancements and cleanup

- Check if ingestor is filled before attempting to ingest item.
- Check if bounding box of ingestor contains item in addition to merely
  checking distance.
- Send failure status for ingesting if request does not succeed.
- Move _non_static_init_model_poses to TeleportIngestorCommon
- Standardize indentation to 2 spaces and remove redundant includes
- Move function definitions out of class
- Remove logger() function
- Simplify plugin names amd change Teleport{Ingestor|Dispenser}Common member object names
- Add comments

* Use AxisAlignedBox component(s) when dispensing items

Creates an AxisAlignedBox (AABB) component for item to be dispensed. When
dispensing item, uses the AABB of the robot model to calculate its
subsequent position. Also adds minor indentation changes for various
functions.

* Update Changelog for rmf_ignition_plugins

Update Changelog description for new package containing Ignition Gazebo
plugins for the rmf demos.

* Incorporate rmf_ingestor_msgs and enable demos to run with Gazebo >9

Modifies Ignition and Gazebo TeleportIngestor plugins to send receive
messages defined in rmf_ingestor_msgs. Adds flags to check for Gazebo
version and create bounding boxes of the appropriate type. Lastly,
modifies CMakeLists and package.xml files where appropriate to run with
the latest Gazebo versions.

* Change indentation and formatting to adhere to style guidelines

Adjust indentation, line widths and spacing. Remove underscores for public var names in classes.
Add Ignition plugin paths to Airport and Lift demos.

* Refactor utils lib and Ingestor/Dispenser code structure improvements

- Move utils library to rmf_plugins_common package
- Removes `_load_complete` flag where not necessary.
- Upgrades sdformat version form 9 to 10
- Incorporates static() checking when generating robot lists instead of in
    `find_nearest_non_static_model()`
- ingest_from_nearest_robot and dispense_onto_nearest_robot now return boolean
    values instead of void

* Use generic callback fns for Ingesting/Dispensing

Moves the bulk of the code in the TeleportIngestor and
TeleportDispensers' on_update() or pre_update() functions into common
functions. Passes callback functions to the common function instead to
inject ignition/gazebo-specific code.

* Ignition Math version bump

Use ign-math6 instead of ign-math4. Minor style changes to
request_lift.py

* Fix ign-math dependency in rmf_plugins_common

* Shift simulation_now and response construction into utils

Refactor TeleportIngestorCommon and TeleportDispenserCommon to move
common functions into utils library where possible.

* Move dispenser refill check and current_state updates to common TeleportDispenserCommon

Moves the periodic check for refilling the dispenser into the
TeleportDispenserCommon class. Also moves the current_state updates
to the common classes to ensure no publishers or subscribers are
needed in the individual Ignition or Gazebo plugin classes.

* Move ingesting and disepnsing control logic to common classes

Creates a new SimEntity class to hold identifiers for either Ignition or
Gazebo simulations. This enables dispense_on_nearest() and
ingest_from_nearest_robot() to be moved to the common classes, with
callbacks injected for simulation specific tasks such as moving objects
or identifying the nearest objects.

* Modify SimEntity struct field to be dependent on simulator type

Accessing the entity or name field of a SimEntity object is now
dependent on the Simulator type it is to be used for, which is
implicitly specified when first initializing a SimEntity object.

* Fix Dispenser bounding box generation

- Store the bounding box created in _dispenser_vicinity_box and use that
value instead of assigning it to the Dispenser's BoundingBox/AxisAlignedBox
property.
- Mention use of new rmf_ingestor_msgs in changelog

* Convert utils functions to generic versions

Remove any dependency on Gazebo or sdformat in the sim_utils library by
converting existing functions to templated versions. Clean up
dependencies in the corresponding CMakeLists file.

* Convert Pose data to Eigen Isometry values to work with multiple Gazebo versions

Create template functions to convert between the Pose data type and
Eigen Isometry3d values, and incorporate these into the TeleportIngestor
plugins. Removes the dependency on Ignition Math 6 and enables it to work
with both Gazebo 11 and 9.

* Fix Eigen3 Dependencies in CMakeLists file

Add Eigen3 as target dependency for TeleporIngestorCommon and move
template functions from utils to TeleportIngestorCommon.
* Create functional Readonly Ignition plugin and replace map placeholders

New Readonly Ignition plugin mimics the existing Gazebo readonly
plugin in terms of behavior. robot_placeholder(s) in the Airport
Terminal map have been replaced with the actual robots themselves.

* Refactor Readonly Gazebo plugin to use ReadonlyCommon class

Moves all non simulator specific code to the ReadOnlyCommon class for
reuse by other simulator plugins. Refactor the existing Gazebo Readonly
plugin to make use of this common class.

* Refactor Readonly Ignition plugin to make use of ReadonlyCommon class

Move non Ignition Gazebo specific code to the common class. Amend
CmakeLists file to remove redundant includes.

* Fix airport demo launch files

Edit description for ignition airport demo launch files, and set default
caddy model plugin name in sdf file to point to the Gazebo plugin.

* Enable both differential drive plugins to work without needing to recompile

- Add both diff drive plugins to sdf file. Serves as a workaround to run both
Ignition and Gazebo classic simulations without needing to edit the
Caddy sdf file to modify plugin names.

- Convert CMake target_link_libraries to ament_target_directories. Remove
comment markers around caddy in launch file.

* Remove ignition math dependency and substitute Eigen library

Removes use of ignition math in ReadonlyCommon, by replacing it with
equivalent Eigen types and functions. Added minor comments in the Caddy
sdf file describing addition of both plugins, as well as some in the
readonly plugin.

* Miscellaneous minor Readonly plugin improvements

- Pass pose and sim time as arguments to `on_update` function to ensure
they get computed each time
- Removed unused `update_count` variable
- Added getter/setter for name variable in `ReadonlyCommon` and changed
its access specifier from public to private
- Modified mutex name to be more descriptive

* Remove _pose and _sim_time local variables from Readonly plugin classes

Initialize the aforementioned variables in the `on_update()` function
instead.
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
luca-della-vedova and others added 11 commits September 28, 2020 11:01
…demo (#144)

* Add paths to Ignition GUI plugins

Modify ignition demo launch files to add path to Ignition GUI plugins.
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Currently, the wheels of the TinyRobot slip when attempting to turn
on Ignition with the DART physics engine. This fix modifies the mass
slightly for now, to allow it to run smoothly.
… on Ignition (#150)

* Send Ignition transport messages from TeleportIngestor and Dispenser

Required for slotcar plugin to know when a payload has been dispensed to/
ingested from it.

* Add Clinic Ignition demo launch file

* Reset velocity cmds when ingesting object

Makes TeleportIngestor responsible for all movement of object once it
has been ingested. Remove debugging statements and modifies some
comments.

* Change TeleportIngestor ignition msg type from Uint64 to Entity

Improves maintainability if the current Entity type were ever to change
in Ignition. Also makes a few code style improvements.
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

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

Thanks for this amazing effort to support demos with ignition. In evaluating this PR, I tried to launch the various demos in gazebo and ignition to test basic functionality (after performing a clean build). I ran into errors (mostly linking with rmf_plugin_utils) when trying to launch worlds as described below.

Office world:

  • Simulation crashes during startup when launched with gazebo (without fail each time). [gzserver-9] gzserver: symbol lookup error: /home/yadu/rmf_demos_ws/install/rmf_plugins_common/lib/libdispenser_common.so: undefined symbol: _ZN17rmf_plugins_utils14simulation_nowEd [ERROR] [gzserver-9]: process has died [pid 9254, exit code 127, cmd 'gzserver --verbose -s libgazebo_ros_factory.so -s libgazebo_ros_init.so /home/yadu/rmf_demos_ws/install/rmf_demo_maps/share/rmf_demo_maps/maps/office/office.world'].
    Demangled symbol : rmf_plugins_utils::simulation_now(double)

Airport world:

  • Ign simulation crashes at launch with error: [ign-9] ign gazebo server: symbol lookup error: /home/yadu/rmf_demos_ws/install/rmf_plugins_common/lib/libreadonly_common.so: undefined symbol: _ZN17rmf_plugins_utils14simulation_nowEd
    Demangled symbol: rmf_plugins_utils::simulation_now(double)

  • Gazebo simulation crashes at launch with error [gzserver-9] [libprotobuf ERROR google/protobuf/descriptor_database.cc:58] File already exists in database: ignition/msgs/actor.proto [gzserver-9] [libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): [gzserver-9] terminate called after throwing an instance of 'google::protobuf::FatalException' [gzserver-9] what(): CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): [gzclient-10] [INFO] [1604284988.355876535] [gazebo_ros_node]: ROS was initialized without arguments. [ERROR] [gzserver-9]: process has died [pid 10265, exit code -6, cmd 'gzserver --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so /home/yadu/rmf_demos_ws/install/rmf_demo_maps/share/rmf_demo_maps/maps/airport_terminal/airport_terminal.world']. [gzserver-9]

@Yadunund
Copy link
Member

Yadunund commented Nov 2, 2020

The linking problem related to rmf_plugin_utils was solved after another clean build, so that's great. Still facing issues with the airport world in gazebo. But I suspect it might be due to my workspace setup.

On a side note, since we have replaced the robot placeholders with robot models in the airport world, we can go ahead and delete the /demos/scripts/ folder

Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
@youliangtan
Copy link
Contributor

Went through a clean build, yet still facing issue on crowdsim plugin:

[gzserver-10] gzserver: symbol lookup error: /home/youliang/rmf_ws/install/building_gazebo_plugins/lib/libcrowd_simulator.so: undefined symbol: _ZNK15crowd_simulator17CrowdSimInterface6loggerEv
[ERROR] [gzserver-10]: process has died [pid 25542, exit code 127, cmd 'gzserver --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so /home/youliang/rmf_ws/install/cag_maps/share/cag_maps/maps/terminal3/terminal3.world'].

@luca-della-vedova
Copy link
Member Author

Went through a clean build, yet still facing issue on crowdsim plugin:

[gzserver-10] gzserver: symbol lookup error: /home/youliang/rmf_ws/install/building_gazebo_plugins/lib/libcrowd_simulator.so: undefined symbol: _ZNK15crowd_simulator17CrowdSimInterface6loggerEv
[ERROR] [gzserver-10]: process has died [pid 25542, exit code 127, cmd 'gzserver --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so /home/youliang/rmf_ws/install/cag_maps/share/cag_maps/maps/terminal3/terminal3.world'].

Do you have the latest traffic editor master?

@youliangtan
Copy link
Contributor

@luca-della-vedova yes, latest traffic_editor. Btw, I shouldnt mention this issue here as it is relevant to traffic-editor

@luca-della-vedova
Copy link
Member Author

@luca-della-vedova yes, latest traffic_editor. Btw, I shouldnt mention this issue here as it is relevant to traffic-editor

It shouldn't be an issue but did you include menge in your workspace?

@Yadunund
Copy link
Member

Yadunund commented Nov 4, 2020

Did another clean build after pulling master on traffic_editor.

  • Airport world crashes during launch with error
[gzserver-9] [libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
[gzserver-9] terminate called after throwing an instance of 'google::protobuf::FatalException'
[gzserver-9]   what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
[gzclient-10] [INFO] [1604502616.812901911] [gazebo_ros_node]: ROS was initialized without arguments.
[ERROR] [gzserver-9]: process has died [pid 86668, exit code -6, cmd 'gzserver --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so /home/yadu/ws_rmf_demos/install/rmf_demo_maps/share/rmf_demo_maps/maps/airport_terminal/airport_terminal.world'].
  • All the ignition worlds crash during launch with error
[ign-9] ign gazebo server: symbol lookup error: /home/yadu/ws_rmf_demos/install/building_ignition_plugins/lib/libslotcar.so: undefined symbol: _ZN19building_sim_common13SlotcarCommon14set_model_nameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
@luca-della-vedova
Copy link
Member Author

OK!

  • Airport world crashes during launch with error
[gzserver-9] [libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
[gzserver-9] terminate called after throwing an instance of 'google::protobuf::FatalException'
[gzserver-9]   what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
[gzclient-10] [INFO] [1604502616.812901911] [gazebo_ros_node]: ROS was initialized without arguments.
[ERROR] [gzserver-9]: process has died [pid 86668, exit code -6, cmd 'gzserver --verbose -s libgazebo_ros_init.so -s libgazebo_ros_factory.so /home/yadu/ws_rmf_demos/install/rmf_demo_maps/share/rmf_demo_maps/maps/airport_terminal/airport_terminal.world'].

"Fixed" in the last commit. I had to comment out the ignition caddy plugin which means the caddy in ignition is not working but at least it won't break the existing simulation, we can figure out how to load its plugin in a future PR.

  • All the ignition worlds crash during launch with error
[ign-9] ign gazebo server: symbol lookup error: /home/yadu/ws_rmf_demos/install/building_ignition_plugins/lib/libslotcar.so: undefined symbol: _ZN19building_sim_common13SlotcarCommon14set_model_nameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE

This should be fixed in the traffic_editor PR #262

Copy link
Member

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the remaining issues!

@luca-della-vedova luca-della-vedova merged commit 2a522b1 into master Nov 17, 2020
@luca-della-vedova luca-della-vedova deleted the feature/add_ignition_support branch November 17, 2020 09:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants