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

Models: fix world orientation #68

Merged

Conversation

srmainwaring
Copy link
Collaborator

@srmainwaring srmainwaring commented Dec 20, 2023

This PR reviews and fixes the orientation of models and worlds to ensure compliance with the conventions used by ROS and ArduPilot.

Edit <cma> fix below moved to #73

There is also a fix for planes on Harmonic where a change in behaviour of the LiftDrag plugin requires the moment coefficient <cma> to be set to zero in order to disable the adjustment (it was previously ignored).

Details

  • Use degrees rather than radians in <pose> where this simplifies or clarifies the rotation.
  • Replace -0 with 0. These arise where the SDF model had been originally generated from URDF.

Checks

Models

  • gimbal_small_1d
  • gimbal_small_2d
  • iris_with_ardupilot
  • iris_with_gimbal
  • iris_with_standoffs
  • parachute_small
  • runway
  • zephyr
  • zephyr_with_ardupilot
  • zephyr_with_parachute

Worlds

  • iris_runway
  • iris_warehouse
  • zephyr_parachute
  • zephyr_runway

Tests

  • test_anemometer
  • test_gimbal
  • test_nested_model
  • test_parachute

@srmainwaring srmainwaring added the bug Something isn't working label Dec 20, 2023
@srmainwaring srmainwaring self-assigned this Dec 20, 2023
@Ryanf55
Copy link
Contributor

Ryanf55 commented Dec 21, 2023

ryan@B650-970:~/Dev/ros2_ws/src/ardupilot_gazebo$ gz sim -v4 -r zephyr_runway.sdf
[Msg] Gazebo Sim GUI    v8.0.0
[Dbg] [gz.cc:166] Subscribing to [/gazebo/starting_world].
[Dbg] [gz.cc:168] Waiting for a world to be set from the GUI...
[Dbg] [Gui.cc:263] Waiting for subscribers to [/gazebo/starting_world]...
[Msg] Received world [zephyr_runway.sdf] from the GUI.
[Dbg] [gz.cc:172] Unsubscribing from [/gazebo/starting_world].
[Msg] Gazebo Sim Server v8.0.0
[Msg] Loading SDF world file[/home/ryan/Dev/ros2_ws/src/ardupilot_gazebo/worlds/zephyr_runway.sdf].
[Dbg] [Application.cc:101] Initializing application.
[Dbg] [Application.cc:175] Qt using OpenGL graphics interface
[GUI] [Dbg] [Application.cc:662] Create main window
[Msg] Serving entity system service on [/entity/system/add]
[Dbg] [Physics.cc:860] Loaded [gz::physics::dartsim::Plugin] from library [/usr/lib/x86_64-linux-gnu/gz-physics-7/engine-plugins/libgz-physics-dartsim-plugin.so]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::Physics] for entity [1]
[Msg] Create service on [/world/zephyr_runway/create]
[Msg] Remove service on [/world/zephyr_runway/remove]
[Msg] Pose service on [/world/zephyr_runway/set_pose]
[Msg] Pose service on [/world/zephyr_runway/set_pose_vector]
[Msg] Light configuration service on [/world/zephyr_runway/light_config]
[Msg] Physics service on [/world/zephyr_runway/set_physics]
[Msg] SphericalCoordinates service on [/world/zephyr_runway/set_spherical_coordinates]
[Msg] Enable collision service on [/world/zephyr_runway/enable_collision]
[Msg] Disable collision service on [/world/zephyr_runway/disable_collision]
[Msg] Material service on [/world/zephyr_runway/visual_config]
[Msg] Material service on [/world/zephyr_runway/wheel_slip]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::UserCommands] for entity [1]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::SceneBroadcaster] for entity [1]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::Imu] for entity [1]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::NavSat] for entity [1]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::JointStatePublisher] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::LiftDrag] for entity [15]
[Msg] ApplyJointForce subscribing to Double messages on [/model/zephyr_with_ardupilot/joint/zephyr::propeller_joint/cmd_force]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::ApplyJointForce] for entity [15]
[Msg] ApplyJointForce subscribing to Double messages on [/model/zephyr_with_ardupilot/joint/zephyr::flap_left_joint/cmd_force]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::ApplyJointForce] for entity [15]
[Msg] ApplyJointForce subscribing to Double messages on [/model/zephyr_with_ardupilot/joint/zephyr::flap_right_joint/cmd_force]
[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::ApplyJointForce] for entity [15]
[libprotobuf ERROR google/protobuf/descriptor_database.cc:175] Symbol name "gz.sim.private_msgs.PerformerAffinity" conflicts with the existing symbol "gz.sim.private_msgs.PerformerAffinity".
[libprotobuf FATAL google/protobuf/descriptor.cc:1382] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
Stack trace (most recent call last):
#31   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3d14c00, in gz::sim::v8::SdfEntityCreator::CreateEntities(sdf::v14::Model const*)
#30   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3cecf55, in 
#29   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3d4d268, in gz::sim::v8::SimulationRunner::LoadPlugins(unsigned long, std::vector<sdf::v14::Plugin, std::allocator<sdf::v14::Plugin> > const&)
#28   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3d59d33, in gz::sim::v8::SystemManager::LoadPlugin(unsigned long, sdf::v14::Plugin const&)
#27   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3d594e9, in gz::sim::v8::SystemLoader::LoadPlugin(sdf::v14::Plugin const&)
#26   Object "/lib/x86_64-linux-gnu/libgz-sim8.so.8", at 0x7f48c3d584a8, in 
#25   Object "/lib/x86_64-linux-gnu/libgz-plugin2-loader.so.2", at 0x7f48c89f556f, in gz::plugin::Loader::LoadLib(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
#24   Object "/lib/x86_64-linux-gnu/libgz-plugin2-loader.so.2", at 0x7f48c89f44dd, in gz::plugin::Loader::Implementation::LoadLib(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)
#23   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a906c7, in dlopen
#22   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a9012d, in 
#21   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8b74972, in _dl_catch_error
#20   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8b748a7, in _dl_catch_exception
#19   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a9063b, in 
#18   Object "/lib64/ld-linux-x86-64.so.2", at 0x7f48c92f134d, in 
#17   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8b748a7, in _dl_catch_exception
#16   Object "/lib64/ld-linux-x86-64.so.2", at 0x7f48c92f0ff5, in 
#15   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8b74904, in _dl_catch_exception
#14   Object "/lib64/ld-linux-x86-64.so.2", at 0x7f48c92e9567, in 
#13   Object "/lib64/ld-linux-x86-64.so.2", at 0x7f48c92e947d, in 
#12   Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7f48808b3d08, in 
#11   Object "/lib/x86_64-linux-gnu/libprotobuf.so.23", at 0x7f48c3181951, in google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*)
#10   Object "/lib/x86_64-linux-gnu/libprotobuf.so.23", at 0x7f48c3181966, in google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*)
#9    Object "/lib/x86_64-linux-gnu/libprotobuf.so.23", at 0x7f48c3092c35, in 
#8    Object "/lib/x86_64-linux-gnu/libgcc_s.so.1", at 0x7f48c8c782dc, in _Unwind_Resume
#7    Object "/lib/x86_64-linux-gnu/libgcc_s.so.1", at 0x7f48c8c77883, in 
#6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f48c4cad958, in __gxx_personality_v0
#5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f48c4cad1e8, in 
#4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f48c4cae20b, in 
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f48c4ca2b9d, in 
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a287f2, in abort
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a42475, in raise
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f48c8a969fc, in pthread_kill
Aborted (Signal sent by tkill() 59000 1000)
[GUI] [Dbg] [PathManager.cc:68] Requesting resource paths through [/gazebo/resource_paths/get]
[GUI] [Dbg] [Gui.cc:343] GUI requesting list of world names. The server may be busy downloading resources. Please be patient.
[GUI] [Dbg] [SignalHandler.cc:142] Received signal[2].
[GUI] [Dbg] [SignalHandler.cc:142] Received signal[2].
[GUI] [Dbg] [Application.cc:242] Terminating application.

Runtime crash when loading. This happens on the old version (before this PR).

@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Dec 21, 2023

[Dbg] [SystemManager.cc:74] Loaded system [gz::sim::systems::ApplyJointForce] for entity [15]
[libprotobuf ERROR google/protobuf/descriptor_database.cc:175] Symbol name "gz.sim.private_msgs.PerformerAffinity" conflicts with the existing symbol "gz.sim.private_msgs.PerformerAffinity".
[libprotobuf FATAL google/protobuf/descriptor.cc:1382] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):

That looks like a possible version conflict between Gazebo Garden and Harmonic in your environment, or possibly the build of the ArduPilot plugin (can try disabling the plugin in the model to verify). The gz-msg and gz-transport libraries may have different protbuf dependencies in Gazebo and Harmonic.

srmainwaring added a commit to srmainwaring/ardupilot_gz that referenced this pull request Dec 23, 2023
- iris_with_standoffs pose changed in ArduPilot/ardupilot_gazebo#68

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
srmainwaring added a commit to srmainwaring/ardupilot_gz that referenced this pull request Dec 23, 2023
- iris_with_standoffs pose changed in ArduPilot/ardupilot_gazebo#68

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
- Anemometer: use degrees.
- Gimbal 1D: use degrees in pose.
- Gimbal 2D: use degrees in pose.
- Parachute: update plugin filename.
- Iris: use degrees, replace -0 with 0.
- Iris: remove z-offset from iris_with_standoffs model.
  - Remove z-offset from iris_with_standoffs, so model origin is at CoM.
  - Set pose in world file.
- Zephyr: use degrees.
- Zephyr: update parachute plugin name.
- Zephyr: disable moment coefficient contribution.
  - Required due to changed behaviour in Gazebo Harmonic.
- Update gimbal pose in iris_with_gimbal world.
- Update iris_warehouse world.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Copy link
Contributor

@Ryanf55 Ryanf55 left a comment

Choose a reason for hiding this comment

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

Tested a few worlds like warehouse, they work well.

@srmainwaring srmainwaring merged commit 0ff1e93 into ArduPilot:main Jan 21, 2024
3 checks passed
@srmainwaring srmainwaring deleted the prs/pr-fix-world-orientation branch January 21, 2024 15:43
srmainwaring added a commit to ArduPilot/ardupilot_gz that referenced this pull request Jan 21, 2024
- iris_with_standoffs pose changed in ArduPilot/ardupilot_gazebo#68

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants