Simulation Interfaces to Development#874
Conversation
…842) Components will be disabled when gazebo_msgs is no longer available. Apply suggestions from code review --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Jan Hanca <jan.hanca@robotec.ai>
* Spawning and spawnables Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * Test and renaming Editor SystemComponents Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * Added class skeleton Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * prevent tool crashing Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * physics stepping Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * review comments Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> * Adjusted to review Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
…or codes from standard (#850) * Refactor API to use heavily AZ::Outcome and error codes from standard * asynhronous despawning * Adjust to review -- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
* Added new gem with ROS 2 interface for simulation-interfaces * Integration with new SimulationInterfaces gem's API * Applied review suggestions --------- Signed-off-by: Patryk Antosz <patryk.antosz@robotec.ai> Co-authored-by: Michał Pełka <michal.pelka@robotec.ai>
…nInterfacesROS2 (#856) * Added bus to get simulation features registered in SimulationInterfacesROS2 Gem * Added simulation features to SimulationInterfaces Gem with integration to SimulationInterfacesROS2 Gem * Added settings registry support for changing ROS 2 services names * Added missing reuqired service * Review chagnes except changing unordered_set Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> --------- Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
* Setting RPISystem as optional for ROS2SystemCameraComponent allowing to load ROS2 gem in test environment. * Added tests to ROS 2 services, some changes to the SimulationFeaturesAggregator * Adjust to review --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
* Service handlers gathered in common container * Added possibility to delay service response * Interface file moved to dedicated directory * Fixed behaviour for delayed service response * Changes based on tests results --------- Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
…#860) Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
* Add allow renaming option to Simulation Interface spawner * Applied review --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
* Added handler for new action - SimulateSteps *added new base class for the actions *extended base interface for all services, actions and topics handlers *fixed some minor bugs *fixed typos *updated gem.json *updated logs msgs and comments --------- Signed-off-by: Patryk Antosz <patryk.antosz@robotec.ai> Co-authored-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> Co-authored-by: Jan Hanca <jan.hanca@robotec.ai>
* Simulation reset service implementation * Adjust the ROS 2 API to support time reset. --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
…ames (#865) * Adjust error code types * Added frame setting * Introduce dependency on ROS 2 gem to Simulation Interface Gem Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
* Placeholder for set simulation state service * Adjusted error codes * Set/Get simulation state with placeholders for deleting entities * Added transition to stopped and quitting --------- Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> Co-authored-by: Michał Pełka <michal.pelka@robotec.ai>
* Added validation of namespace and name * Added positive and negative test cases * Apply suggestions from code review --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Patryk Antosz <patryk.antosz@robotec.ai>
* Simulation step service --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Patryk Antosz <patryk.antosz@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
adamdbrw
left a comment
There was a problem hiding this comment.
Great work on this PR everyone!
Part of review, to be continued..
norbertprokopiuk
left a comment
There was a problem hiding this comment.
I went through all files and I marked thing that I missed during previous reviews
| ], | ||
| "icon_path": "preview.png", | ||
| "requirements": "", | ||
| "documentation_url": "", |
There was a problem hiding this comment.
There should be link to the documentation when it is ready
* Fix for articulations - added alternative registration path for SimulationBodies that are not yet configured. --------- Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
|
Most of comments were resolved in the PR #889. I would kindly invite reviewers to check out those changes |
Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
* Review sugestion based on @norbertprokopiuk comments Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> * Review sugestion based on part of @adamdbrw comments Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> * Review sugestion based on part of @PawelLiberadzki comments Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> * Unififed aliases usage for simulation Interface, dropped const for buses, based on @PawelLiberadzki and @michalpelka comments Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> * Removed TAG_FILTER enum Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai> --------- Signed-off-by: Norbert Prokopiuk <norbert.prokopiuk@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
Signed-off-by: Michał Pełka <michal.pelka@robotec.ai>
There was a problem hiding this comment.
Code review
Mainly nits, that can be ignored.
Tests
One test is failing on my machine:
cwd = /home/jhanca/devroot/projects/TestProject/build/linux/External/SimulationInterfaces-b8b19630/Code
LIB: /home/jhanca/devroot/projects/TestProject/build/linux/bin/profile/libSimulationInterfaces.ROS2Tests.so
Loading: /home/jhanca/devroot/projects/TestProject/build/linux/bin/profile/libSimulationInterfaces.ROS2Tests.so
OKAY Library loaded: /home/jhanca/devroot/projects/TestProject/build/linux/bin/profile/libSimulationInterfaces.ROS2Tests.so
OKAY Symbol found: AzRunUnitTests
Note: Google Test filter = -*SUITE_smoke*:*SUITE_periodic*:*SUITE_benchmark*:*SUITE_sandbox*:*SUITE_awsi*
[==========] Running 17 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 17 tests from SimulationInterfaceROS2TestFixture
[ RUN ] SimulationInterfaceROS2TestFixture.TestIfROS2NodeIsAvailable
[ OK ] SimulationInterfaceROS2TestFixture.TestIfROS2NodeIsAvailable (0 ms)
[ RUN ] SimulationInterfaceROS2TestFixture.SmokeTestROS2Domain
/home/jhanca/devroot/devo3de/o3de-extras/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp:130: Failure
Expected equality of these values:
receivedMsgs
Which is: 9
10
Did not receive all messages.
Functional tests
I tried to test the implementation from the perspective of a person who does not know the details of the standard, does not know the details of O3DE and who was too lazy to study the details. Instead, I started playing with all available interfaces and being surprised with the effect (a typical user).
Spawning an entity:
- call
get_spawnablesto get the available names - get
product_asset:///rosbot_velodyne.spawnableuri example - spawn
product_asset:///rosbot_velodyne.spawnable-> OK; anything else not OK
question: Should we require product_asset:///? What's wrong with rosbot_velodyne.spawnable or rosbot_velodyne? Can we have anything else than product_asset:/// and anything else than .spawnable?
Getting entities:
- create a level with
rosbot.spawnable - spawn
product_asset:///rosbot.spawnableasasdf - call
get_entities
issue: the root entity body_link in original robot is named asdf in the spawned robot instead of asdf_body_link (which would follow other names, e.g. asdf_imu_link vs imu_link)
Setting the entity state:
- spawn
product_asset:///prefabs/warehouse_storage/storage_rack3.spawnableasasdfat (10, 0, 2) - reset level
- spawn
product_asset:///prefabs/warehouse_storage/storage_rack3.spawnableasfdsaat (12, 0, 0) - set_state
fdsaposition (10, 0, 2)
question: why do we move only the root entity, rather than the whole entity? I understand we want to be able to move parts of the robot (sensors?) around, but this makes the tool useless in other cases
- spawn
product_asset:///rosbot_velodyne.spawnableasasdf - set the
twist->linear->x = 0.1toasdf
question: should this be somewhat equivalent to calling cmd_vel x = 0.1? if so, it is not, as the robot moves to (0, 0, 0) and it does not move anymore (even though get_entity_state shows twist->linear->x = 0.1
Getting the entity state:
- spawn
product_asset:///rosbot_velodyne.spawnableasasdf - set the twist->linear x = 0.1 to
asdf get_entity_stateofasdf
question: what is the expected value? the robot moved (see above), but the position did not change
Despawning entities
- spawn
product_asset:///prefabs/warehouse_storage/storage_rack3.spawnableasfdsaat (12, 0, 0) - get entities to see what is in there
- try to remove
Rackentity (part of the level) -> FAIL with error 4 Request could not be completed successfully even though feature is supported. Is it supported? - try to remove
fdsa-> OK
question: how do we know which entities can be removed and which can't?
- spawn
product_asset:///rosbot_velodyne.spawnableasasdf - despawn
asdf_velodyne_puck_link
question: what is the expected outcome? I would expect the lidar entity to disappear, but the whole robot does.
btw. why this is not called despawn_entity, but delete_entity?
Getting simulation features
question: shouldn't we return the list in the increasing order rather than unordered? It would be easier to read.
Simulation state
comment: default state == 0 (stopped) is quite counter-intuitive to what is typically seen; starting the simulation and seeing that nothing happens (publishing messages to topics such as /cmd_vel have no result) can surprise even experienced users
No comments to the remaining interfaces.
| m_spawnedTickets.erase(ticketId); | ||
| completedCb(AZ::Success()); | ||
| }; | ||
| spawner->DespawnAllEntities(ticket, optionalArgs); |
There was a problem hiding this comment.
Why not DespawnEntity()?
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
Yes we need It allows to move objects that are imported by SDF / URDF importer.
Standard ros-simulation/simulation_interfaces defines a state as a set of values:
We silently ignore acceleration (we should warn about that), but we cannot choose what part of state to apply or not. I can see two issues in your test. You probably expect robot to move in 'STATE_STOPPED'. It is simple - what to spawned, you can remove. It is expected behavior that prevents leaks of spawn tickets. Please file your complain here https://github.com/ros-simulation/simulation_interfaces/issues. Good idea, you are more than welcome to provide a PR. I follow standard during implementation that clearly states: Please file your complain here https://github.com/ros-simulation/simulation_interfaces/issues. |
|
Thank you for the detailed reply. |
byrcolin
left a comment
There was a problem hiding this comment.
Everything I see that has to do with platform seems good to me.
* Code review fixes Signed-off-by: Jan Hanca <jan.hanca@robotec.ai> * Fix FeaturesServiceHandler Signed-off-by: Jan Hanca <jan.hanca@robotec.ai> --------- Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
There was a problem hiding this comment.
I pushed some small fixes to this feature branch via PR #893 and #896.
There are still two things that I noticed when doing a review, but I did not include them in the changes, as each developer might have a different opinion:
- I would prefer to keep
SystemComponentin the names of the classes that areSystemComponents - I believe
ReloadLevelname in the API might be confusing; it is used as aResetSimulationin our case
Other than that, I have some problems with the tests:
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
/home/jhanca/devroot/devo3de/o3de-extras/Gems/SimulationInterfaces/Code/Tests/Tools/SimulationIterfaceAppTest.cpp:49: Failure
Failed to get asset id for sampleasset/testsimulationentity.spawnable
[ RUN ] SimulationInterfaceROS2TestFixture.SmokeTestROS2Domain
/home/jhanca/devroot/devo3de/o3de-extras/Gems/SimulationInterfaces/Code/Tests/Tools/InterfacesTest.cpp:147: Failure
Expected equality of these values:
receivedMsgs
Which is: 9
10
Edit: the first problem is gone after I removed my Cache and rebuilt all assets.
* Added SpinUntilFuture to test fixture Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Jan Hanca <jan.hanca@robotec.ai>
|
The last PR fixes the test mentioned above; however I discovered one more problem. There is inconsistency between launching a game launcher (simulation is stopped) and the game mode from the editor (simulation is playing). I am perfectly fine with the simulation playing, but the service to get the simulation state should return the valid one. |
* Disable certain state transitions in Editor * Add optional debug draw for StateName. * Add registry settings to Registry directory. Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Jan Hanca <jan.hanca@robotec.ai>
jhanca-robotecai
left a comment
There was a problem hiding this comment.
All my comments were addressed.
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
Signed-off-by: Jan Hanca <jan.hanca@robotec.ai>
* Cherry-pick #874: simulation interfaces * Reset tickets and cached information on deactivation of SimulationEntityManager Signed-off-by: Jan Hanca <jan.hanca@robotec.ai> Signed-off-by: Michał Pełka <michal.pelka@robotec.ai> Co-authored-by: Michał Pełka <michal.pelka@robotec.ai>


What does this PR do?
This PR is implementation of two RFCs:
o3de/sig-simulation#95
ros-infrastructure/rep#410
Those are ROS 2 interface, implemented using ROS 2 services and ROS 2 actions.
This PR mainly :
The SimulationInterfaces is responsible for implementing features from #410 against O3DE's API (mainly AzPhysics). InterfacesROS2 is enabler to ROS 2 interfaces.
ITimeSourceinterface to allow setting time. It was implemented forSimulationTimeSourceROS2CameraSensorComponentwas reflected twice #851 in this PR's branchRPISystemfromGetRequiredServicestoGetDependentServicesenabling running ROS 2 gem in test environment.How was this PR tested?