Skip to content

Commit

Permalink
Model editor (#1231)
Browse files Browse the repository at this point in the history
* Model editor: Add links to model (#1165)

* add an add entity button to component inspector. Currently only enabled for models

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

* add model editor gui plugin that inserts visuals to the scene in the render thread

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

* write to ECM

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

* support adding light links

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

* notify other GUI plugins of added/removed entities via GUI events

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* use const ref for constructor input params

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* guarantee 64 bit entity IDs with gazebo::Entity instead of unsigned int

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* testing makr as new entity  func

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

* rm printouts

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

* register type

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

* refactor render util

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

* workaround for avoiding crash on exit

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

* refactor, comment out unused menu items

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

* remove commented out code, add CreateLight function

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

* add model editor src files

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

* remove more commented out code

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

* use entity instead of entity name (#1176)

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Add link menu updates (#1177)

* use entity instead of entity name

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

* Update link add menu

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>

* fix adding ellipsoid

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

* merge model_editor into component_inspector

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

* fixing warnings

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

* Adjust tool tips

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

* fix adding light

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

* Fix codecheck

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

* Fixed documentation

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

Co-authored-by: Ashton Larkin <ashton@openrobotics.org>
Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Nate Koenig <nkoenig@users.noreply.github.com>

* Support recreating model entities (#1170)

* add recreate component and implement recreate entities functionality, add test

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

* update test and make recreate entities with same name work

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

* revert add include

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

* style

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

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* check recreate comp in ancestor

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

* require sdf 12.1.0

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

* Revert sdf version requirement

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

* Fix codecheck

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

* revert my bad merge

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

* remvoe sensor icon

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

* Together (#1187)

* add an add entity button to component inspector. Currently only enabled for models

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

* add model editor gui plugin that inserts visuals to the scene in the render thread

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

* write to ECM

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

* support adding light links

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

* notify other GUI plugins of added/removed entities via GUI events

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* use const ref for constructor input params

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* guarantee 64 bit entity IDs with gazebo::Entity instead of unsigned int

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* testing makr as new entity  func

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

* rm printouts

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

* register type

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

* refactor render util

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

* workaround for avoiding crash on exit

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

* refactor, comment out unused menu items

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

* remove commented out code, add CreateLight function

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

* add model editor src files

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

* remove more commented out code

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

* use entity instead of entity name (#1176)

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Add link menu updates (#1177)

* use entity instead of entity name

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

* Update link add menu

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>

* fix adding ellipsoid

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

* merge model_editor into component_inspector

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

* fixing warnings

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

* Adjust tool tips

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

* fix adding light

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

* Fix codecheck

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

* Fixed documentation

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

* Working on model creation

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

* Fix build

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

* Added debug statements

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

* use each no cache

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

* fix removing component from view

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

* Fix physics

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

* Fix codecheck

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

Co-authored-by: Ian Chen <ichen@osrfoundation.org>
Co-authored-by: Ashton Larkin <ashton@openrobotics.org>
Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Address comments

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

* update cameras list on sensor removal

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

* update cameras list on sensor removal

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

* Require sensors 6.1

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

* sensors 6.0.1

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

* Test model recreation with jointed models

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Fix multiple joints with same names

There was an issue in searching for joint parent_link and child_link frames
if there was another model with the same frame names.

This will correctly search for frame entity ids that are children of the
same model.

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Recreate entities joints (#1206)

* Test model recreation with jointed models
* Fix multiple joints with same names

There was an issue in searching for joint parent_link and child_link frames
if there was another model with the same frame names.

This will correctly search for frame entity ids that are children of the
same model.

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Fix the ecm test, which had bad parent-child relationships between links and joints

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

* Added test for world joints

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: Louise Poubel <louise@openrobotics.org>
Co-authored-by: Nate Koenig <nkoenig@users.noreply.github.com>
Co-authored-by: Ashton Larkin <ashton@openrobotics.org>

* Support editing air pressure sensor in the GUI (#1171)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Remove console output

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

* Added state awareness to add entity button

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

* Fix codecheck

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

* Remove extra variable

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: Louise Poubel <louise@openrobotics.org>

* Added altimeter sensor inspector (#1172)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Added altimeter sensor inspector

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Merged

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

* merged

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

* Remove console output

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

* alphabetize

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

* Documentation

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: Louise Poubel <louise@openrobotics.org>

* Added magnetometer inspector (#1173)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Added altimeter sensor inspector

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

* Added magnetometer inspector

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Merged

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

* merged

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

* Remove console output

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

* alphabetize

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

* Fix build

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

* alphabetize

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

* Cleanup build

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

* Missing print call

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: Louise Poubel <louise@openrobotics.org>

* Add IMU component inspector (#1191)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Added altimeter sensor inspector

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

* Added magnetometer inspector

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Merged

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

* merged

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

* Remove console output

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

* alphabetize

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

* Fix build

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

* Add IMU component inspector

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

* alphabetize

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

* Cleanup build

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

* Missing print call

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

* Fix all codecheck issues

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: Louise Poubel <louise@openrobotics.org>

* Added lidar component inspector (#1203)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Added altimeter sensor inspector

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

* Added magnetometer inspector

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Merged

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

* merged

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

* Remove console output

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

* alphabetize

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

* Fix build

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

* Add IMU component inspector

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

* Added lidar component inspector

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

* Fix codecheck

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: Louise Poubel <louise@openrobotics.org>

* Model Editor: Add Joints to model (#1196)

* Model Editor: Add Joints to model

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Style and documentation

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

* Suppress physics warnings on newly-created joints

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Added a header

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Allow user to modify joint type (#1198)

* Support editing air pressure sensor in the GUI

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

* Add noise to qrc

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

* Add noise to qrc

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

* Fix lint

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Update sensor icon

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

* Move AirPressure functions out of ComponentInspector (#1179)

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

* Fix get decimals, and address comments

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

* cleanup and simplification

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

* Require sdf 12.1.0

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

* missign width

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

* Added simulation state aware spin box

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

* Remove console output

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

* Allow user to modify joint type

Signed-off-by: Michael Carroll <michael@openrobotics.org>

* Updated to use a separate class, and consolidate the look

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

* Added recreate to joint add

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

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

* Add sensors to a link via the GUI (#1188)

* add an add entity button to component inspector. Currently only enabled for models

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

* add model editor gui plugin that inserts visuals to the scene in the render thread

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

* write to ECM

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

* get updated GUI ECM info in world control CB

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* support adding light links

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

* working on adding tests

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* remove TODO note, issue fixed by #1131

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* notify other GUI plugins of added/removed entities via GUI events

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* use const ref for constructor input params

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* guarantee 64 bit entity IDs with gazebo::Entity instead of unsigned int

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* testing makr as new entity  func

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

* rm printouts

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

* register type

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

* refactor render util

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

* apply GUI ECM's diff to server ECM at end of pause interval

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* use gui event to update server

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* Working on sensor addition and editing

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

* handle step and support original control service

Signed-off-by: Ashton Larkin <ashton@openrobotics.org>

* Reduced code duplication

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

* Set gazebo's default to use the event based system

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

* Testing things out

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

* updates

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

* workaround for avoiding crash on exit

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

* refactor, comment out unused menu items

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

* remove commented out code, add CreateLight function

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

* add model editor src files

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

* remove more commented out code

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

* Fix build

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

* use entity instead of entity name

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

* Update link add menu

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

* Updates

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

* Added back in sensor menu

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

* Updates

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

* Updates

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

* Updates

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

* use entity instead of entity name (#1176)

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Adding sensors

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

* Add link menu updates (#1177)

* use entity instead of entity name

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

* Update link add menu

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Ian Chen <ichen@osrfoundation.org>

* fix adding ellipsoid

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

* merge model_editor into component_inspector

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

* fixing warnings

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

* Adjust tool tips

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

* Updates

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

* updates

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

* updates

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

* Adding lidar menu

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

* alphabetize

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

* Comment out sensors not supported

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

* Added segmentation camera

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

* fix id

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

* fix codecheck

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

* Fix submenue

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

* Remove lidar menu, and address comments

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

* fix codecheck

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

* Merged

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

Co-authored-by: Ian Chen <ichen@osrfoundation.org>
Co-authored-by: Ashton Larkin <ashton@openrobotics.org>
Co-authored-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
Co-authored-by: Nate Koenig <nate@openrobotics.org>

* Support setting pose on links, visuals, collision via the GUI (#1230)

* Working on pose modification

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

* Support setting pose on links, visuals, collision via the GUI

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

* Fix test

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

Co-authored-by: Nate Koenig <nate@openrobotics.org>

* alphabetize

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

* Pimplize a class and added units, and 'joint'

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

* remove laser

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

* Added extra note

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

* Addressing comments

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

* Allow models to transform

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

* remove console log

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

* rename componentinspector in qml

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

* Update based on comments

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

* Don't publish ECM changes when paused

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

* Apply patch

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

* Fix joint type dropdown

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

* Joint type spacing

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

* Fix codecheck

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

* editor changes

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

* Recereate on sensors

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

* Don't allow world as child link

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

* Fix scene broadcaster test, and add another modelcommandapi test

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

* Added model command api gpu lidar test

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

* use MAX_VALUE

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

* Added units to model command

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

* Fix tests

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

* Added ProcessNewWorldControlState test

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

* Update test/worlds/gpu_lidar.sdf

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

* Removed comments and plugins

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

* Update comments

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

Co-authored-by: Ian Chen <ichen@osrfoundation.org>
Co-authored-by: Ashton Larkin <ashton@openrobotics.org>
Co-authored-by: Nate Koenig <nate@openrobotics.org>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: Louise Poubel <louise@openrobotics.org>
Co-authored-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
  • Loading branch information
7 people committed Dec 10, 2021
1 parent 17f63c4 commit 25df299
Show file tree
Hide file tree
Showing 90 changed files with 13,201 additions and 273 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
# as protobuf could be find transitively by any dependency
set(protobuf_MODULE_COMPATIBLE TRUE)

ign_find_package(sdformat12 REQUIRED VERSION 12.2)
ign_find_package(sdformat12 REQUIRED VERSION 12.3)
set(SDF_VER ${sdformat12_VERSION_MAJOR})

#--------------------------------------
Expand Down Expand Up @@ -110,7 +110,7 @@ set(IGN_PHYSICS_VER ${ignition-physics5_VERSION_MAJOR})

#--------------------------------------
# Find ignition-sensors
ign_find_package(ignition-sensors6 REQUIRED
ign_find_package(ignition-sensors6 REQUIRED VERSION 6.0.1
# component order is important
COMPONENTS
# non-rendering
Expand Down
2 changes: 1 addition & 1 deletion examples/worlds/sensors.sdf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<!--
Ignition Gazebo sensor demo
Ignition Gazebo sensor demo for sensors that do not require rendering.
Listen to sensor readings:
Expand Down
7 changes: 7 additions & 0 deletions include/ignition/gazebo/SdfEntityCreator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ namespace ignition
/// \return Joint entity.
public: Entity CreateEntities(const sdf::Joint *_joint);

/// \brief Create all entities that exist in the sdf::Joint object and
/// load their plugins.
/// \param[in] _joint SDF joint object.
/// \param[in] _resolved True if all frames are already resolved
/// \return Joint entity.
public: Entity CreateEntities(const sdf::Joint *_joint, bool _resolved);

/// \brief Create all entities that exist in the sdf::Visual object and
/// load their plugins.
/// \param[in] _visual SDF visual object.
Expand Down
48 changes: 48 additions & 0 deletions include/ignition/gazebo/components/Recreate.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2021 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_GAZEBO_COMPONENTS_RECREATE_HH_
#define IGNITION_GAZEBO_COMPONENTS_RECREATE_HH_

#include <ignition/gazebo/components/Factory.hh>
#include <ignition/gazebo/components/Component.hh>
#include <ignition/gazebo/config.hh>

namespace ignition
{
namespace gazebo
{
// Inline bracket to help doxygen filtering.
inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
namespace components
{
/// \brief A component that identifies an entity needs to be recreated.
/// Currently, only Models will be processed for recreation by the
/// SimulationRunner in the ProcessRecreateEntitiesRemove and
/// ProcessRecreateEntitiesCreate functions.
///
/// The GUI ModelEditor contains example code on how to use this
/// component. For example, the ModelEditor allows a user to add a link to an
/// existing model. The existing model is tagged with this component so
/// that it can be recreated by the server.
using Recreate = Component<NoData, class RecreateTag>;
IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.Recreate", Recreate)
}
}
}
}

#endif
1 change: 1 addition & 0 deletions include/ignition/gazebo/components/Serialization.hh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace serializers
const DataType &_data)
{
MsgType msg;
// cppcheck-suppress syntaxError
if constexpr (traits::HasGazeboConvert<DataType, MsgType>::value)
{
msg = ignition::gazebo::convert<MsgType>(_data);
Expand Down
4 changes: 4 additions & 0 deletions include/ignition/gazebo/detail/View.hh
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ template<typename ...ComponentTypeTs>
bool View<ComponentTypeTs...>::NotifyComponentRemoval(const Entity _entity,
const ComponentTypeId _typeId)
{
// if entity is still marked as to add, remove from the view
if (this->RequiresComponent(_typeId))
this->toAddEntities.erase(_entity);

// make sure that _typeId is a type required by the view and that _entity is
// already a part of the view
if (!this->RequiresComponent(_typeId) ||
Expand Down
35 changes: 35 additions & 0 deletions include/ignition/gazebo/gui/GuiEvents.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
#define IGNITION_GAZEBO_GUI_GUIEVENTS_HH_

#include <QEvent>
#include <QMap>
#include <QString>

#include <set>
#include <string>
#include <utility>
Expand Down Expand Up @@ -176,6 +179,38 @@ namespace events
/// \brief True if a transform mode is active.
private: bool tranformModeActive;
};

/// \brief Event that notifies an entity is to be added to the model editor
class ModelEditorAddEntity : public QEvent
{
/// \brief Constructor
/// \param[in] _entity Entity added
/// \param[in] _type Entity type
/// \param[in] _parent Parent entity.
public: explicit ModelEditorAddEntity(QString _entity, QString _type,
ignition::gazebo::Entity _parent);

/// \brief Get the entity to add
public: QString Entity() const;

/// \brief Get the entity type
public: QString EntityType() const;


/// \brief Get the parent entity to add the entity to
public: ignition::gazebo::Entity ParentEntity() const;

/// \brief Get the data map.
/// \return the QMap of string, string holding custom data.
public: QMap<QString, QString> &Data();

static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);

/// \internal
/// \brief Private data pointer
IGN_UTILS_IMPL_PTR(dataPtr)
};

} // namespace events
}
} // namespace gui
Expand Down
9 changes: 9 additions & 0 deletions include/ignition/gazebo/rendering/RenderUtil.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define IGNITION_GAZEBO_RENDERUTIL_HH_

#include <memory>
#include <set>
#include <string>
#include <vector>

Expand Down Expand Up @@ -76,6 +77,14 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
public: void UpdateFromECM(const UpdateInfo &_info,
const EntityComponentManager &_ecm);

/// \brief Helper function to create visuals for new entities created in
/// ECM. This function is intended to be used by other GUI plugins when
/// new entities are created on the GUI side.
/// \param[in] _ecm Const reference to the entity component manager
/// \param[in] _entities Entities to create visuals for.
public: void CreateVisualsForEntities(const EntityComponentManager &_ecm,
const std::set<Entity> &_entities);

/// \brief Set the rendering engine to use
/// \param[in] _engineName Name of the rendering engine.
public: void SetEngineName(const std::string &_engineName);
Expand Down
112 changes: 91 additions & 21 deletions src/EntityComponentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include "ignition/gazebo/components/Name.hh"
#include "ignition/gazebo/components/ParentEntity.hh"
#include "ignition/gazebo/components/ParentLinkName.hh"
#include "ignition/gazebo/components/Recreate.hh"
#include "ignition/gazebo/components/World.hh"

using namespace ignition;
using namespace gazebo;
Expand Down Expand Up @@ -420,7 +422,30 @@ Entity EntityComponentManager::CloneImpl(Entity _entity, Entity _parent,
}
else if (!_name.empty() && !_allowRename)
{
if (kNullEntity != this->EntityByComponents(components::Name(_name)))
// Get the entity's original parent. This is used to make sure we get
// the correct entity. For example, two different models may have a
// child with the name "link".
auto origParentComp =
this->Component<components::ParentEntity>(_entity);

// If there is an entity with the same name and user indicated renaming is
// not allowed then return null entity.
// If the entity or one of its ancestor has a Recreate component then carry
// on since the ECM is supposed to create a new entity with the same name.
Entity ent = this->EntityByComponents(components::Name(_name),
components::ParentEntity(origParentComp->Data()));

bool hasRecreateComp = false;
Entity recreateEnt = ent;
while (recreateEnt != kNullEntity && !hasRecreateComp)
{
hasRecreateComp = this->Component<components::Recreate>(recreateEnt) !=
nullptr;
auto parentComp = this->Component<components::ParentEntity>(recreateEnt);
recreateEnt = parentComp ? parentComp->Data() : kNullEntity;
}

if (kNullEntity != ent && !hasRecreateComp)
{
ignerr << "Requested to clone entity [" << _entity
<< "] with a name of [" << _name << "], but another entity already "
Expand Down Expand Up @@ -497,19 +522,35 @@ Entity EntityComponentManager::CloneImpl(Entity _entity, Entity _parent,
Entity originalParentLink = kNullEntity;
Entity originalChildLink = kNullEntity;

auto origParentComp =
this->Component<components::ParentEntity>(_entity);

const auto &parentName =
this->Component<components::ParentLinkName>(_entity);
if (parentName)
if (parentName && origParentComp)
{
originalParentLink = this->EntityByComponents<components::Name>(
components::Name(parentName->Data()));
// Handle the case where the parent link name is the world.
if (common::lowercase(parentName->Data()) == "world")
{
originalParentLink = this->Component<components::ParentEntity>(
origParentComp->Data())->Data();
}
else
{
originalParentLink =
this->EntityByComponents<components::Name, components::ParentEntity>(
components::Name(parentName->Data()),
components::ParentEntity(origParentComp->Data()));
}
}

const auto &childName = this->Component<components::ChildLinkName>(_entity);
if (childName)
if (childName && origParentComp)
{
originalChildLink = this->EntityByComponents<components::Name>(
components::Name(childName->Data()));
originalChildLink =
this->EntityByComponents<components::Name, components::ParentEntity>(
components::Name(childName->Data()),
components::ParentEntity(origParentComp->Data()));
}

if (!originalParentLink || !originalChildLink)
Expand All @@ -533,7 +574,14 @@ Entity EntityComponentManager::CloneImpl(Entity _entity, Entity _parent,
for (const auto &childEntity :
this->EntitiesByComponents(components::ParentEntity(_entity)))
{
auto clonedChild = this->CloneImpl(childEntity, clonedEntity, "", true);
std::string name;
if (!_allowRename)
{
auto nameComp = this->Component<components::Name>(childEntity);
name = nameComp->Data();
}
auto clonedChild = this->CloneImpl(childEntity, clonedEntity, name,
_allowRename);
if (kNullEntity == clonedChild)
{
ignerr << "Cloning child entity [" << childEntity << "] failed.\n";
Expand Down Expand Up @@ -1045,6 +1093,14 @@ bool EntityComponentManager::CreateComponentImplementation(

this->dataPtr->createdCompTypes.insert(_componentTypeId);

// If the component is a components::ParentEntity, then make sure to
// update the entities graph.
if (_componentTypeId == components::ParentEntity::typeId)
{
auto parentComp = this->Component<components::ParentEntity>(_entity);
this->SetParentEntity(_entity, parentComp->Data());
}

return updateData;
}

Expand Down Expand Up @@ -1944,24 +2000,38 @@ bool EntityComponentManagerPrivate::ClonedJointLinkName(Entity _joint,
return false;
}

auto iter = this->originalToClonedLink.find(_originalLink);
if (iter == this->originalToClonedLink.end())
Entity clonedLink = kNullEntity;


std::string name;
// Handle the case where the link could have been the world.
if (_ecm->Component<components::World>(_originalLink) != nullptr)
{
ignerr << "Error: attempted to clone links, but link ["
<< _originalLink << "] was never cloned.\n";
return false;
// Use the special identifier "world".
name = "world";
}
auto clonedLink = iter->second;

auto name = _ecm->Component<components::Name>(clonedLink);
if (!name)
else
{
ignerr << "Link [" << _originalLink << "] was cloned, but its clone has no "
<< "name.\n";
return false;
auto iter = this->originalToClonedLink.find(_originalLink);
if (iter == this->originalToClonedLink.end())
{
ignerr << "Error: attempted to clone links, but link ["
<< _originalLink << "] was never cloned.\n";
return false;
}
clonedLink = iter->second;

auto nameComp = _ecm->Component<components::Name>(clonedLink);
if (!nameComp)
{
ignerr << "Link [" << _originalLink
<< "] was cloned, but its clone has no name.\n";
return false;
}
name = nameComp->Data();
}

_ecm->SetComponentData<ComponentTypeT>(_joint, name->Data());
_ecm->SetComponentData<ComponentTypeT>(_joint, name);
return true;
}

Expand Down
Loading

0 comments on commit 25df299

Please sign in to comment.