wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Loading...
Searching...
No Matches
SpatialVelocity.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4#include <utility>
5
12
13namespace wuzp {
14
33template <template <typename, int, int> typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem MeasuredInT_,
37 : public SpatialVector<SpatialVelocity<ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointT_, ExpressedInT_>,
38 AngularVelocityVector3<ValuesT_, ValueT_, ExpressedInT_>, VelocityVector3<ValuesT_, ValueT_, ExpressedInT_>> {
41
42 public:
44 using MeasuredInT = MeasuredInT_;
46 using FrameT = FrameT_;
48 using PointT = PointT_;
50 using ExpressedInT = ExpressedInT_;
53
54 SpatialVelocity() = default;
55
58 template <typename AngularVelocityOtherT_, typename VelocityOtherT_>
60 SpatialVelocity(AngularVelocityOtherT_&& angularVelocity, VelocityOtherT_&& velocity)
61 : BaseT(std::forward<AngularVelocityOtherT_>(angularVelocity), std::forward<VelocityOtherT_>(velocity)) {}
62
69 template <EuclideanCoordinateSystem PointOtherT_, AnyTensor OffsetOtherT_>
73
82 template <AnyTensor OffsetOtherT_, typename MeasuredInOtherT_, typename FrameOtherT_, typename PointOtherT_, typename ExpressedInOtherT_>
84 const OffsetOtherT_& offset,
86 static_assert(std::is_same_v<MeasuredInOtherT_, FrameT_>, "Adjacent frames do not match.");
87 static_assert(std::is_same_v<ExpressedInOtherT_, ExpressedInT_>, "Coordinate systems do not match.");
88 const auto shifted = shift<PointOtherT_>(offset);
89 return {shifted.getRotational() + velocity.getRotational(), shifted.getTranslational() + velocity.getTranslational()};
90 }
91};
92
103template <typename FromT_, typename ToT_, typename RotationT_, typename TranslationT_, template <typename, int, int> typename ValuesT_,
104 typename ValueT_, typename MeasuredInT_, typename FrameT_, typename PointT_, typename ExpressedInT_>
107 return internal::adjointMap(transformation, velocity);
108}
109
110namespace internal {
111
112template <template <typename, int, int> typename ValuesT_, typename ValueT_, typename MeasuredInT_, typename FrameT_, typename PointT_,
113 typename ExpressedInT_, typename NewExpressedInT_>
114struct WithExpressedIn<SpatialVelocity<ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointT_, ExpressedInT_>, NewExpressedInT_> {
115 using type = SpatialVelocity<ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointT_, NewExpressedInT_>;
116};
117
118} // namespace internal
119
120template <template <typename, int, int> typename ValuesT_, typename ValueT_, typename MeasuredInT_, typename FrameT_, typename PointT_,
121 typename ExpressedInT_>
122struct GetCoordinateSystem<SpatialVelocity<ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointT_, ExpressedInT_>> {
123 using type = ExpressedInT_;
124};
125
126} // namespace wuzp
A passive proper rigid transformation from From to To, which first rotates, then translates: p -> R p...
The spatial velocity (twist) V_MBp_E of the frame B, measured in the frame M, about the point Bp,...
SpatialVelocity< ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointOtherT_, ExpressedInT_ > shift(const OffsetOtherT_ &offset) const
The spatial velocity V_MBq about another point Bq fixed to B, PointOtherT_, given the position vector...
FrameT_ FrameT
The frame B whose motion it is.
ExpressedInT_ ExpressedInT
The coordinate system E both parts are expressed in.
PositionVector3< ValuesT_, ValueT_, ExpressedInT_ > OffsetT
The position vector from one point to another, expressed in E, by which shift() shifts.
SpatialVelocity(AngularVelocityOtherT_ &&angularVelocity, VelocityOtherT_ &&velocity)
The spatial velocity with the angular velocity w_MB and the velocity v_MBp, which are converted into ...
PointT_ PointT
The point Bp the spatial velocity is about, which is fixed to B.
SpatialVelocity< ValuesT_, ValueT_, MeasuredInT_, FrameOtherT_, PointOtherT_, ExpressedInT_ > composeWithMovingFrameVelocity(const OffsetOtherT_ &offset, const SpatialVelocity< ValuesT_, ValueT_, MeasuredInOtherT_, FrameOtherT_, PointOtherT_, ExpressedInOtherT_ > &velocity) const
The spatial velocity V_MCq of the frame C, which moves relative to B, measured in M,...
MeasuredInT_ MeasuredInT
The frame M the motion is measured in.
Any tensor: a specialization of Tensor, including points, vectors and their aliases.
Definition concepts.hpp:118
The alias template ValueMatrix<ValueT_, RowsV_, ColsV_> of any value matrix backend,...
Definition concepts.hpp:89
A coordinate system with the Euclidean metric, the default, e.g. CoordinateSystem<World>: the coordin...
Definition concepts.hpp:35
VelocityVector< 3, ValuesT_, ValueT_, CoordinateSystemT_ > VelocityVector3
Definition Tensor.hpp:1005
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...
PositionVector< 3, ValuesT_, ValueT_, CoordinateSystemT_ > PositionVector3
Definition Tensor.hpp:997
auto adjoint(const PassiveProperRigidTransformationTemplate< FromT_, ToT_, RotationT_, TranslationT_ > &, const SpatialAcceleration< ValuesT_, ValueT_, MeasuredInT_, FrameT_, PointT_, ExpressedInT_ > &)
Rejected with a message: the adjoint map of a rigid transformation maps spatial velocities and spatia...