36
36
#include < sdf/Geometry.hh>
37
37
#include < sdf/Heightmap.hh>
38
38
39
+ #include " gz/sim/components/SourceFilePath.hh"
39
40
#include " gz/sim/components/Geometry.hh"
40
41
#include " gz/sim/components/World.hh"
41
42
#include " gz/sim/Link.hh"
@@ -212,22 +213,19 @@ void LookupWheelSlip::Configure(const Entity &_entity,
212
213
return ;
213
214
}
214
215
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 ())
222
222
{
223
223
auto *component =
224
224
_ecm.Component <components::WorldSdf>(worldEntity (_ecm));
225
225
const std::string rootPath =
226
226
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 );
231
229
}
232
230
if (filePath.empty ())
233
231
{
@@ -237,6 +235,7 @@ void LookupWheelSlip::Configure(const Entity &_entity,
237
235
return ;
238
236
}
239
237
gzdbg << " Using slip_map: " << filePath << std::endl;
238
+ // transformation matrix from world to image coordinates
240
239
this ->dataPtr ->slipMapImg .Load (filePath);
241
240
this ->dataPtr ->slipMapRgb = this ->dataPtr ->slipMapImg .RGBData ();
242
241
this ->dataPtr ->worldToImgTransform (0 , 0 ) =
0 commit comments