From 40ec47709a9cb2fd3cb4877c6aa56b5d3431de74 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 17 Mar 2021 11:25:12 -0700 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=8E=88=203.8.0=20(#688)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Louise Poubel --- CMakeLists.txt | 2 +- Changelog.md | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cd6738712..b43ada2450 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(ignition-gazebo3 VERSION 3.7.0) +project(ignition-gazebo3 VERSION 3.8.0) #============================================================================ # Find ignition-cmake diff --git a/Changelog.md b/Changelog.md index 9bfa6d1b67..f648bd8e55 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,114 @@ ## Ignition Gazebo 3.x +### Ignition Gazebo 3.X.X (202X-XX-XX) + +### Ignition Gazebo 3.8.0 (2021-03-17) + +1. Add joint position controller GUI, also enable tests for GUI plugins + * [Pull request #534](https://github.com/ignitionrobotics/ign-gazebo/pull/534) + +1. Remove visibility from headers that are not installed + * [Pull request #665](https://github.com/ignitionrobotics/ign-gazebo/pull/665) + +1. Added screenshot to toolbar + * [Pull request #588](https://github.com/ignitionrobotics/ign-gazebo/pull/588) + +1. Improve ign tool support on macOS + * [Pull request #477](https://github.com/ignitionrobotics/ign-gazebo/pull/477) + +1. change nullptr to a int ptr for qt 5.15.2 bug + * [Pull request #527](https://github.com/ignitionrobotics/ign-gazebo/pull/527) + +1. Kinetic energy monitor plugin + * [Pull request #492](https://github.com/ignitionrobotics/ign-gazebo/pull/492) + +1. Use a std::promise/std::future to avoid busy waiting the step ack messages in NetworkManagerPrimary + * [Pull request #470](https://github.com/ignitionrobotics/ign-gazebo/pull/470) + +1. clarified performer example + * [Pull request #390](https://github.com/ignitionrobotics/ign-gazebo/pull/390) + +1. Add tutorial tweaks + * [Pull request #380](https://github.com/ignitionrobotics/ign-gazebo/pull/380) + +1. Fix Qt5 warnings for using anchors + * [Pull request #363](https://github.com/ignitionrobotics/ign-gazebo/pull/363) + +1. Update codeowners + * [Pull request #305](https://github.com/ignitionrobotics/ign-gazebo/pull/305) + +1. Qt auto scale factor for HiDPI displays + * [Pull request #291](https://github.com/ignitionrobotics/ign-gazebo/pull/291) + +1. Fix yaw units + * [Pull request #238](https://github.com/ignitionrobotics/ign-gazebo/pull/238) + +1. Fixed docblock showGrid + * [Pull request #152](https://github.com/ignitionrobotics/ign-gazebo/pull/152) + +1. Fix entity tree for large worlds + * [Pull request #673](https://github.com/ignitionrobotics/ign-gazebo/pull/673) + +1. Master branch updates + * [Pull request #672](https://github.com/ignitionrobotics/ign-gazebo/pull/672) + +1. Backport #561: Use common::setenv + * [Pull request #666](https://github.com/ignitionrobotics/ign-gazebo/pull/666) + +1. Use a custom data structure to manage entity feature maps + * [Pull request #586](https://github.com/ignitionrobotics/ign-gazebo/pull/586) + +1. Limit scene broadcast publications when paused + * [Pull request #497](https://github.com/ignitionrobotics/ign-gazebo/pull/497) + +1. Fix flaky SceneBoradcaster test + * [Pull request #641](https://github.com/ignitionrobotics/ign-gazebo/pull/641) + +1. Add TF/Pose_V publisher in DiffDrive + * [Pull request #548](https://github.com/ignitionrobotics/ign-gazebo/pull/548) + +1. 👩‍🌾 Relax performance test + * [Pull request #640](https://github.com/ignitionrobotics/ign-gazebo/pull/640) + +1. 👩‍🌾 Improve velocity control test + * [Pull request #642](https://github.com/ignitionrobotics/ign-gazebo/pull/642) + +1. Add `laser_retro` support + * [Pull request #603](https://github.com/ignitionrobotics/ign-gazebo/pull/603) + +1. Fix pose of plane visual with non-default normal vector + * [Pull request #574](https://github.com/ignitionrobotics/ign-gazebo/pull/574) + +1. Add About dialog + * [Pull request #609](https://github.com/ignitionrobotics/ign-gazebo/pull/609) + +1. Make topics configurable for joint controllers + * [Pull request #584](https://github.com/ignitionrobotics/ign-gazebo/pull/584) + +1. Also use Ignition GUI render event + * [Pull request #598](https://github.com/ignitionrobotics/ign-gazebo/pull/598) + +1. Tutorial on migrating SDF files from Gazebo classic + * [Pull request #400](https://github.com/ignitionrobotics/ign-gazebo/pull/400) + +1. Visualize collisions + * [Pull request #531](https://github.com/ignitionrobotics/ign-gazebo/pull/531) + +1. Backport state update changes from pull request #486 + * [Pull request #583](https://github.com/ignitionrobotics/ign-gazebo/pull/583) + +1. Publish all periodic change components in Scene Broadcaster + * [Pull request #544](https://github.com/ignitionrobotics/ign-gazebo/pull/544) + +1. added size to `ground_plane` in examples + * [Pull request #573](https://github.com/ignitionrobotics/ign-gazebo/pull/573) + +1. Parallelize State call in ECM + * [Pull request #451](https://github.com/ignitionrobotics/ign-gazebo/pull/451) + +1. Non-blocking paths request + * [Pull request #555](https://github.com/ignitionrobotics/ign-gazebo/pull/555) + ### Ignition Gazebo 3.7.0 (2021-01-13) 1. Fix examples in migration plugins tutorial. From dc52dfcaef90e1bfc8af428d6f3183ea91e18a50 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 18 Mar 2021 21:44:21 -0500 Subject: [PATCH 2/6] Make it so joint state publisher is quieter (#696) Signed-off-by: Michael Carroll --- .../JointStatePublisher.cc | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/systems/joint_state_publisher/JointStatePublisher.cc b/src/systems/joint_state_publisher/JointStatePublisher.cc index 656095649d..9830edfbd7 100644 --- a/src/systems/joint_state_publisher/JointStatePublisher.cc +++ b/src/systems/joint_state_publisher/JointStatePublisher.cc @@ -169,6 +169,8 @@ void JointStatePublisher::PostUpdate(const UpdateInfo &_info, if (pose) msgs::Set(msg.mutable_pose(), pose->Data()); + static bool hasWarned {false}; + // Process each joint for (const Entity &joint : this->joints) { @@ -190,11 +192,18 @@ void JointStatePublisher::PostUpdate(const UpdateInfo &_info, for (size_t i = 0; i < jointPositions->Data().size(); ++i) { if (i == 0) + { jointMsg->mutable_axis1()->set_position(jointPositions->Data()[i]); + } else if (i == 1) + { jointMsg->mutable_axis2()->set_position(jointPositions->Data()[i]); - else + } + else if (!hasWarned) + { ignwarn << "Joint state publisher only supports two joint axis\n"; + hasWarned = true; + } } } @@ -206,11 +215,18 @@ void JointStatePublisher::PostUpdate(const UpdateInfo &_info, for (size_t i = 0; i < jointVelocity->Data().size(); ++i) { if (i == 0) + { jointMsg->mutable_axis1()->set_velocity(jointVelocity->Data()[i]); + } else if (i == 1) + { jointMsg->mutable_axis2()->set_velocity(jointVelocity->Data()[i]); - else + } + else if (!hasWarned) + { ignwarn << "Joint state publisher only supports two joint axis\n"; + hasWarned = true; + } } } @@ -222,11 +238,18 @@ void JointStatePublisher::PostUpdate(const UpdateInfo &_info, for (size_t i = 0; i < jointForce->Data().size(); ++i) { if (i == 0) + { jointMsg->mutable_axis1()->set_force(jointForce->Data()[i]); + } else if (i == 1) + { jointMsg->mutable_axis2()->set_force(jointForce->Data()[i]); - else + } + else if (!hasWarned) + { ignwarn << "Joint state publisher only supports two joint axis\n"; + hasWarned = true; + } } } } From f422c02b25fb3049a18061e9524a1abfd5370a75 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Mon, 22 Mar 2021 12:33:10 -0700 Subject: [PATCH 3/6] Scenebroadcaster sensors (#698) * Add sensors to scene broadcaster Signed-off-by: Nate Koenig * Update src/systems/scene_broadcaster/SceneBroadcaster.cc Co-authored-by: Michael Carroll * Fix codecheck Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig Co-authored-by: Michael Carroll --- .../scene_broadcaster/SceneBroadcaster.cc | 51 +++++++++++ test/integration/scene_broadcaster_system.cc | 51 +++++++++++ test/worlds/altimeter_with_pose.sdf | 91 +++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 test/worlds/altimeter_with_pose.sdf diff --git a/src/systems/scene_broadcaster/SceneBroadcaster.cc b/src/systems/scene_broadcaster/SceneBroadcaster.cc index ac93da86b6..e0d7ac0b79 100644 --- a/src/systems/scene_broadcaster/SceneBroadcaster.cc +++ b/src/systems/scene_broadcaster/SceneBroadcaster.cc @@ -38,6 +38,7 @@ #include "ignition/gazebo/components/Name.hh" #include "ignition/gazebo/components/ParentEntity.hh" #include "ignition/gazebo/components/Pose.hh" +#include "ignition/gazebo/components/Sensor.hh" #include "ignition/gazebo/components/Static.hh" #include "ignition/gazebo/components/Visual.hh" #include "ignition/gazebo/components/World.hh" @@ -124,6 +125,15 @@ class ignition::gazebo::systems::SceneBroadcasterPrivate public: static void AddVisuals(msgs::Link *_msg, const Entity _entity, const SceneGraphType &_graph); + /// \brief Adds sensors to a msgs::Link object based on the contents of + /// the scene graph + /// \param[inout] _msg Pointer to msg object to which the sensors will be + /// added. + /// \param[in] _entity Parent entity in the graph + /// \param[in] _graph Scene graph + public: static void AddSensors(msgs::Link *_msg, const Entity _entity, + const SceneGraphType &_graph); + /// \brief Recursively remove entities from the graph /// \param[in] _entity Entity /// \param[in/out] _graph Scene graph @@ -734,6 +744,26 @@ void SceneBroadcasterPrivate::SceneGraphAddEntities( return true; }); + // Sensors + _manager.EachNew( + [&](const Entity &_entity, const components::Sensor *, + const components::Name *_nameComp, + const components::ParentEntity *_parentComp, + const components::Pose *_poseComp) -> bool + { + auto sensorMsg = std::make_shared(); + sensorMsg->set_id(_entity); + sensorMsg->set_parent_id(_parentComp->Data()); + sensorMsg->set_name(_nameComp->Data()); + sensorMsg->mutable_pose()->CopyFrom(msgs::Convert(_poseComp->Data())); + + // Add to graph + newGraph.AddVertex(_nameComp->Data(), sensorMsg, _entity); + newGraph.AddEdge({_parentComp->Data(), _entity}, true); + newEntity = true; + return true; + }); // Update the whole scene graph from the new graph { @@ -878,6 +908,24 @@ void SceneBroadcasterPrivate::AddVisuals(msgs::Link *_msg, const Entity _entity, } } +////////////////////////////////////////////////// +void SceneBroadcasterPrivate::AddSensors(msgs::Link *_msg, const Entity _entity, + const SceneGraphType &_graph) +{ + if (!_msg) + return; + + for (const auto &vertex : _graph.AdjacentsFrom(_entity)) + { + auto sensorMsg = std::dynamic_pointer_cast( + vertex.second.get().Data()); + if (!sensorMsg) + continue; + + _msg->add_sensor()->CopyFrom(*sensorMsg); + } +} + ////////////////////////////////////////////////// void SceneBroadcasterPrivate::AddLinks(msgs::Model *_msg, const Entity _entity, const SceneGraphType &_graph) @@ -900,6 +948,9 @@ void SceneBroadcasterPrivate::AddLinks(msgs::Model *_msg, const Entity _entity, // Lights AddLights(msgOut, vertex.second.get().Id(), _graph); + + // Sensors + AddSensors(msgOut, vertex.second.get().Id(), _graph); } } diff --git a/test/integration/scene_broadcaster_system.cc b/test/integration/scene_broadcaster_system.cc index ad564bf5ad..1e46f8b645 100644 --- a/test/integration/scene_broadcaster_system.cc +++ b/test/integration/scene_broadcaster_system.cc @@ -220,6 +220,57 @@ TEST_P(SceneBroadcasterTest, SceneTopic) EXPECT_TRUE(google::protobuf::util::MessageDifferencer::Equals(msg, scene)); } +///////////////////////////////////////////////// +/// Test whether the scene topic is published only when new entities are added +TEST_P(SceneBroadcasterTest, SceneTopicSensors) +{ + // Start server + ignition::gazebo::ServerConfig serverConfig; + serverConfig.SetSdfFile(std::string(PROJECT_SOURCE_PATH) + + "/test/worlds/altimeter_with_pose.sdf"); + + gazebo::Server server(serverConfig); + EXPECT_FALSE(server.Running()); + EXPECT_FALSE(*server.Running(0)); + EXPECT_EQ(12u, *server.EntityCount()); + + // Create requester + transport::Node node; + + std::vector sceneMsgs; + std::function collectMsgs = + [&sceneMsgs](const msgs::Scene &_msg) + { + sceneMsgs.push_back(_msg); + }; + + node.Subscribe("/world/altimeter_sensor/scene/info", collectMsgs); + + // Run server + server.Run(true, 10, false); + + // Should only have one scene even though the simulation ran multiple times + ASSERT_EQ(1u, sceneMsgs.size()); + + // Compare this scene with one from a service request + msgs::Scene &scene = sceneMsgs.front(); + + bool result{false}; + unsigned int timeout{5000}; + ignition::msgs::Scene msg; + + EXPECT_TRUE(node.Request("/world/altimeter_sensor/scene/info", + timeout, msg, result)); + EXPECT_TRUE(result); + EXPECT_TRUE(google::protobuf::util::MessageDifferencer::Equals(msg, scene)); + + EXPECT_EQ(1, msg.model(1).link(0).sensor_size()); + EXPECT_EQ("altimeter_sensor", msg.model(1).link(0).sensor(0).name()); + EXPECT_DOUBLE_EQ(0.1, msg.model(1).link(0).sensor(0).pose().position().x()); + EXPECT_DOUBLE_EQ(0.2, msg.model(1).link(0).sensor(0).pose().position().y()); + EXPECT_DOUBLE_EQ(0.3, msg.model(1).link(0).sensor(0).pose().position().z()); +} + ///////////////////////////////////////////////// /// Test whether the scene topic is published only when new entities are added TEST_P(SceneBroadcasterTest, DeletedTopic) diff --git a/test/worlds/altimeter_with_pose.sdf b/test/worlds/altimeter_with_pose.sdf new file mode 100644 index 0000000000..fda866b333 --- /dev/null +++ b/test/worlds/altimeter_with_pose.sdf @@ -0,0 +1,91 @@ + + + + + 0.001 + 1.0 + + + + + + + + + + true + + + + + 0 0 1 + 100 100 + + + + + + + 0 0 1 + 100 100 + + + + 0.8 0.8 0.8 1 + 0.8 0.8 0.8 1 + 0.8 0.8 0.8 1 + + + + + + + 4 0 3.0 0 0.0 3.14 + + 0.05 0.05 0.05 0 0 0 + + 0.1 + + 0.000166667 + 0.000166667 + 0.000166667 + + + + + + 0.1 0.1 0.1 + + + + + + + 0.1 0.1 0.1 + + + + + 0.1 0.2 0.3 0 0 0 + 1 + 30 + true + + + + + link + 2 + + + + + From 66c0767486df6dc6dd6cbd4fb2626e9da10bafb4 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 6 Apr 2021 00:15:57 +0200 Subject: [PATCH 4/6] Do not pass -Wno-unused-parameter to MSVC compiler (#716) Signed-off-by: Silvio Traversaro --- src/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d529e58d9e..a3521cf28b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,10 +10,12 @@ set_source_files_properties( ) # Suppress compiler warnings in generated protobuf C++ code. -set_source_files_properties( - ${PROTO_PRIVATE_SRC} - COMPILE_FLAGS -Wno-unused-parameter -) +if(NOT MSVC) + set_source_files_properties( + ${PROTO_PRIVATE_SRC} + COMPILE_FLAGS -Wno-unused-parameter + ) +endif() set(network_sources network/NetworkConfig.cc From dfb43a0f0fa63f575d600c909275cb8a323339c8 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 6 Apr 2021 00:19:22 +0200 Subject: [PATCH 5/6] Use Protobuf_IMPORT_DIRS instead of PROTOBUF_IMPORT_DIRS for compatibility with Protobuf CMake config (#715) Signed-off-by: Silvio Traversaro --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b43ada2450..f7436f56f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project @@ -136,7 +136,7 @@ ign_find_package(IgnProtobuf REQUIRED COMPONENTS all PRETTY Protobuf) -set(PROTOBUF_IMPORT_DIRS ${ignition-msgs5_INCLUDE_DIRS}) +set(Protobuf_IMPORT_DIRS ${ignition-msgs5_INCLUDE_DIRS}) # Plugin install dirs set(IGNITION_GAZEBO_PLUGIN_INSTALL_DIR From 2f3d544ba6e4cd67d066477b339433426fecab1a Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Thu, 8 Apr 2021 08:59:04 -0700 Subject: [PATCH 6/6] Fix CMakelists.txt merge Signed-off-by: Nate Koenig --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b05eedb7b4..ab7e988aa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,7 +136,7 @@ ign_find_package(IgnProtobuf REQUIRED COMPONENTS all PRETTY Protobuf) -set(PROTOBUF_IMPORT_DIRS ${ignition-msgs6_INCLUDE_DIRS}) +set(Protobuf_IMPORT_DIRS ${ignition-msgs6_INCLUDE_DIRS}) # Plugin install dirs set(IGNITION_GAZEBO_PLUGIN_INSTALL_DIR