From ac7f755c62334586102e28fc0f7607bc02aacc0d Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Tue, 29 Aug 2023 16:02:16 -0700 Subject: [PATCH] piston force should be in Newtons rather than lbs Signed-off-by: Michael Anderson --- buoy_gazebo/src/ElectroHydraulicPTO/ElectroHydraulicPTO.cpp | 4 ++-- buoy_gazebo/src/buoy_utils/Constants.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/buoy_gazebo/src/ElectroHydraulicPTO/ElectroHydraulicPTO.cpp b/buoy_gazebo/src/ElectroHydraulicPTO/ElectroHydraulicPTO.cpp index 4d439b4e..39e1f3b4 100644 --- a/buoy_gazebo/src/ElectroHydraulicPTO/ElectroHydraulicPTO.cpp +++ b/buoy_gazebo/src/ElectroHydraulicPTO/ElectroHydraulicPTO.cpp @@ -437,7 +437,7 @@ void ElectroHydraulicPTO::PreUpdate( // Apply force if not in Velocity Mode, in which case a joint velocity is applied elsewhere // (likely by a test Fixture) if (!this->dataPtr->VelMode) { - double piston_force = -deltaP * this->dataPtr->PistonArea; + double piston_force = -deltaP * this->dataPtr->PistonArea * buoy_utils::NEWTONS_PER_LB; // Create new component for this entitiy in ECM (if it doesn't already exist) auto forceComp = _ecm.Component( this->dataPtr->PrismaticJointEntity); @@ -446,7 +446,7 @@ void ElectroHydraulicPTO::PreUpdate( this->dataPtr->PrismaticJointEntity, gz::sim::components::JointForceCmd({piston_force})); // Create this iteration } else { - forceComp->Data()[0] += piston_force; // Add force to existing forces. + forceComp->Data()[0] += piston_force; // Add force to existing forces. } } } diff --git a/buoy_gazebo/src/buoy_utils/Constants.hpp b/buoy_gazebo/src/buoy_utils/Constants.hpp index 666bd9bc..68810e92 100644 --- a/buoy_gazebo/src/buoy_utils/Constants.hpp +++ b/buoy_gazebo/src/buoy_utils/Constants.hpp @@ -26,6 +26,7 @@ static constexpr double RPM_TO_RAD_PER_SEC{2.0 * M_PI / 60.0}; static constexpr double NM_PER_INLB{0.112984829}; static constexpr double INLB_PER_NM{8.851}; static constexpr double INCHES_PER_METER{39.4}; +static constexpr double NEWTONS_PER_LB{4.4482}; } // namespace buoy_utils