wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Toggle main menu visibility
Loading...
Searching...
No Matches
kinematics.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
wuzp/core/Absolute.hpp
"
4
#include "
wuzp/core/Indices.hpp
"
5
#include "
wuzp/core/Quantities.hpp
"
6
#include "
wuzp/core/Tensor.hpp
"
7
#include "
wuzp/core/TypeMatrix.hpp
"
8
#include "
wuzp/core/concepts.hpp
"
9
#include "
wuzp/core/helpers.hpp
"
10
#include "
wuzp/core/traits.hpp
"
11
12
// The transport formulas of rigid body kinematics: the velocity and the acceleration of a point fixed to a rigid body from those
13
// of another point of the body, like the shifts of Drake's spatial velocities and accelerations
14
// (https://drake.mit.edu/doxygen_cxx/group__multibody__spatial__vectors.html). The spatial vectors, which also track the frame the
15
// motion is measured in and the point it is about, shift with them (see SpatialVelocity::shift() and SpatialAcceleration::shift()).
16
17
namespace
wuzp
{
18
namespace
internal {
19
24
template
<
typename
TensorT_,
typename
UnitT_>
25
using
KinematicVector3 =
26
Tensor<Indices<Up>,
27
Quantities<typename Rebind<typename TensorT_::ValuesT, typename TensorT_::ValueT, 3, 1>::type,
TypeMatrix<3, 1, UnitT_>
>,
28
typename
TensorT_::CoordinateSystemT,
Relative
>;
29
31
template
<
typename
TensorT_>
32
using
KinematicUnits = AccessUnits<AccessImplementation<typename TensorT_::ValueT>>;
33
34
}
// namespace internal
35
46
template
<AnyTensor VelocityT_, AnyTensor AngularVelocityT_, AnyTensor OffsetT_>
47
auto
velocityOfBodyFixedPoint
(
const
VelocityT_& velocity,
const
AngularVelocityT_& angularVelocity,
const
OffsetT_& offset) {
48
using
UnitsT = internal::KinematicUnits<VelocityT_>;
49
const
internal::KinematicVector3<VelocityT_, typename UnitsT::AngularVelocity> w{angularVelocity};
50
return
velocity + w.
crossProduct
(internal::KinematicVector3<VelocityT_, typename UnitsT::Length>{offset});
51
}
52
62
template
<AnyTensor AccelerationT_, AnyTensor AngularAccelerationT_, AnyTensor AngularVelocityT_, AnyTensor OffsetT_>
63
auto
accelerationOfBodyFixedPoint
(
const
AccelerationT_& acceleration,
const
AngularAccelerationT_& angularAcceleration,
64
const
AngularVelocityT_& angularVelocity,
const
OffsetT_& offset) {
65
using
UnitsT = internal::KinematicUnits<AccelerationT_>;
66
const
internal::KinematicVector3<AccelerationT_, typename UnitsT::AngularAcceleration> alpha{angularAcceleration};
67
const
internal::KinematicVector3<AccelerationT_, typename UnitsT::AngularVelocity> w{angularVelocity};
68
const
internal::KinematicVector3<AccelerationT_, typename UnitsT::Length> p{offset};
69
return
acceleration + alpha.
crossProduct
(p) + w.
crossProduct
(w.
crossProduct
(p));
70
}
71
72
}
// namespace wuzp
Absolute.hpp
Indices.hpp
Quantities.hpp
Tensor.hpp
TypeMatrix.hpp
wuzp::Tensor::crossProduct
auto crossProduct(const Tensor< IndicesOtherT_, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_ > &other) const
The cross product a x b of two three-dimensional vectors in the same Euclidean coordinate system (see...
Definition
Tensor.hpp:297
concepts.hpp
traits.hpp
helpers.hpp
wuzp
Definition
Absolute.hpp:15
wuzp::accelerationOfBodyFixedPoint
auto accelerationOfBodyFixedPoint(const AccelerationT_ &acceleration, const AngularAccelerationT_ &angularAcceleration, const AngularVelocityT_ &angularVelocity, const OffsetT_ &offset)
The acceleration a_Q = a_P + alpha x p_PQ + w x (w x p_PQ) of a point Q fixed to a rigid body,...
Definition
kinematics.hpp:63
wuzp::Relative
internal::AbsoluteImpl< false > Relative
Definition
Absolute.hpp:18
wuzp::velocityOfBodyFixedPoint
auto velocityOfBodyFixedPoint(const VelocityT_ &velocity, const AngularVelocityT_ &angularVelocity, const OffsetT_ &offset)
The velocity v_Q = v_P + w x p_PQ of a point Q fixed to a rigid body, from the velocity v_P of a poin...
Definition
kinematics.hpp:47
wuzp::TypeMatrix
typename CreateTypeMatrix< RowsV_, ColsV_, Types... >::type TypeMatrix
A matrix storing types at compile-time.
Definition
TypeMatrix.hpp:378
wuzp
include
wuzp
trafo
kinematics.hpp
Generated by
1.18.0