Mujoco KDL Wrapper  0.5.1
MuJoCo + KDL bridge for robot kinematics and dynamics
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
7namespace mj_kdl_examples {
8namespace fs = std::filesystem;
9
10inline 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
16inline 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
std::string asset(const fs::path &relative)
std::string find_asset(const fs::path &relative)