diff --git a/include/sdf/InterafaceMoiCalculator.hh b/include/sdf/CustomInertiaCalcProperties.hh similarity index 83% rename from include/sdf/InterafaceMoiCalculator.hh rename to include/sdf/CustomInertiaCalcProperties.hh index 3bb0518ec..0b746c7ef 100644 --- a/include/sdf/InterafaceMoiCalculator.hh +++ b/include/sdf/CustomInertiaCalcProperties.hh @@ -1,5 +1,5 @@ /* - * Copyright 2021 Open Source Robotics Foundation + * Copyright 2023 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ * */ -#ifndef SDF_INTERFACE_MOI_CALCULATOR_HH_ -#define SDF_INTERFACE_MOI_CALCULATOR_HH_ +#ifndef SDF_CUSTOM_INERTIA_CALC_PROPERTIES_HH_ +#define SDF_CUSTOM_INERTIA_CALC_PROPERTIES_HH_ #include #include @@ -33,13 +33,13 @@ inline namespace SDF_VERSION_NAMESPACE // Forward Declarations class Mesh; -class SDFORMAT_VISIBLE InterfaceMoiCalculator +class SDFORMAT_VISIBLE CustomInertiaCalcProperties { /// \brief Constructor /// \param[in] _density Double density value /// \param[in] _mesh sdf::Mesh object /// \param[in] _calculatorParamElem sdf::ElementPtr for calculator params element - public: InterfaceMoiCalculator(const double _density, + public: CustomInertiaCalcProperties(const double _density, const sdf::Mesh _mesh, const sdf::ElementPtr _calculatorParams); @@ -62,11 +62,11 @@ class SDFORMAT_VISIBLE InterfaceMoiCalculator /// \brief Get the reference to the sdf element. /// User defined custom calculator params can be accessed through this element /// \return sdf::ElementPtr for the tag - public: const sdf::ElementPtr MoiCalculatorParams() const; + public: const sdf::ElementPtr AutoInertiaParams() const; /// \brief Function to set the calculator params sdf element object /// \param[in] _calculatorParamElem sdf::ElementPtr for calculator params element - public: void SetMoiCalculatorParams(sdf::ElementPtr _calculatorParamElem); + public: void SetAutoInertiaParams(sdf::ElementPtr _calculatorParamElem); /// \brief Private data pointer. GZ_UTILS_IMPL_PTR(dataPtr) @@ -74,7 +74,7 @@ class SDFORMAT_VISIBLE InterfaceMoiCalculator using CustomInertiaCalculator = std::function(sdf::Errors &, - const sdf::InterfaceMoiCalculator &)>; + const sdf::CustomInertiaCalcProperties &)>; } } diff --git a/include/sdf/Mesh.hh b/include/sdf/Mesh.hh index ebcb7b13f..d61da3244 100644 --- a/include/sdf/Mesh.hh +++ b/include/sdf/Mesh.hh @@ -23,7 +23,7 @@ #include #include #include -#include "sdf/InterafaceMoiCalculator.hh" +#include #include #include #include diff --git a/include/sdf/ParserConfig.hh b/include/sdf/ParserConfig.hh index 9c44d7be4..ce5dfcdd2 100644 --- a/include/sdf/ParserConfig.hh +++ b/include/sdf/ParserConfig.hh @@ -27,7 +27,7 @@ #include "sdf/Error.hh" #include "sdf/InterfaceElements.hh" -#include "sdf/InterafaceMoiCalculator.hh" +#include "sdf/CustomInertiaCalcProperties.hh" #include "sdf/sdf_config.h" #include "sdf/system_util.hh" diff --git a/src/InterfaceMoiCalculator.cc b/src/CustomInertiaCalcProperties.cc similarity index 51% rename from src/InterfaceMoiCalculator.cc rename to src/CustomInertiaCalcProperties.cc index 06936d532..dbac303d1 100644 --- a/src/InterfaceMoiCalculator.cc +++ b/src/CustomInertiaCalcProperties.cc @@ -1,5 +1,5 @@ /* - * Copyright 2021 Open Source Robotics Foundation + * Copyright 2023 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,13 +15,13 @@ * */ -#include "sdf/InterafaceMoiCalculator.hh" +#include "sdf/CustomInertiaCalcProperties.hh" #include "sdf/Mesh.hh" #include "sdf/Element.hh" using namespace sdf; -class InterfaceMoiCalculator::Implementation +class CustomInertiaCalcProperties::Implementation { /// \brief Density of the mesh public: double density; @@ -31,45 +31,52 @@ class InterfaceMoiCalculator::Implementation /// \brief SDF element pointer to tag. This can be used /// to access custom params for the Mesh Intertia Caluclator - public: sdf::ElementPtr calculatorParams; + public: sdf::ElementPtr inertiaCalculatorParams; }; -InterfaceMoiCalculator::InterfaceMoiCalculator(const double _density, +///////////////////////////////////////////////// +CustomInertiaCalcProperties::CustomInertiaCalcProperties(const double _density, const sdf::Mesh _mesh, const sdf::ElementPtr _calculatorParams) : dataPtr(gz::utils::MakeImpl()) { this->dataPtr->density = _density; this->dataPtr->mesh = _mesh; - this->dataPtr->calculatorParams = _calculatorParams; + this->dataPtr->inertiaCalculatorParams = _calculatorParams; } -const double InterfaceMoiCalculator::Density() const +///////////////////////////////////////////////// +const double CustomInertiaCalcProperties::Density() const { return this->dataPtr->density; } -void InterfaceMoiCalculator::SetDensity(const double _density) +///////////////////////////////////////////////// +void CustomInertiaCalcProperties::SetDensity(const double _density) { this->dataPtr->density = _density; } -const sdf::Mesh &InterfaceMoiCalculator::Mesh() const +///////////////////////////////////////////////// +const sdf::Mesh &CustomInertiaCalcProperties::Mesh() const { return this->dataPtr->mesh; } -void InterfaceMoiCalculator::SetMesh(sdf::Mesh &_mesh) +///////////////////////////////////////////////// +void CustomInertiaCalcProperties::SetMesh(sdf::Mesh &_mesh) { this->dataPtr->mesh = _mesh; } -const sdf::ElementPtr InterfaceMoiCalculator::MoiCalculatorParams() const +///////////////////////////////////////////////// +const sdf::ElementPtr CustomInertiaCalcProperties::AutoInertiaParams() const { - return this->dataPtr->calculatorParams; + return this->dataPtr->inertiaCalculatorParams; } -void InterfaceMoiCalculator::SetMoiCalculatorParams(sdf::ElementPtr _calculatorParams) +///////////////////////////////////////////////// +void CustomInertiaCalcProperties::SetAutoInertiaParams(sdf::ElementPtr _autoInertiaParams) { - this->dataPtr->calculatorParams = _calculatorParams; + this->dataPtr->inertiaCalculatorParams = _autoInertiaParams; } \ No newline at end of file diff --git a/src/Mesh.cc b/src/Mesh.cc index ee1cfcf87..b78fcaeef 100644 --- a/src/Mesh.cc +++ b/src/Mesh.cc @@ -18,7 +18,7 @@ #include #include -#include "sdf/InterafaceMoiCalculator.hh" +#include "sdf/CustomInertiaCalcProperties.hh" #include "sdf/parser.hh" #include "sdf/Mesh.hh" #include "Utils.hh" @@ -206,7 +206,7 @@ std::optional Mesh::CalculateInertial(const double _density std::cout << "In Mesh:CalculateInertial function: " << std::endl; const auto &customCalculator = _config.CustomInertiaCalc(); - sdf::InterfaceMoiCalculator calcInterface = InterfaceMoiCalculator( + sdf::CustomInertiaCalcProperties calcInterface = CustomInertiaCalcProperties( _density, *this, _autoInertiaParams); return customCalculator(errors, calcInterface); diff --git a/src/ParserConfig.cc b/src/ParserConfig.cc index a584e5315..b1063a7c1 100644 --- a/src/ParserConfig.cc +++ b/src/ParserConfig.cc @@ -20,7 +20,7 @@ #include "sdf/ParserConfig.hh" #include "sdf/Filesystem.hh" #include "sdf/Types.hh" -#include "sdf/InterafaceMoiCalculator.hh" +#include "sdf/CustomInertiaCalcProperties.hh" using namespace sdf;