Skip to content

Commit 174b56e

Browse files
authored
Merge branch 'gz-sim8' into gz-sim8
2 parents 50dba8e + ff6c047 commit 174b56e

28 files changed

+1123
-115
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
33
#============================================================================
44
# Initialize the project
55
#============================================================================
6-
project(gz-sim8 VERSION 8.7.0)
6+
project(gz-sim8 VERSION 8.9.0)
77
set (GZ_DISTRIBUTION "Harmonic")
88

99
#============================================================================

Changelog.md

+46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
## Gazebo Sim 8.x
22

3+
### Gazebo Sim 8.9.0 (2025-02-10)
4+
5+
1. Physics: Add components to request and receive Ray intersections
6+
* [Pull request #2514](https://github.com/gazebosim/gz-sim/pull/2514)
7+
8+
1. Also handle SIGTERM gracefully
9+
* [Pull request #2747](https://github.com/gazebosim/gz-sim/pull/2747)
10+
11+
1. Register MeshInertialCalculator when loading sim from an SDF string
12+
* [Pull request #2754](https://github.com/gazebosim/gz-sim/pull/2754)
13+
14+
1. Add debug msg to log auto computed inertial values
15+
* [Pull request #2749](https://github.com/gazebosim/gz-sim/pull/2749)
16+
17+
1. Reduce/Eliminate `sdf::Model` and `sdf::World` serialization warnings
18+
* [Pull request #2742](https://github.com/gazebosim/gz-sim/pull/2742)
19+
20+
1. Fix illegal anchor warnings
21+
* [Pull request #2741](https://github.com/gazebosim/gz-sim/pull/2741)
22+
23+
1. Fix mesh import filters not displaying correctly on KDE #2731 (#2732)
24+
* [Pull request #2736](https://github.com/gazebosim/gz-sim/pull/2736)
25+
26+
### Gazebo Sim 8.8.0 (2025-01-16)
27+
28+
1. Add parameter for adjusting current sign in battery plugin
29+
* [Pull request #2696](https://github.com/gazebosim/gz-sim/pull/2696)
30+
31+
1. Extend shapes plugin width to include the ellipsoid button
32+
* [Pull request #2699](https://github.com/gazebosim/gz-sim/pull/2699)
33+
34+
1. Use same FP limits for TrackedVehicle to avoid self-moving
35+
* [Pull request #2651](https://github.com/gazebosim/gz-sim/pull/2651)
36+
37+
1. Link.hh: add Sensor accessor APIs
38+
* [Pull request #2693](https://github.com/gazebosim/gz-sim/pull/2693)
39+
40+
1. Improve load times by skipping serialization of entities when unnecessary.
41+
* [Pull request #2683](https://github.com/gazebosim/gz-sim/pull/2683)
42+
43+
1. Prepend to `PYTHONPATH` in tests
44+
* [Pull request #2681](https://github.com/gazebosim/gz-sim/pull/2681)
45+
46+
1. Fix crash in `OpticalTactilePlugin` by checking for valid visualize pointer
47+
* [Pull request #2674](https://github.com/gazebosim/gz-sim/pull/2674)
48+
349
### Gazebo Sim 8.7.0 (2024-11-08)
450

551
1. Fix crash when multicopter motor system is attached to an empty model

include/gz/sim/Util.hh

+6-2
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,22 @@ namespace gz
250250
/// \param[in] _entity Entity whose component is being enabled
251251
/// \param[in] _enable True to enable (create), false to disable (remove).
252252
/// Defaults to true.
253+
/// \param[in] _comp The component to create if neeeded. Defaults to a
254+
/// default-constructed component.
253255
/// \return True if a component was created or removed, false if nothing
254256
/// changed.
255257
template <class ComponentType>
256258
bool enableComponent(EntityComponentManager &_ecm,
257-
Entity _entity, bool _enable = true)
259+
Entity _entity,
260+
bool _enable = true,
261+
const ComponentType &_comp = ComponentType())
258262
{
259263
bool changed{false};
260264

261265
auto exists = _ecm.Component<ComponentType>(_entity);
262266
if (_enable && !exists)
263267
{
264-
_ecm.CreateComponent(_entity, ComponentType());
268+
_ecm.CreateComponent(_entity, _comp);
265269
changed = true;
266270
}
267271
else if (!_enable && exists)

include/gz/sim/components/Model.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace serializers
5454
if (modelElem->HasElement("pose"))
5555
{
5656
sdf::ElementPtr poseElem = modelElem->GetElement("pose");
57-
if (poseElem->HasAttribute("relative_to"))
57+
if (poseElem->GetAttribute("relative_to")->GetSet())
5858
{
5959
// Skip serializing models with //pose/@relative_to attribute
6060
// since deserialization will fail. This could be a nested model.
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* Copyright (C) 2024 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#ifndef GZ_SIM_COMPONENTS_RAYCASTDATA_HH_
19+
#define GZ_SIM_COMPONENTS_RAYCASTDATA_HH_
20+
21+
#include <gz/math/Vector3.hh>
22+
#include <gz/sim/components/Factory.hh>
23+
#include <gz/sim/components/Component.hh>
24+
#include <gz/sim/components/Serialization.hh>
25+
#include <gz/sim/config.hh>
26+
27+
#include <istream>
28+
#include <ostream>
29+
#include <vector>
30+
31+
namespace gz
32+
{
33+
namespace sim
34+
{
35+
// Inline bracket to help doxygen filtering.
36+
inline namespace GZ_SIM_VERSION_NAMESPACE {
37+
namespace components
38+
{
39+
/// \brief A struct that holds the information of a ray.
40+
struct RayInfo
41+
{
42+
/// \brief Starting point of the ray in entity frame
43+
gz::math::Vector3d start;
44+
45+
/// \brief Ending point of the ray in entity frame
46+
gz::math::Vector3d end;
47+
};
48+
49+
/// \brief A struct that holds the result of a raycasting operation.
50+
struct RaycastResultInfo
51+
{
52+
/// \brief The hit point in entity frame
53+
gz::math::Vector3d point;
54+
55+
/// \brief The fraction of the ray length at the intersection/hit point.
56+
double fraction;
57+
58+
/// \brief The normal at the hit point in entity frame
59+
gz::math::Vector3d normal;
60+
};
61+
62+
/// @brief A struct that holds the raycasting data, including ray and results
63+
struct RaycastDataInfo
64+
{
65+
/// @brief The rays to cast from the entity.
66+
std::vector<RayInfo> rays;
67+
68+
/// @brief The results of the raycasting.
69+
std::vector<RaycastResultInfo> results;
70+
};
71+
}
72+
73+
namespace serializers
74+
{
75+
/// \brief Specialization of DefaultSerializer for RaycastDataInfo
76+
template<> class DefaultSerializer<components::RaycastDataInfo>
77+
{
78+
public: static std::ostream &Serialize(
79+
std::ostream &_out, const components::RaycastDataInfo &)
80+
{
81+
return _out;
82+
}
83+
84+
public: static std::istream &Deserialize(
85+
std::istream &_in, components::RaycastDataInfo &)
86+
{
87+
return _in;
88+
}
89+
};
90+
}
91+
92+
namespace components
93+
{
94+
/// \brief A component type that contains the rays traced from an entity
95+
/// into a physics world, along with the results of the raycasting operation.
96+
///
97+
/// This component is primarily used for applications that require raycasting.
98+
/// The target application defines the rays, and the physics system plugin
99+
/// updates the raycasting results during each update loop.
100+
using RaycastData = Component<RaycastDataInfo, class RaycastDataTag,
101+
serializers::DefaultSerializer<RaycastDataInfo>>;
102+
103+
GZ_SIM_REGISTER_COMPONENT("gz_sim_components.RaycastData", RaycastData)
104+
}
105+
}
106+
}
107+
}
108+
#endif // GZ_SIM_COMPONENTS_RAYCASTDATA_HH_

include/gz/sim/components/World.hh

+44
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
#include <sdf/World.hh>
2121

22+
#include <istream>
23+
#include <ostream>
24+
2225
#include <gz/sim/components/Factory.hh>
2326
#include <gz/sim/components/Component.hh>
2427
#include <gz/sim/config.hh>
@@ -29,6 +32,47 @@ namespace sim
2932
{
3033
// Inline bracket to help doxygen filtering.
3134
inline namespace GZ_SIM_VERSION_NAMESPACE {
35+
36+
// The following is only needed to keep ABI compatibility
37+
// TODO(azeey) Remove in main
38+
namespace traits
39+
{
40+
template<>
41+
class IsOutStreamable<std::ostream, sdf::World>
42+
{
43+
public: static constexpr bool value = false; // NOLINT
44+
};
45+
46+
template<>
47+
class IsInStreamable<std::istream, sdf::World>
48+
{
49+
public: static constexpr bool value = false; // NOLINT
50+
};
51+
}
52+
53+
namespace serializers
54+
{
55+
56+
/// \brief Specialize the DefaultSerializer on sdf::World so we can
57+
/// skip serialization
58+
/// TODO(azeey) Do we ever want to serialize this component?
59+
template <>
60+
class DefaultSerializer<sdf::World>
61+
{
62+
public:
63+
static std::ostream &Serialize(std::ostream &_out, const sdf::World &)
64+
{
65+
return _out;
66+
}
67+
68+
public:
69+
static std::istream &Deserialize(std::istream &_in, sdf::World &)
70+
{
71+
return _in;
72+
}
73+
};
74+
}
75+
3276
namespace components
3377
{
3478
/// \brief A component that identifies an entity as being a world.

package.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="2">
44
<name>gz-sim8</name>
5-
<version>8.7.0</version>
5+
<version>8.9.0</version>
66
<description>Gazebo Sim : A Robotic Simulator</description>
77
<maintainer email="mjcarroll@intrinsic.ai">Michael Carroll</maintainer>
88
<license>Apache License 2.0</license>

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ set (gtest_sources
114114
Joint_TEST.cc
115115
Light_TEST.cc
116116
Link_TEST.cc
117+
MeshInertiaCalculator_TEST.cc
117118
Model_TEST.cc
118119
Primitives_TEST.cc
119120
SdfEntityCreator_TEST.cc

src/Link.cc

+31-10
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,37 @@ std::optional<math::Vector3d> Link::WorldAngularVelocity(
284284
void Link::EnableVelocityChecks(EntityComponentManager &_ecm, bool _enable)
285285
const
286286
{
287-
enableComponent<components::WorldLinearVelocity>(_ecm, this->dataPtr->id,
288-
_enable);
289-
enableComponent<components::WorldAngularVelocity>(_ecm, this->dataPtr->id,
290-
_enable);
291-
enableComponent<components::LinearVelocity>(_ecm, this->dataPtr->id,
292-
_enable);
293-
enableComponent<components::AngularVelocity>(_ecm, this->dataPtr->id,
294-
_enable);
295-
enableComponent<components::WorldPose>(_ecm, this->dataPtr->id,
296-
_enable);
287+
auto defaultWorldPose = math::Pose3d::Zero;
288+
if (_enable)
289+
{
290+
defaultWorldPose = sim::worldPose(this->dataPtr->id, _ecm);
291+
}
292+
293+
enableComponent(_ecm, this->dataPtr->id,
294+
_enable, components::LinearVelocity());
295+
enableComponent(_ecm, this->dataPtr->id,
296+
_enable, components::AngularVelocity());
297+
enableComponent(_ecm, this->dataPtr->id,
298+
_enable, components::WorldPose(defaultWorldPose));
299+
300+
auto defaultWorldLinVel = math::Vector3d::Zero;
301+
auto defaultWorldAngVel = math::Vector3d::Zero;
302+
if (_enable)
303+
{
304+
// The WorldPose component is guaranteed to exist at this point
305+
auto worldPose = this->WorldPose(_ecm).value();
306+
307+
// Compute the default world linear and angular velocities
308+
defaultWorldLinVel = worldPose.Rot().RotateVector(
309+
_ecm.Component<components::LinearVelocity>(this->dataPtr->id)->Data());
310+
defaultWorldAngVel = worldPose.Rot().RotateVector(
311+
_ecm.Component<components::AngularVelocity>(this->dataPtr->id)->Data());
312+
}
313+
314+
enableComponent(_ecm, this->dataPtr->id,
315+
_enable, components::WorldLinearVelocity(defaultWorldLinVel));
316+
enableComponent(_ecm, this->dataPtr->id,
317+
_enable, components::WorldAngularVelocity(defaultWorldAngVel));
297318
}
298319

299320
//////////////////////////////////////////////////

0 commit comments

Comments
 (0)