DART 6.10.1
Loading...
Searching...
No Matches
Joint.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2021, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_UTILS_MJCF_DETAIL_JOINT_HPP_
34#define DART_UTILS_MJCF_DETAIL_JOINT_HPP_
35
36#include <tinyxml2.h>
37
43
44namespace dart {
45namespace utils {
46namespace MjcfParser {
47namespace detail {
48
49class Body;
50
51class Joint final
52{
53public:
54 Joint() = default;
55
56 const std::string& getName() const;
57 JointType getType() const;
58 const Eigen::Vector3d& getPos() const;
59 const Eigen::Vector3d& getAxis() const;
60 bool isLimited() const;
61 const Eigen::Vector2d& getRange() const;
62 double getDamping() const;
63 double getSpringRef() const;
64
65private:
66 // Private members used by Body class
67 friend class Body;
69 tinyxml2::XMLElement* element,
70 const Defaults& defaults,
71 const JointAttributes& defaultAttributes);
72
74 Errors preprocess(const Compiler& compiler);
75
78 Errors compile(const Compiler& compiler);
79
81 Errors postprocess(const Body* body, const Compiler& compiler);
82
83private:
85
86 std::string mName{""};
87
89
90 int mGroup{0};
91
95 Eigen::Vector3d mPos{Eigen::Vector3d::Zero()};
96
100 Eigen::Vector3d mAxis{Eigen::Vector3d::UnitZ()};
101
102 Eigen::Vector2d mSpringDamper{Eigen::Vector2d::Zero()};
103
105 bool mLimited{false};
106
107 double mStiffness{0};
108
110 Eigen::Vector2d mRange{Eigen::Vector2d::Zero()};
111
112 double mMargin{0};
113
114 double mRef{0};
115
116 double mSpringRef{0};
117
118 double mArmature{0};
119
120 double mDamping{0};
121
122 double mFrictionLoss{0};
123
124 Eigen::VectorXd mUser;
125};
126
127} // namespace detail
128} // namespace MjcfParser
129} // namespace utils
130} // namespace dart
131
132#endif // #ifndef DART_UTILS_MJCF_DETAIL_JOINT_HPP_
double mStiffness
Definition Joint.hpp:107
double mMargin
Definition Joint.hpp:112
int mGroup
Definition Joint.hpp:90
bool isLimited() const
Definition Joint.cpp:164
double mArmature
Definition Joint.hpp:118
JointType getType() const
Definition Joint.cpp:146
Eigen::Vector2d mSpringDamper
Definition Joint.hpp:102
bool mLimited
This attribute specifies if the joint has limits.
Definition Joint.hpp:105
double getDamping() const
Definition Joint.cpp:176
const Eigen::Vector3d & getAxis() const
Definition Joint.cpp:158
std::string mName
Definition Joint.hpp:86
const Eigen::Vector3d & getPos() const
Definition Joint.cpp:152
double mRef
Definition Joint.hpp:114
Errors preprocess(const Compiler &compiler)
Updates attributes and elements that doesn't require any other elements.
Definition Joint.cpp:88
double mDamping
Definition Joint.hpp:120
JointAttributes mAttributes
Definition Joint.hpp:84
double getSpringRef() const
Definition Joint.cpp:182
Errors compile(const Compiler &compiler)
Updates attributes and elements that require the preprocessed child elements of this <joint>.
Definition Joint.cpp:108
Eigen::Vector2d mRange
The joint limits.
Definition Joint.hpp:110
Eigen::Vector3d mPos
Position of the joint, specified in local or global coordinates as determined by the coordinate attri...
Definition Joint.hpp:95
double mFrictionLoss
Definition Joint.hpp:122
JointType mType
Definition Joint.hpp:88
const Eigen::Vector2d & getRange() const
Definition Joint.cpp:170
Errors read(tinyxml2::XMLElement *element, const Defaults &defaults, const JointAttributes &defaultAttributes)
Definition Joint.cpp:44
Errors postprocess(const Body *body, const Compiler &compiler)
Updates attributes and elements that require the compiled parent element.
Definition Joint.cpp:115
const std::string & getName() const
Definition Joint.cpp:140
Eigen::Vector3d mAxis
This attribute specifies the axis of rotation for hinge joints and the direction of translation for s...
Definition Joint.hpp:100
double mSpringRef
Definition Joint.hpp:116
Eigen::VectorXd mUser
Definition Joint.hpp:124
JointType
Definition Types.hpp:132
std::vector< Error > Errors
Definition Error.hpp:85
Definition BulletCollisionDetector.cpp:65
Definition JointAttributes.hpp:49