Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
TrackJointLimits.h
1// trax track library
2// AD 2014
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "trax/Units.h"
30#include "spat/Frame.h"
31
32namespace trax{
33
38 struct TrackJointLimits{
51
52 TrackJointLimits() noexcept
63 ErrorReduction { 0.25_1 },
64 bTiltingEnabled {false}
65 {};
66
67 TrackJointLimits(
68 Force normalForceLimitMin,
69 Force normalForceLimitMax,
70 Force binormalForceLimitMin,
71 Force binormalForceLimitMax,
72 Torque normalTorqueLimit,
73 Torque torqueLimit,
74 Length thresholdPosition,
75 Angle thresholdTangent,
76 Angle thresholdNormal,
77 Angle thresholdBinormal,
78 One errorReduction,
79 bool bTiltingEnabled ) noexcept
80 : NormalForceLimitMin {normalForceLimitMin},
81 NormalForceLimitMax {normalForceLimitMax},
82 BinormalForceLimitMin {binormalForceLimitMin},
83 BinormalForceLimitMax {binormalForceLimitMax},
84 NormalTorqueLimit {normalTorqueLimit},
85 TorqueLimit {torqueLimit},
86 ThresholdPosition {thresholdPosition},
87 ThresholdTangent {thresholdTangent},
88 ThresholdNormal {thresholdNormal},
89 ThresholdBinormal {thresholdBinormal},
90 ErrorReduction { errorReduction },
92 {};
93
94 inline bool IsInsideLimits( const spat::Frame<Length,One>& frame, const spat::Frame<Length,One>& anchor ) const noexcept{
95 const One eT = std::abs(std::asin((anchor.T % frame.T).Length()));
96 const One eN = std::abs(std::asin((anchor.N % frame.N).Length()));
97 const One eB = std::abs(std::asin((anchor.B % frame.B).Length()));
98
99 return anchor.P.Equals( frame.P, ThresholdPosition ) &&
100 eN <= ThresholdTangent && eB <= ThresholdTangent &&
101 eT <= ThresholdNormal && eB <= ThresholdNormal &&
103 }
104 };
105
106}
constexpr Real infinite
Positive infinity value.
Definition DimensionedValues.h:349
constexpr Real _rad(Angle a) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1202
constexpr Real _1(One one) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1186
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
constexpr Angle pi
Circle number pi.
Definition DimensionedValues.h:1145
Value< Dimension< 1, 1, -2 > > Force
Force.
Definition DimensionedValues.h:333
Value< Dimension< 2, 1, -2 > > Torque
Torque.
Definition DimensionedValues.h:337
Value< Dimension< 0, 0, 0 > > Angle
Angle in radians.
Definition DimensionedValues.h:320
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
constexpr Length default_derailing_distance
A default value for the acceptable distance between a track position and something beeing still consi...
Definition Units.h:128
bool bTiltingEnabled
Tilting on track enabled.
Definition TrackJointLimits.h:50
Force BinormalForceLimitMin
The maximum force (typically < 0) to prevent movement of the Wheelframe in binormal direction.
Definition TrackJointLimits.h:41
Length ThresholdPosition
The maximum deviation of the WheelFrame's position from its supposed position on the track.
Definition TrackJointLimits.h:45
Torque NormalTorqueLimit
The maximum torque to prevent rotation around the normal direction N.
Definition TrackJointLimits.h:43
Force BinormalForceLimitMax
The maximum force to prevent movement of the Wheelframe in negative binormal direction.
Definition TrackJointLimits.h:42
Angle ThresholdNormal
The maximum angle deviation of the WheelFrame's normal vector from its supposed direction on the trac...
Definition TrackJointLimits.h:47
Force NormalForceLimitMin
The maximum force (typically < 0) to prevent movement of the Wheelframe in normal direction.
Definition TrackJointLimits.h:39
Angle ThresholdTangent
The maximum angle deviation of the WheelFrame's tangent vector from its supposed direction on the tra...
Definition TrackJointLimits.h:46
One ErrorReduction
The error reduction parameter for the track joint.
Definition TrackJointLimits.h:49
Angle ThresholdBinormal
The maximum angle deviation of the WheelFrame's binormal vector from its supposed direction on the tr...
Definition TrackJointLimits.h:48
Force NormalForceLimitMax
The maximum force to prevent movement of the Wheelframe in negative normal direction.
Definition TrackJointLimits.h:40
Torque TorqueLimit
The maximum torque to prevent violating rotations around T and B.
Definition TrackJointLimits.h:44