Ravelin
URDFReader.h
1 /****************************************************************************
2  * Copyright 2015 Evan Drumwright
3  * This library is distributed under the terms of the Apache V2.0
4  * License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
5  ****************************************************************************/
6 
7 class RIGIDBODY;
9 class JOINT;
10 
13 {
14  public:
15  static bool read(const std::string& fname, std::string& name, std::vector<boost::shared_ptr<RIGIDBODY> >& links, std::vector<boost::shared_ptr<JOINT> >& joints);
16 
17  private:
18  class URDFData
19  {
20  public:
21  ~URDFData()
22  {
23  }
24 
25  std::map<boost::shared_ptr<JOINT>, boost::shared_ptr<RIGIDBODY> > joint_parent, joint_child;
26  std::map<std::string, std::pair<VectorNd, std::string> > materials;
27  };
28 
29  static void find_outboards(const URDFData& data, boost::shared_ptr<RIGIDBODY> link, std::vector<std::pair<boost::shared_ptr<JOINT>, boost::shared_ptr<RIGIDBODY> > >& outboards, std::map<boost::shared_ptr<RIGIDBODY>, boost::shared_ptr<RIGIDBODY> >& parents);
30  static void output_data(const URDFData& data, boost::shared_ptr<RIGIDBODY> link);
31  static boost::shared_ptr<JOINT> find_joint(const URDFData& data, boost::shared_ptr<RIGIDBODY> outboard_link);
32  static void find_children(const URDFData& data, boost::shared_ptr<RIGIDBODY> link, std::queue<boost::shared_ptr<RIGIDBODY> >& q, std::map<boost::shared_ptr<RIGIDBODY>, boost::shared_ptr<RIGIDBODY> >& parents);
33  static MATRIX3 read_inertia(boost::shared_ptr<const XMLTree> node, URDFData& data);
34  static double read_mass(boost::shared_ptr<const XMLTree> node, URDFData& data);
35  static POSE3 read_origin(boost::shared_ptr<const XMLTree> node, URDFData& data);
36  static void read_inertial(boost::shared_ptr<const XMLTree> node, URDFData& data, boost::shared_ptr<RIGIDBODY> link);
37  static void read_axis(boost::shared_ptr<const XMLTree> node, URDFData& data, boost::shared_ptr<JOINT> joint);
38  static boost::shared_ptr<RIGIDBODY> read_parent(boost::shared_ptr<const XMLTree> node, URDFData& data, const std::vector<boost::shared_ptr<RIGIDBODY> >& links);
39  static boost::shared_ptr<RIGIDBODY> read_child(boost::shared_ptr<const XMLTree> node, URDFData& data, const std::vector<boost::shared_ptr<RIGIDBODY> >& links);
40  static void read_joint(boost::shared_ptr<const XMLTree> node, URDFData& data, const std::vector<boost::shared_ptr<RIGIDBODY> >& links, std::vector<boost::shared_ptr<JOINT> >& joints);
41  static void read_joints(boost::shared_ptr<const XMLTree> node, URDFData& data, const std::vector<boost::shared_ptr<RIGIDBODY> >& links, std::vector<boost::shared_ptr<JOINT> >& joints);
42  static void read_links(boost::shared_ptr<const XMLTree> node, URDFData& data, std::vector<boost::shared_ptr<RIGIDBODY> >& links);
43  static void read_link(boost::shared_ptr<const XMLTree> node, URDFData& data, std::vector<boost::shared_ptr<RIGIDBODY> >& links);
44  static bool read_robot(boost::shared_ptr<const XMLTree> node, URDFData& data, std::string& name, std::vector<boost::shared_ptr<RIGIDBODY> >& links, std::vector<boost::shared_ptr<JOINT> >& joints);
45 }; // end class
46 
47 
Represents a single rigid body.
Definition: RigidBody.h:23
Defines an articulated body for use with reduced-coordinate dynamics algorithms.
Definition: RCArticulatedBody.h:29
A rigid body pose.
Definition: Pose3.h:15
Used to read the simulator state from URDF.
Definition: URDFReader.h:12
Defines a bilateral constraint (a joint)
Definition: Joint.h:14
A 3x3 matrix that may be used for orientation, inertia tensors, etc.
Definition: Matrix3.h:20