Mujoco KDL Wrapper
0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
Dark
Loading...
Searching...
No Matches
example_paths.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <filesystem>
4
#include <stdexcept>
5
#include <string>
6
7
namespace
mj_kdl_examples
{
8
namespace
fs = std::filesystem;
9
10
inline
std::string
find_asset
(
const
fs::path &relative)
11
{
12
const
auto
path = fs::path(MJ_KDL_ASSETS_DIR) / relative;
13
return
fs::exists(path) ? path.string() :
""
;
14
}
15
16
inline
std::string
asset
(
const
fs::path &relative)
17
{
18
if
(std::string path =
find_asset
(relative); !path.empty())
return
path;
19
throw
std::runtime_error(relative.string() +
" not found in "
MJ_KDL_ASSETS_DIR);
20
}
21
}
// namespace mj_kdl_examples
mj_kdl_examples
Definition
common.hpp:16
mj_kdl_examples::asset
std::string asset(const fs::path &relative)
Definition
example_paths.hpp:16
mj_kdl_examples::find_asset
std::string find_asset(const fs::path &relative)
Definition
example_paths.hpp:10
src
examples
example_paths.hpp
Generated by
1.16.1