![]() |
Trax3 3.1.0
trax track library
|
Interface for train and rolling stock that can be railed on a track and might provide brakes and power engines. More...
#include <C:/Trend/Development/Trax3/Code/trax/rigid/trains/RailRunner.h>

Public Types | |
| enum class | EndType : char { none = 0 , north , south , any , all } |
| Types of the RailRunner's end's. More... | |
Public Member Functions | |
| virtual const char * | TypeName () const noexcept=0 |
| virtual std::shared_ptr< RailRunner > | This () const noexcept=0 |
| Gets a shared pointer to this. | |
| virtual bool | IsValid () const noexcept=0 |
| virtual void | Rail (const Location &location, bool bMoveTo=true)=0 |
| Attaches this RailRunner onto the specified track location. | |
| virtual Location | GetLocation () const noexcept=0 |
| Gets the track location were the RailRunner is railed. | |
| virtual void | DeRail () noexcept=0 |
| Take the RailRunner from the track. | |
| virtual bool | IsRailed () const noexcept=0 |
| Is the RailRunner on a track? | |
| virtual spat::Frame< Length, One > | GetGlobalAnchor () const =0 |
| Gets the global anchor of the RailRunner. | |
| virtual void | ResetToGlobalAnchor (const spat::Frame< Length, One > &anchorPose)=0 |
| Sets the position of the RailRunner so that its global anchor alignes to the given global pose. | |
| virtual void | SetVelocity (Velocity velocity)=0 |
| Sets the velocity of this RailRunner along the track. | |
| virtual Velocity | GetVelocity () const =0 |
| virtual void | TargetVelocity (Velocity velocity)=0 |
| Sets the target velocity to aim for by using the supplied Thrust() and Brake() settings. | |
| virtual Velocity | TargetVelocity () const noexcept=0 |
| virtual EndType | TargetDirection () const noexcept=0 |
| Gets the principle direction of movement according to the sign of the target velocity. | |
| virtual Power | MaximumPowerOutput () const noexcept=0 |
| virtual Power | CurrentPowerOutput () const noexcept=0 |
| virtual Velocity | MaximumVelocity () const noexcept=0 |
| virtual void | Thrust (One byfactor)=0 |
| Sets the fraction of the maximum thrust to apply in order to reach the target velocity specified by TargetVelocity(). | |
| virtual One | Thrust () const noexcept=0 |
| Gets the fraction of the maximum thrust applied. | |
| virtual void | ThrustAbsolute (Force thrust)=0 |
| Sets the thrust as absolute force values. If the value exceeds MaxThrust() it get clipped. | |
| virtual Force | ThrustAbsolute () const noexcept=0 |
| virtual void | Brake (One byfactor)=0 |
| Sets the fraction of the maximum braking to apply in order to reach a zero velocity. | |
| virtual One | Brake () const noexcept=0 |
| Gets the fraction of the maximum braking applied. | |
| virtual void | BrakeAbsolute (Force brake)=0 |
| Sets the brake as absolute force value. If the value exceeds MaxBrake() it gets clipped. | |
| virtual Force | BrakeAbsolute () const noexcept=0 |
| virtual Force | MaxBrake () const noexcept=0 |
| Gets the maximal available braking. This value is determined by the properties of the Wheelsets attached to WheelFrames wich in turn are attached to a bogie. | |
| virtual void | ActivateCoupling (EndType end)=0 |
| Activates the coupling at the respective end of the RailRunner. | |
| virtual void | DeactivateCoupling (EndType end)=0 |
| Deactivates the coupling at the respective end of the RailRunner. | |
| virtual bool | IsActivated (EndType end) const noexcept=0 |
| virtual bool | Uncouple (EndType end=EndType::all, bool btriggerPulses=true) noexcept=0 |
| Uncouples the RailRunner at the specified end. | |
| virtual bool | IsCoupled (EndType end=EndType::any) const noexcept=0 |
| Is the coupling coupled? | |
| virtual Length | GetCouplingHeight (EndType end) const noexcept=0 |
| Gets the height of the coupling over the track. | |
| virtual Jack & | JackOnCouple (EndType end)=0 |
| Gets a Jack that pulses its Plug if one (or any) of the RailRunner's outmost couplings get coupled. | |
| virtual Jack & | JackOnUnCouple (EndType end)=0 |
| Gets a Jack that pulses its Plug if one (or any) of the RailRunner's outmost couplings get uncoupled or breaks. | |
| virtual Jack & | JackOnCouplingActivated (EndType end)=0 |
| Gets a Jack that pulses its Plug if one (or any) of the RailRunner's outmost couplings get activated. | |
| virtual Jack & | JackOnCouplingDeactivated (EndType end)=0 |
| Gets a Jack that pulses its Plug if one (or any) of the RailRunner's outmost couplings get deactivated. | |
| virtual void | UserData (RailRunnerUserData *pData) noexcept=0 |
| Sets a pointer to user provided data. | |
| virtual RailRunnerUserData * | UserData () const noexcept=0 |
Maximum Thrust | |
Gets the maximal available thrust. This value is determined by the properties of the Wheelsets attached to WheelFrames, which in turn are attached to a bogie. It is also determined by the engine characteristic and the actual velocity. | |
| virtual Force | MaxThrust () const noexcept=0 |
| virtual Force | MaxThrust (Velocity velocity) const noexcept=0 |
| Public Member Functions inherited from trax::Identified< RailRunner > | |
| virtual const std::string & | Reference (const std::string &name) const=0 |
| Gets a reference that was set for this object by name. | |
| virtual const std::vector< char const * > & | ReferenceNames (const std::string &namePart) const=0 |
| Searches for all reference names that countain namePart as substring in the name. | |
| virtual IDType | ID () const noexcept=0 |
| Identified (const Identified &)=delete | |
| Identified & | operator= (const Identified &)=delete |
Interface for train and rolling stock that can be railed on a track and might provide brakes and power engines.
This maps the way the physics engines used with trax work: a traget velocity is defined and the the maximum thrust and braking force that can get applied to reach it. The braking force will only have effect in opposite direction of the target velocity; the thrust force only in that direction:
<--- brake target ---> thrust --->
The braking force is not applied to fight off a velocity against the target velocity, only thrust will have an effect here. If target velocity is zero, only braking force gets applied:
<--- brake target o brake --->
|
strong |
Types of the RailRunner's end's.
| Enumerator | |
|---|---|
| north | Denotes the front end of a RailRunner. |
| south | Denotes the back end of a RailRunner. |
| any | Denotes the north or south end of a Railrunner. |
| all | Denotes both ends of a RailRunner. |
|
pure virtual |
Activates the coupling at the respective end of the RailRunner.
Non active couplings can not get coupled. Coupled couplings can neither be activated nor deactivated. A coupling is deactivated by default.
| end | Denotes the coupling. |
| std::runtime_error | if coupling is coupled already or has no valid couling index. |
|
pure virtualnoexcept |
Gets the fraction of the maximum braking applied.
|
pure virtual |
Sets the fraction of the maximum braking to apply in order
to reach a zero velocity.
| byfactor | Value between [0,1] specifying the fraction of the total available braking. |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtual |
Deactivates the coupling at the respective end of the RailRunner.
Non active couplings can not get coupled. Coupled couplings can neither be activated nor deactivated.
| end | Denotes the coupling. |
| std::runtime_error | if coupling is coupled. |
|
pure virtualnoexcept |
Take the RailRunner from the track.
The JackOnDerail of all RailRunners involved will pulse.
Gets the height of the coupling over the track.
| end | End of this TrainComponent to get the coupling height for. |
|
pure virtual |
Gets the global anchor of the RailRunner.
Albeit only the WheelFrames are attached to the track, every RailRunner tries to assign a privileged anchor to denote its 'official' position along the tracks. Only if properly railed, this will be the same frame as can be gotten from
| std::logic_error | if there is no privilged anchor. |
|
pure virtualnoexcept |
Gets the track location were the RailRunner is railed.
|
pure virtual |
|
pure virtualnoexcept |
| end | Denotes the coupling. |
|
pure virtualnoexcept |
Is the coupling coupled?
| end | End of this RailRunner. |
|
pure virtualnoexcept |
Is the RailRunner on a track?
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
| velocity | the velocity the maximum thrust is requested for. |
|
pure virtual |
Attaches this RailRunner onto the specified track location.
The trackjoints of the WheelFrames will be attached to the track at locations that might differ from location, depending in the RailRunners definition of its location on the tracks. If a WheelFrame gets railed, in this railing process, its JackOnRail will pulse. If some railing is present already it gets overriden.
| location | The location to rail this RailRunner. If railing is successful this location will be returned by GetLocation(). |
| bMoveTo | If true the RailRunner will be moved to the transitional 3D pose of location, prior to railing. If this is a Train, the actual coupling distances will be respected. See |
| std::out_of_range | if a dead end is encountered on the track system. |
| std::logic_error | If there are no suitable WheelFrame children in the RailRunner to rail. |
| std::invalid_argument | If location is not on a track. |
| std::out_of_range | If the railrunner would end up off the track system. |
| std::logic_error | If the present configuration does not allow railing. |
Implemented in trax::TrainComponent.
|
pure virtual |
Sets the position of the RailRunner so that its global anchor alignes to the given global pose.
The whole RailRunner will be moved so the assigned anchor alignes with the given global pose. This can be used to relocate the RailRunner when not railed.
| anchorPose | The pose to align the global anchor with. |
| std::logic_error | if there is no privilged anchor. |
Implemented in trax::TrainComponent.
|
pure virtual |
Sets the velocity of this RailRunner along the track.
This will be a momentary velocity that will change over time due to simulation events. This should only get used to set a certain starting velocity, e.g. after inserting a RailRunner into the scene, constant reset of velocity will result in unstable simulation.
| std::logic_error | Thrown if the railrunner is not railed. |
|
pure virtualnoexcept |
Gets the principle direction of movement according to the sign of the target velocity.
Note that if the target velocity is zero, this will still give the orientation of the last movement.
|
pure virtualnoexcept |
|
pure virtual |
Sets the target velocity to aim for by using the supplied Thrust() and Brake() settings.
The simulator will try to reach this by applying up to the fraction of maximum thrust, specified by Thrust() and up to the fraction of maximum braking force specified by Brake() if necessary to reduce the actual velocity. The brake will only be used, if the velocity exceeds the target velocity. E.g. on a hill the RailRunner might roll back due to too few thrust but the brake will not get applied in this case.
| velocity | Signed target velocity to aim for. This very well might be set to extreme high values, wich can never be reached by the motor. |
|
pure virtualnoexcept |
Gets the fraction of the maximum thrust applied.
|
pure virtual |
Sets the fraction of the maximum thrust to apply in order to reach the target velocity specified by TargetVelocity().
| byfactor | Value between [0,1] specifying the fraction of the total available acceleration. |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Uncouples the RailRunner at the specified end.
| end | End of this RailRunner. |
| btriggerPulses | If true the respective JackOnUnCouple jacks are pulsing. |
|
pure virtualnoexcept |
|
pure virtualnoexcept |
Sets a pointer to user provided data.
Define TrackUserData to specify your data types.