Skip to content

Commit

Permalink
Try to fix the ABI breakage
Browse files Browse the repository at this point in the history
Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Nov 17, 2022
1 parent 38a887a commit 61b150e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
14 changes: 11 additions & 3 deletions include/gz/sim/components/Environment.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,17 @@ namespace components
/// instantiation that is guaranteed to outlive
/// them.
static std::shared_ptr<EnvironmentalData>
MakeShared(FrameT _frame, ReferenceT _reference,
ReferenceUnits _units = ReferenceUnits::RADIANS,
bool _ignoreTimeStep = false);
MakeShared(FrameT _frame, ReferenceT _reference);

/// \brief Instantiate environmental data.
///
/// An std::make_shared equivalent that ensures
/// dynamically loaded call sites use a template
/// instantiation that is guaranteed to outlive
/// them.
static std::shared_ptr<EnvironmentalData>
MakeSharedWithUnits(FrameT _frame, ReferenceT _reference,
ReferenceUnits _units, bool _ignoreTimeStep);

/// \brief Environmental data frame.
FrameT frame;
Expand Down
11 changes: 9 additions & 2 deletions src/components/Environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@
using namespace gz::sim::components;

std::shared_ptr<EnvironmentalData>
EnvironmentalData::MakeShared(FrameT _frame, ReferenceT _reference,
ReferenceUnits _units, bool _ignoreTimeStep)
EnvironmentalData::MakeShared(FrameT _frame, ReferenceT _reference)
{
return EnvironmentalData::MakeSharedWithUnits(
_frame, _reference, ReferenceUnits::RADIANS, false);
}

std::shared_ptr<EnvironmentalData>
EnvironmentalData::MakeSharedWithUnits(FrameT _frame, ReferenceT _reference,
ReferenceUnits _units, bool _ignoreTimeStep)
{
auto data = std::make_shared<EnvironmentalData>();
data->frame = std::move(_frame);
Expand Down
5 changes: 3 additions & 2 deletions src/gui/plugins/environment_loader/EnvironmentLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void EnvironmentLoader::Update(const UpdateInfo &,
try
{
using ComponentDataT = components::EnvironmentalData;
auto data = ComponentDataT::MakeShared(
auto data = ComponentDataT::MakeSharedWithUnits(
common::IO<ComponentDataT::FrameT>::ReadFrom(
common::CSVIStreamIterator(dataFile),
common::CSVIStreamIterator(),
Expand All @@ -144,7 +144,8 @@ void EnvironmentLoader::Update(const UpdateInfo &,
static_cast<size_t>(this->dataPtr->yIndex),
static_cast<size_t>(this->dataPtr->zIndex)}),
this->dataPtr->referenceMap[this->dataPtr->reference],
this->dataPtr->unitMap[this->dataPtr->unit]);
this->dataPtr->unitMap[this->dataPtr->unit],
false);

using ComponentT = components::Environment;
_ecm.CreateComponent(worldEntity(_ecm), ComponentT{std::move(data)});
Expand Down
2 changes: 1 addition & 1 deletion src/systems/environment_preload/EnvironmentPreload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void EnvironmentPreload::PreUpdate(
{
gzmsg << "Loading Environment Data\n";
using ComponentDataT = components::EnvironmentalData;
auto data = ComponentDataT::MakeShared(
auto data = ComponentDataT::MakeSharedWithUnits(
common::IO<ComponentDataT::FrameT>::ReadFrom(
common::CSVIStreamIterator(dataFile),
common::CSVIStreamIterator(),
Expand Down
2 changes: 0 additions & 2 deletions test/worlds/environmental_data.sdf.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<direction>-0.5 0.1 -0.9</direction>
</light>


<spherical_coordinates>
<surface_model>EARTH_WGS84</surface_model>
<world_frame_orientation>ENU</world_frame_orientation>
Expand All @@ -38,7 +37,6 @@
<heading_deg>0</heading_deg>
</spherical_coordinates>


<plugin
filename="gz-sim-environment-preload-system"
name="gz::sim::systems::EnvironmentPreload">
Expand Down

0 comments on commit 61b150e

Please sign in to comment.