/usr/include/kido/utils/urdf/KidoLoader.hpp is in libkido-utils-dev 0.1.0+dfsg-2build9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | /**
* @file KidoLoader.h
*/
#ifndef KIDO_UTILS_URDF_LOADER_H
#define KIDO_UTILS_URDF_LOADER_H
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <map>
#include <string>
#include "kido/common/Deprecated.hpp"
#include "kido/common/LocalResourceRetriever.hpp"
#include "kido/common/ResourceRetriever.hpp"
#include "kido/common/Uri.hpp"
#include "kido/dynamics/BodyNode.hpp"
#include "kido/dynamics/Joint.hpp"
#include "kido/dynamics/Skeleton.hpp"
#include "kido/simulation/World.hpp"
#include "kido/utils/CompositeResourceRetriever.hpp"
#include "kido/utils/PackageResourceRetriever.hpp"
namespace urdf
{
class ModelInterface;
class Link;
class Joint;
class Pose;
class Vector3;
}
namespace kido {
namespace dynamics
{
class Skeleton;
class BodyNode;
class Joint;
class Shape;
}
namespace simulation
{
class World;
}
namespace utils {
/**
* @class KidoLoader
*/
class KidoLoader {
public:
/// Constructor with the default ResourceRetriever.
KidoLoader();
/// Specify the directory of a ROS package. In your URDF files, you may see
/// strings with a package URI pattern such as:
///
/// @code
/// "package://my_robot/meshes/mesh_for_my_robot.stl"
/// \______/ \______/\___________________________/
/// | | |
/// package package file path with respect to
/// keyword name the package directory
/// @endcode
///
/// For us to successfully parse a URDF, we need to be told what the path
/// to the package directory is, using addPackageDirectory(). In this case,
/// suppose the path to the my_robot package is /path/to/my_robot. Then you
/// should use addPackageDirectory("my_robot", "/path/to/my_robot").
/// Altogether, this implies that a file named
/// "/path/to/my_robot/meshes/mesh_for_my_robot.stl" exists. Whatever you
/// specify as the package directory will end up replacing the 'package
/// keyword' and 'package name' components of the URI string.
void addPackageDirectory(const std::string& _packageName,
const std::string& _packageDirectory);
/// Parse a file to produce a Skeleton
dynamics::SkeletonPtr parseSkeleton(
const common::Uri& _uri,
const common::ResourceRetrieverPtr& _resourceRetriever = nullptr);
/// Parse a text string to produce a Skeleton
dynamics::SkeletonPtr parseSkeletonString(
const std::string& _urdfString, const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever = nullptr);
/// Parse a file to produce a World
kido::simulation::WorldPtr parseWorld(const common::Uri& _uri,
const common::ResourceRetrieverPtr& _resourceRetriever = nullptr);
/// Parse a text string to produce a World
kido::simulation::WorldPtr parseWorldString(
const std::string& _urdfString, const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever = nullptr);
private:
typedef std::shared_ptr<dynamics::BodyNode::Properties> BodyPropPtr;
typedef std::shared_ptr<dynamics::Joint::Properties> JointPropPtr;
static kido::dynamics::SkeletonPtr modelInterfaceToSkeleton(
const urdf::ModelInterface* _model,
const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever);
static bool createSkeletonRecursive(
dynamics::SkeletonPtr _skel,
const urdf::Link* _lk,
dynamics::BodyNode* _parent,
const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever);
template <class VisualOrCollision>
static dynamics::ShapePtr createShape(const VisualOrCollision* _vizOrCol,
const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever);
static dynamics::BodyNode* createKidoJointAndNode(
const urdf::Joint* _jt,
const dynamics::BodyNode::Properties& _body,
dynamics::BodyNode* _parent,
dynamics::SkeletonPtr _skeleton,
const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever);
static bool createKidoNodeProperties(
const urdf::Link* _lk,
dynamics::BodyNode::Properties &properties,
const common::Uri& _baseUri,
const common::ResourceRetrieverPtr& _resourceRetriever);
common::ResourceRetrieverPtr getResourceRetriever(
const common::ResourceRetrieverPtr& _resourceRetriever);
static Eigen::Isometry3d toEigen(const urdf::Pose& _pose);
static Eigen::Vector3d toEigen(const urdf::Vector3& _vector);
static bool readFileToString(
const common::ResourceRetrieverPtr& _resourceRetriever,
const common::Uri& _uri,
std::string &_output);
common::LocalResourceRetrieverPtr mLocalRetriever;
utils::PackageResourceRetrieverPtr mPackageRetriever;
utils::CompositeResourceRetrieverPtr mRetriever;
};
}
}
#endif /** KIDO_UTILS_URDF_LOADER_H */
|