From 7c3fd166d797ead23889af57f05fe8ccdb582401 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Fri, 12 Sep 2025 01:28:20 +0000 Subject: [PATCH 1/3] Use common::findFile when search for slip map in LookupWheelSlip system Signed-off-by: Ian Chen --- .../lookup_wheel_slip/LookupWheelSlip.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc index b63b7e59e3..5cf8f0742d 100644 --- a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc +++ b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc @@ -212,22 +212,17 @@ void LookupWheelSlip::Configure(const Entity &_entity, return; } - // transformation matrix from world to image coordinates - std::string filePath; - if (common::isFile(this->dataPtr->slipMapFilename)) - { - filePath = this->dataPtr->slipMapFilename; - } - else if (common::isRelativePath(this->dataPtr->slipMapFilename)) + // file the slip map file + std::string filePath = common::findFile(asFullPath( + this->dataPtr->slipMapFilename, _sdf->FilePath()), false); + if (filePath.empty()) { auto *component = _ecm.Component(worldEntity(_ecm)); const std::string rootPath = common::parentPath(component->Data().Element()->FilePath()); - std::string path = common::joinPaths(rootPath, - this->dataPtr->slipMapFilename); - if (common::isFile(path)) - filePath = path; + filePath = common::findFile(asFullPath(this->dataPtr->slipMapFilename, + component->Data().Element()->FilePath()), false); } if (filePath.empty()) { @@ -237,6 +232,7 @@ void LookupWheelSlip::Configure(const Entity &_entity, return; } gzdbg << "Using slip_map: " << filePath << std::endl; + // transformation matrix from world to image coordinates this->dataPtr->slipMapImg.Load(filePath); this->dataPtr->slipMapRgb = this->dataPtr->slipMapImg.RGBData(); this->dataPtr->worldToImgTransform(0, 0) = From 15d9049273cc9aba0b49a9b22868f07e547e7c1a Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Fri, 12 Sep 2025 01:47:09 +0000 Subject: [PATCH 2/3] fix typo Signed-off-by: Ian Chen --- src/systems/lookup_wheel_slip/LookupWheelSlip.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc index 5cf8f0742d..76d69526db 100644 --- a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc +++ b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc @@ -212,7 +212,7 @@ void LookupWheelSlip::Configure(const Entity &_entity, return; } - // file the slip map file + // find the slip map file std::string filePath = common::findFile(asFullPath( this->dataPtr->slipMapFilename, _sdf->FilePath()), false); if (filePath.empty()) From a6cbacaaf54280a078d83580ca699be6ec3355bd Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 11 Sep 2025 20:56:11 -0700 Subject: [PATCH 3/3] tweak Signed-off-by: Ian Chen --- src/systems/lookup_wheel_slip/LookupWheelSlip.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc index 76d69526db..0458b8e1ec 100644 --- a/src/systems/lookup_wheel_slip/LookupWheelSlip.cc +++ b/src/systems/lookup_wheel_slip/LookupWheelSlip.cc @@ -36,6 +36,7 @@ #include #include +#include "gz/sim/components/SourceFilePath.hh" #include "gz/sim/components/Geometry.hh" #include "gz/sim/components/World.hh" #include "gz/sim/Link.hh" @@ -213,8 +214,10 @@ void LookupWheelSlip::Configure(const Entity &_entity, } // find the slip map file + auto modelPath = + _ecm.ComponentData(_entity); std::string filePath = common::findFile(asFullPath( - this->dataPtr->slipMapFilename, _sdf->FilePath()), false); + this->dataPtr->slipMapFilename, modelPath.value()), false); if (filePath.empty()) { auto *component =