Loading...
Searching...
No Matches
JointAxis.hh
Go to the documentation of this file.
1/*
2 * Copyright 2018 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17#ifndef SDF_JOINTAXIS_HH_
18#define SDF_JOINTAXIS_HH_
19
20#include <string>
21#include <optional>
22#include <gz/math/Vector3.hh>
23#include <gz/utils/ImplPtr.hh>
24#include "sdf/Element.hh"
25#include "sdf/Exception.hh"
26#include "sdf/Types.hh"
27#include "sdf/config.hh"
28#include "sdf/system_util.hh"
29
30namespace sdf
31{
32 // Inline bracket to help doxygen filtering.
33 inline namespace SDF_VERSION_NAMESPACE {
34 //
35
36 // Forward declare private data class.
37 struct PoseRelativeToGraph;
38 template <typename T> class ScopedGraph;
39
49 {
61 const std::string &_joint = "",
62 const std::string &_axis = "axis",
63 double _multiplier = 0.0,
64 double _offset = 0.0,
65 double _reference = 0.0);
66
69 public: void SetJoint(const std::string &_joint);
70
73 public: void SetAxis(const std::string &_axis);
74
79 public: void SetMultiplier(double _multiplier);
80
83 public: void SetOffset(double _offset);
84
88 public: void SetReference(double _reference);
89
92 public: const std::string &Joint() const;
93
96 public: const std::string &Axis() const;
97
102 public: double Multiplier() const;
103
107 public: double Offset() const;
108
112 public: double Reference() const;
113
115 GZ_UTILS_IMPL_PTR(dataPtr)
116 };
117
121 {
123 public: JointAxis();
124
131 public: Errors Load(ElementPtr _sdf);
132
141 public: gz::math::Vector3d Xyz() const;
142
147 public: [[nodiscard]] sdf::Errors SetXyz(
148 const gz::math::Vector3d &_xyz);
149
155 public: void SetMimic(const MimicConstraint &_mimic);
156
162 public: std::optional<MimicConstraint> Mimic() const;
163
169 public: double Damping() const;
170
176 public: void SetDamping(const double _damping);
177
182 public: double Friction() const;
183
187 public: void SetFriction(const double _friction);
188
193 public: double SpringReference() const;
194
198 public: void SetSpringReference(const double _spring);
199
204 public: double SpringStiffness() const;
205
209 public: void SetSpringStiffness(const double _spring);
210
216 public: double Lower() const;
217
223 public: void SetLower(const double _lower);
224
230 public: double Upper() const;
231
237 public: void SetUpper(const double _upper);
238
245 public: double Effort() const;
246
252 public: void SetEffort(double _effort);
253
258 public: double MaxVelocity() const;
259
264 public: void SetMaxVelocity(const double _velocity);
265
269 public: double Stiffness() const;
270
275 public: void SetStiffness(const double _stiffness);
276
280 public: double Dissipation() const;
281
285 public: void SetDissipation(const double _dissipation);
286
291 public: const std::string& XyzExpressedIn() const;
292
297 public: void SetXyzExpressedIn(const std::string &_frame);
298
307 gz::math::Vector3d &_xyz,
308 const std::string &_resolveTo = "") const;
309
314 public: sdf::ElementPtr Element() const;
315
322 public: sdf::ElementPtr ToElement(unsigned int _index = 0u) const;
323
332 unsigned int _index = 0u) const;
333
338 private: void SetXmlParentName(const std::string &_xmlParentName);
339
344 private: void SetPoseRelativeToGraph(
346
348 friend class Joint;
349
351 GZ_UTILS_IMPL_PTR(dataPtr)
352 };
353 }
354}
355#endif
Parameters related to the axis of rotation for rotational joints, and the axis of translation for pri...
Definition JointAxis.hh:121
sdf::ElementPtr Element() const
Get a pointer to the SDF element that was used during load.
void SetSpringReference(const double _spring)
Set the spring reference position for this joint axis.
Errors ResolveXyz(gz::math::Vector3d &_xyz, const std::string &_resolveTo="") const
Express xyz unit vector of this axis in the coordinates of another named frame.
std::optional< MimicConstraint > Mimic() const
Get the Mimic constraint parameters.
double Damping() const
Get the physical velocity dependent viscous damping coefficient of the joint axis.
sdf::ElementPtr ToElement(sdf::Errors &_errors, unsigned int _index=0u) const
Create and return an SDF element filled with data from this joint axis.
void SetFriction(const double _friction)
Set the physical static friction value of the joint.
void SetXyzExpressedIn(const std::string &_frame)
Set the name of the coordinate frame in which this joint axis's unit vector is expressed.
void SetMimic(const MimicConstraint &_mimic)
Set the Mimic constraint parameters.
Errors Load(ElementPtr _sdf)
Load the joint axis based on a element pointer.
void SetStiffness(const double _stiffness)
Get the joint stop stiffness.
double Lower() const
Get the lower joint axis limit (radians for revolute joints, meters for prismatic joints).
void SetUpper(const double _upper)
Set the upper joint axis limit (radians for revolute joints, meters for prismatic joints).
void SetEffort(double _effort)
Set the value for enforcing the maximum absolute joint effort that can be applied.
sdf::Errors SetXyz(const gz::math::Vector3d &_xyz)
Set the x,y,z components of the axis unit vector.
void SetDissipation(const double _dissipation)
Set the joint stop dissipation.
sdf::ElementPtr ToElement(unsigned int _index=0u) const
Create and return an SDF element filled with data from this joint axis.
void SetDamping(const double _damping)
Set the physical velocity dependent viscous damping coefficient of the joint axis.
double Effort() const
Get the value for enforcing the maximum absolute joint effort that can be applied.
double Dissipation() const
Get the joint stop dissipation.
double SpringReference() const
Get the spring reference position for this joint axis.
void SetLower(const double _lower)
Set the lower joint axis limit (radians for revolute joints, meters for prismatic joints).
void SetMaxVelocity(const double _velocity)
Set the value for enforcing the maximum absolute joint velocity.
gz::math::Vector3d Xyz() const
Get the x,y,z components of the axis unit vector.
double MaxVelocity() const
Get the value for enforcing the maximum absolute joint velocity.
void SetSpringStiffness(const double _spring)
Set the spring stiffness for this joint axis.
double Stiffness() const
Get the joint stop stiffness.
double Friction() const
Get the physical static friction value of the joint.
double SpringStiffness() const
Get the spring stiffness for this joint axis.
double Upper() const
Get the upper joint axis limit (radians for revolute joints, meters for prismatic joints).
const std::string & XyzExpressedIn() const
Get the name of the coordinate frame in which this joint axis's unit vector is expressed.
Definition Joint.hh:85
Helper class to hold contents of a joint axis mimic tag, which define a Mimic constraint.
Definition JointAxis.hh:49
double Offset() const
Retrieve the offset to the follower position in the linear constraint.
void SetMultiplier(double _multiplier)
Set the multiplier parameter, which represents the ratio between changes in the follower position rel...
const std::string & Axis() const
Retrieve the name of the leader axis, either "axis" or "axis2".
void SetReference(double _reference)
Set the reference for the leader position before applying the multiplier in the linear constraint.
double Reference() const
Retrieve the reference for the leader position before applying the multiplier in the linear constrain...
void SetOffset(double _offset)
Set the offset to the follower position in the linear constraint.
void SetJoint(const std::string &_joint)
Set the leader joint name.
double Multiplier() const
Retrieve the multiplier parameter, which represents the ratio between changes in the follower positio...
const std::string & Joint() const
Retrieve the name of the leader joint.
void SetAxis(const std::string &_axis)
Set the leader axis name, either "axis" or "axis2".
MimicConstraint(const std::string &_joint="", const std::string &_axis="axis", double _multiplier=0.0, double _offset=0.0, double _reference=0.0)
Constructor with arguments.
Definition Collision.hh:44
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:80
std::shared_ptr< Element > ElementPtr
Definition Element.hh:55
namespace for Simulation Description Format parser
Definition Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:25