AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
KinematicChain.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/Referenced.h>
20#include <agx/Vector.h>
22#include <agx/Constraint.h>
23#include <agx/RigidBody.h>
24#include <agx/AffineMatrix4x4.h>
25
26#include <agxModel/export.h>
27
28
29namespace agxSDK {
30 class Simulation;
31}
32
33namespace agxModel
34{
35
58
59
60
99 {
100 public:
101
118 const agx::RigidBody& base,
119 const agx::RigidBody& end,
120 const agx::AffineMatrix4x4* endLocalTransform = nullptr);
121
122
142 const agx::ConstraintPtrVector& constraints,
143 const agx::AffineMatrix4x4* endLocalTransform = nullptr);
144
145
146
153
154
165 bool isValid() const;
166
167
176
177
187
188
193
194
199
200
217 agx::AffineMatrix4x4& outputTransform,
218 bool clampToJointLimits = false);
219
220
237 agx::AffineMatrix4x4Vector& outputTransforms,
238 bool clampToJointLimits = false);
239
240
260 const agx::RealVector& jointVelocities,
261 agx::AffineMatrix4x4Vector& outputTransforms,
262 agx::Vec3Vector& outputLinearVelocities,
263 agx::Vec3Vector& outputAngularVelocities,
264 bool clampToJointLimits = false);
265
266
279 const agx::RealVector& currentJointPositions,
280 agx::RealVector& outputJointPositions,
281 agx::Real solverEpsilon=1e-5);
282
283
293 agx::RealVector& tau);
294
295
304 const agx::RealVector& externalForces,
305 agx::RealVector& tau);
306
307
317 agx::RealVector& jacobian);
318 protected:
319 class SerialKinematicChainData;
320
323
324 private:
326
328 };
329
332
333}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXMODEL_EXPORT
A KinematicChain represents a chain consisting of multiple agx::RigidBody and agx::Constraint objects...
@ SUCCESS
Return value indicating success.
@ SOLVER_FAILURE
Failure due to solver not finding a solution. E.g. pose not reachable.
@ INVALID_CHAIN
Failure due to chain not being valid.
@ NO_SIMULATION
Failure due to operation requiring access to the Simulation holding bodies/constraints.
@ BAD_INPUT_ARGUMENTS
Failure due to input arguments being incorrect. E.g. wrong number of vector elements.
A Serial Kinematic Chain is a KinematicChain where there are no loops or branches.
const agx::ConstraintRefVector & getJoints() const
Get the joints that are in the chain.
KinematicChainStatus computeInverseKinematics(const agx::AffineMatrix4x4 &transform, const agx::RealVector &currentJointPositions, agx::RealVector &outputJointPositions, agx::Real solverEpsilon=1e-5)
Compute joint positions needed for the end body in the chain to get the specified transform relative ...
agx::UInt getNumJoints() const
Returns number of joints in the chain where motion can occur.
KinematicChainStatus computeForwardKinematicsAll(const agx::RealVector &jointPositions, agx::AffineMatrix4x4Vector &outputTransforms, bool clampToJointLimits=false)
Compute the transform for all links in the chain relative the base given provided joint values.
SerialKinematicChain(agxSDK::Simulation &simulation, const agx::RigidBody &base, const agx::RigidBody &end, const agx::AffineMatrix4x4 *endLocalTransform=nullptr)
Create a serial chain from "base" to "end" by traversing the bodies and constraints in the simulation...
const agx::RigidBodyRefVector & getLinks() const
Get the links that are in the chain.
void setSimulation(agxSDK::Simulation *sim)
Set the Simulation that is used to read certain values needed for inverse dynamics computations.
KinematicChainStatus computeManipulatorJacobian(const agx::RealVector &jointPositions, agx::RealVector &jacobian)
Compute the manipulator jacobian relative the base.
bool isValid() const
Check if the chain was valid at time of creation.
KinematicChainStatus computeForwardKinematicsAll(const agx::RealVector &jointPositions, const agx::RealVector &jointVelocities, agx::AffineMatrix4x4Vector &outputTransforms, agx::Vec3Vector &outputLinearVelocities, agx::Vec3Vector &outputAngularVelocities, bool clampToJointLimits=false)
Compute the transforms and velocities for all links in the chain relative the base given provided joi...
KinematicChainStatus computeInverseDynamics(const agx::RealVector &jointAcceleration, agx::RealVector &tau)
Compute the torque/forces needed to get the specified jointAccelerations.
SerialKinematicChain(const agx::RigidBodyPtrVector &bodies, const agx::ConstraintPtrVector &constraints, const agx::AffineMatrix4x4 *endLocalTransform=nullptr)
Create a serial chain from the input bodies and constraints which are provided in the correct order.
agx::UInt getNumLinks() const
Returns number of links in the chain.
KinematicChainStatus computeInverseDynamics(const agx::RealVector &jointAcceleration, const agx::RealVector &externalForces, agx::RealVector &tau)
Compute the torque/forces needed to get the specified jointAccelerations.
KinematicChainStatus computeForwardKinematics(const agx::RealVector &jointPositions, agx::AffineMatrix4x4 &outputTransform, bool clampToJointLimits=false)
Compute the transform for the end of the chain relative the base given the provided joint values.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Base class providing referencing counted objects.
Definition Referenced.h:120
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42