Skip to content

Commit 50b3514

Browse files
authored
Merge branch 'gz-sim10' into jrivero/backwards_remove
2 parents cf02e9d + 426c1a3 commit 50b3514

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/systems/lookup_wheel_slip/LookupWheelSlip.cc

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <sdf/Geometry.hh>
3737
#include <sdf/Heightmap.hh>
3838

39+
#include "gz/sim/components/SourceFilePath.hh"
3940
#include "gz/sim/components/Geometry.hh"
4041
#include "gz/sim/components/World.hh"
4142
#include "gz/sim/Link.hh"
@@ -212,22 +213,19 @@ void LookupWheelSlip::Configure(const Entity &_entity,
212213
return;
213214
}
214215

215-
// transformation matrix from world to image coordinates
216-
std::string filePath;
217-
if (common::isFile(this->dataPtr->slipMapFilename))
218-
{
219-
filePath = this->dataPtr->slipMapFilename;
220-
}
221-
else if (common::isRelativePath(this->dataPtr->slipMapFilename))
216+
// find the slip map file
217+
auto modelPath =
218+
_ecm.ComponentData<components::SourceFilePath>(_entity);
219+
std::string filePath = common::findFile(asFullPath(
220+
this->dataPtr->slipMapFilename, modelPath.value()), false);
221+
if (filePath.empty())
222222
{
223223
auto *component =
224224
_ecm.Component<components::WorldSdf>(worldEntity(_ecm));
225225
const std::string rootPath =
226226
common::parentPath(component->Data().Element()->FilePath());
227-
std::string path = common::joinPaths(rootPath,
228-
this->dataPtr->slipMapFilename);
229-
if (common::isFile(path))
230-
filePath = path;
227+
filePath = common::findFile(asFullPath(this->dataPtr->slipMapFilename,
228+
component->Data().Element()->FilePath()), false);
231229
}
232230
if (filePath.empty())
233231
{
@@ -237,6 +235,7 @@ void LookupWheelSlip::Configure(const Entity &_entity,
237235
return;
238236
}
239237
gzdbg << "Using slip_map: " << filePath << std::endl;
238+
// transformation matrix from world to image coordinates
240239
this->dataPtr->slipMapImg.Load(filePath);
241240
this->dataPtr->slipMapRgb = this->dataPtr->slipMapImg.RGBData();
242241
this->dataPtr->worldToImgTransform(0, 0) =

0 commit comments

Comments
 (0)