DART  6.10.1
Option.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_OPTION_HPP_
34 #define DART_UTILS_MJCF_DETAIL_OPTION_HPP_
35 
36 #include <Eigen/Core>
37 #include <tinyxml2.h>
38 
41 
42 namespace dart {
43 namespace utils {
44 namespace MjcfParser {
45 namespace detail {
46 
47 class Option final
48 {
49 public:
50  Option() = default;
51 
52  double getTimestep() const;
53  double getApiRate() const;
54  double getImpRatio() const;
55  const Eigen::Vector3d& getGravity() const;
56  const Eigen::Vector3d& getWind() const;
57  const Eigen::Vector3d& getMagnetic() const;
58  double getDensity() const;
59  double getViscosity() const;
60  Integrator getIntegrator() const;
62  ConeType getCone() const;
63  JacobianType getJacobian() const;
64  SolverType getSolver() const;
65  int getIterations() const;
66  double getTolerance() const;
67  int getNoSlipIterations() const;
68  double getNoSlipTolerance() const;
69  int getMprIterations() const;
70  double getMprTolerance() const;
71 
72 private:
73  // Private memebers used by MujocoModel class
74  friend class MujocoModel;
75  Errors read(tinyxml2::XMLElement* element);
76 
77 private:
78  double mTimestep{0.002};
79  double mApiRate{100};
80  double mImpRatio{1};
81  Eigen::Vector3d mGravity{Eigen::Vector3d(0, 0, -9.81)};
82  Eigen::Vector3d mWind{Eigen::Vector3d::Zero()};
83  Eigen::Vector3d mMagnetic{Eigen::Vector3d(0, -0.5, 0)};
84  double mDensity{0};
85  double mViscosity{0};
91  int mIterations{100};
92  double mTolerance{1e-8};
94  double mNoSlipTolerance{1e-6};
95  int mMprIterations{50};
96  double mMprTolerance{1e-6};
97 };
98 
99 } // namespace detail
100 } // namespace MjcfParser
101 } // namespace utils
102 } // namespace dart
103 
104 #endif // #ifndef DART_UTILS_MJCF_DETAIL_OPTION_HPP_
Main class to parse MJCF model file.
Definition: MujocoModel.hpp:56
double getViscosity() const
Definition: Option.cpp:303
Errors read(tinyxml2::XMLElement *element)
Definition: Option.cpp:43
int getIterations() const
Definition: Option.cpp:339
int mNoSlipIterations
Definition: Option.hpp:93
const Eigen::Vector3d & getMagnetic() const
Definition: Option.cpp:291
double getTimestep() const
Definition: Option.cpp:261
double mTolerance
Definition: Option.hpp:92
Eigen::Vector3d mWind
Definition: Option.hpp:82
CollisionType mCollision
Definition: Option.hpp:87
Eigen::Vector3d mMagnetic
Definition: Option.hpp:83
double mTimestep
Definition: Option.hpp:78
JacobianType mJacobian
Definition: Option.hpp:89
double mApiRate
Definition: Option.hpp:79
int getMprIterations() const
Definition: Option.cpp:363
double mViscosity
Definition: Option.hpp:85
Integrator mIntegrator
Definition: Option.hpp:86
double mImpRatio
Definition: Option.hpp:80
const Eigen::Vector3d & getGravity() const
Definition: Option.cpp:279
double getTolerance() const
Definition: Option.cpp:345
ConeType mCone
Definition: Option.hpp:88
JacobianType getJacobian() const
Definition: Option.cpp:327
Integrator getIntegrator() const
Definition: Option.cpp:309
int mIterations
Definition: Option.hpp:91
double mNoSlipTolerance
Definition: Option.hpp:94
double getImpRatio() const
Definition: Option.cpp:273
ConeType getCone() const
Definition: Option.cpp:321
SolverType getSolver() const
Definition: Option.cpp:333
double mDensity
Definition: Option.hpp:84
double getDensity() const
Definition: Option.cpp:297
CollisionType getCollision() const
Definition: Option.cpp:315
double getApiRate() const
Definition: Option.cpp:267
int mMprIterations
Definition: Option.hpp:95
SolverType mSolver
Definition: Option.hpp:90
const Eigen::Vector3d & getWind() const
Definition: Option.cpp:285
double getMprTolerance() const
Definition: Option.cpp:369
double mMprTolerance
Definition: Option.hpp:96
Eigen::Vector3d mGravity
Definition: Option.hpp:81
int getNoSlipIterations() const
Definition: Option.cpp:351
double getNoSlipTolerance() const
Definition: Option.cpp:357
JacobianType
Definition: Types.hpp:105
SolverType
Definition: Types.hpp:112
Integrator
This attribute selects the numerical integrator to be used.
Definition: Types.hpp:72
ConeType
Definition: Types.hpp:99
CollisionType
Definition: Types.hpp:92
std::vector< Error > Errors
Definition: Error.hpp:85
Definition: BulletCollisionDetector.cpp:65