DART  6.10.1
Compiler.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_COMPILER_HPP_
34 #define DART_UTILS_MJCF_DETAIL_COMPILER_HPP_
35 
36 #include <Eigen/Core>
37 #include <tinyxml2.h>
38 
39 #include "dart/common/Platform.hpp"
41 #include "dart/common/Uri.hpp"
44 
45 namespace dart {
46 namespace utils {
47 namespace MjcfParser {
48 namespace detail {
49 
50 class Compiler final
51 {
52 public:
53  Compiler() = default;
54 
55  void setBaseUri(const common::Uri& baseUri);
56  const common::Uri& getBaseUri() const;
59 
60  double getBoundMass() const;
61  double getBoundInertia() const;
62  double getSetTotalMass() const;
63  bool getBalanceInertia() const;
64  bool getStripPath() const;
65  Coordinate getCoordinate() const;
66  Angle getAngle() const;
67  bool getFitAabb() const;
68  const std::string& getEulerSeq() const;
69  const std::string& getMeshDir() const;
70  const std::string& getTextureDir() const;
71  bool getDiscardVisual() const;
72  bool getConvexHull() const;
73  bool getUserThread() const;
74  bool getFuseStatic() const;
76  const Eigen::Vector2i& getInertiaGroupRange() const;
77 
78 private:
79  // Private memebers used by MujocoModel class
80  friend class MujocoModel;
81  Errors read(tinyxml2::XMLElement* element);
82 
83 private:
86 
87  double mBoundMass{0};
88  double mBoundInertia{0};
89  double mSetTotalMass{-1};
90  bool mBalanceInertia{false};
91  bool mStripPath{false};
94  bool mFitAabb{false};
95  std::string mEulerSeq{"xyz"};
96  std::string mMeshDir{""};
97  std::string mTextureDir{""};
98  bool mDiscardVisual{false};
99  bool mConvexHull{true};
100  bool mUserThread{true};
101  bool mFuseStatic{false};
102 #if DART_OS_WINDOWS
103  InertiaFromGeom mInertiaFromGeom{InertiaFromGeom::IFG_AUTO};
104 #else
106 #endif
107  Eigen::Vector2i mInertiaGroupRange{Eigen::Vector2i(0, 5)};
108 };
109 
110 } // namespace detail
111 } // namespace MjcfParser
112 } // namespace utils
113 } // namespace dart
114 
115 #endif // #ifndef DART_UTILS_MJCF_DETAIL_COMPILER_HPP_
double mBoundInertia
Definition: Compiler.hpp:88
bool mBalanceInertia
Definition: Compiler.hpp:90
Coordinate mCoordinate
Definition: Compiler.hpp:92
const std::string & getEulerSeq() const
Definition: Compiler.cpp:303
bool mConvexHull
Definition: Compiler.hpp:99
std::string mMeshDir
Definition: Compiler.hpp:96
const Eigen::Vector2i & getInertiaGroupRange() const
Definition: Compiler.cpp:351
std::string mTextureDir
Definition: Compiler.hpp:97
bool mDiscardVisual
Definition: Compiler.hpp:98
Errors read(tinyxml2::XMLElement *element)
Definition: Compiler.cpp:70
bool getFuseStatic() const
Definition: Compiler.cpp:339
double getSetTotalMass() const
Definition: Compiler.cpp:261
const std::string & getMeshDir() const
Definition: Compiler.cpp:309
Coordinate getCoordinate() const
Definition: Compiler.cpp:285
const common::Uri & getBaseUri() const
Definition: Compiler.cpp:51
double getBoundMass() const
Definition: Compiler.cpp:279
bool getBalanceInertia() const
Definition: Compiler.cpp:267
std::string mEulerSeq
Definition: Compiler.hpp:95
bool mUserThread
Definition: Compiler.hpp:100
Angle getAngle() const
Definition: Compiler.cpp:291
common::ResourceRetrieverPtr getResourceRetriever() const
Definition: Compiler.cpp:64
InertiaFromGeom mInertiaFromGeom
Definition: Compiler.hpp:105
bool mFitAabb
Definition: Compiler.hpp:94
bool getFitAabb() const
Definition: Compiler.cpp:297
common::ResourceRetrieverPtr mRetriever
Definition: Compiler.hpp:85
Eigen::Vector2i mInertiaGroupRange
Definition: Compiler.hpp:107
double mBoundMass
Definition: Compiler.hpp:87
const std::string & getTextureDir() const
Definition: Compiler.cpp:315
bool getUserThread() const
Definition: Compiler.cpp:333
bool getConvexHull() const
Definition: Compiler.cpp:327
Angle mAngle
Definition: Compiler.hpp:93
double mSetTotalMass
Definition: Compiler.hpp:89
bool mFuseStatic
Definition: Compiler.hpp:101
InertiaFromGeom getInertiaFromGeom() const
Definition: Compiler.cpp:345
bool getStripPath() const
Definition: Compiler.cpp:273
void setBaseUri(const common::Uri &baseUri)
Definition: Compiler.cpp:45
bool getDiscardVisual() const
Definition: Compiler.cpp:321
double getBoundInertia() const
Definition: Compiler.cpp:255
bool mStripPath
Definition: Compiler.hpp:91
void setResourceRetriever(const common::ResourceRetrieverPtr &retriever)
Definition: Compiler.cpp:57
common::Uri mBaseUri
Definition: Compiler.hpp:84
Main class to parse MJCF model file.
Definition: MujocoModel.hpp:56
std::shared_ptr< ResourceRetriever > ResourceRetrieverPtr
Definition: ResourceRetriever.hpp:76
InertiaFromGeom
Definition: Types.hpp:79
Coordinate
This attribute specifies whether the frame positions and orientations in the MJCF model are expressed...
Definition: Types.hpp:62
std::vector< Error > Errors
Definition: Error.hpp:85
Angle
This attribute specifies whether the angles in the MJCF model are expressed in units of degrees or ra...
Definition: Types.hpp:48
@ DEGREE
[Default] Always use for MJCF
Definition: BulletCollisionDetector.cpp:65
The Uri struct provides URI parsing and merging functionality based on RFC 3986.
Definition: Uri.hpp:87