VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fixedWingPilotController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1999-2000 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 
16 #include <matrix/LibMatrix.h>
17 #include "vrfutil/rwAirSpeedType.h"
18 
19 class DtString;
25 class DtTaskMessage;
28 
31 const double DtTurningSpeedTol = 0.0556;
32 
38 const double DtLandingTolerance = 2.5;
39 
48 {
49 
50 public:
51 
55  DtLocalObject* owner,
56  DtSimulationServices* simManager,
57  DtComponentDescriptor* desc = 0,
58  DtReaderWriterRegistry* parentRegistry = 0);
59 
61  virtual ~DtFixedWingPilotController() override;
62 
64  virtual bool init() override;
65 
69  virtual void tick() override;
70 
73  virtual const char* type() const override;
74 
77  virtual void clearTask() override;
78 
82  virtual void registerAttributeFunctions() override;
83 
87  static DtReaderWriter* provideMaxThrustAcceleration(void* controller);
88 
89 
104  virtual void taxiTo(const DtVector& destination, double speed);
105 
112  virtual void taxi(double speed, double turnRate);
113 
117  virtual double calculateSteering(double turnAngle) const;
118 
121  virtual double approximateThrottle(double speed);
122 
125  virtual double calculateCurrentBrakingDistance() const;
127 
128 
141  virtual void flyTo(const DtVector& destination, double speed, double maxTerrainAvoidanceLookaheadDist = -1);
142 
148  virtual void flyToDirect(const DtVector& destination, double speed, double maxTerrainAvoidanceLookaheadDist = -1);
149 
158  virtual void fly(double speed, double turnRate, double climbRate, double maxTerrainAvoidanceLookaheadDist = -1);
159 
168  virtual void flyFixedPitch(double speed, double turnRate, double desiredPitch, double maxTerrainAvoidanceLookaheadDist = -1);
169 
173  virtual double terrainAvoidancePitch(double speed, double desiredPitch, double maxTerrainAvoidanceLookaheadDist);
174 
178  virtual bool clearPathTo(const DtVector& localPosition, bool& dataAvailable, double minAltitude);
179 
205  virtual void circle(const DtVector& center, double radius, double speed,
206  double altitude, bool clockwise = true);
207 
210  virtual double calcControlForRoll(double rollRate);
211 
225  virtual double calcControlForThrottle(double speed, bool& deployFlaps);
226 
238  virtual double decelerationLimitedClimbRate(double altitudeError,
239  double desiredSpeed, double finalClimbRate = 0.0);
240 
244  virtual void calcControlForTurnAndClimb(double turnRate, double climbRate,
245  double& stickX, double& pedal);
246 
251  virtual void calcControlForTurnAndPitch(double turnRate, double desiredPitch,
252  double& stickX, double& pedal, double rollRate = 0.0);
253 
260  virtual double calculateClimbRate(double altitude, double climbTime) const;
261 
267  // turn rate = (heading change / max-turnrate-cutoff-angle) *
268  // max-pitch-rate
275  virtual double calculateTurnRate(double turnAngle, double additionalTurnRate = 0) const;
276 
279  // roll angle = ATAN((speed * turn rate * 0.5) / 9.8)
280  virtual double calculateRollAngle(double turnRate, double speed)
281  const;
282 
285  virtual double calculateRollRate(double rollAngle, double turnRate);
286 
288 
302  virtual void calculateNormalizedBodyVelocity();
303 
309  virtual void calculateLocalAngularVelocity();
310 
316  // mySpeedRatioSquared
317  virtual void calculateSpeedRatioSquared();
318 
326  virtual void initializeControllerForTick();
327 
330  virtual bool createFixedWingControlPortGroup();
331  virtual bool createThrottlePort();
332  virtual bool createStickPort();
333  virtual bool createPedalPort();
334  virtual bool createBrakePort();
335 
337  virtual bool createFlapsDeployedPort();
338 
340  virtual DtConstrainedAnalogOutputPort* throttlePort();
341  virtual DtConstrainedDualAxisAnalogOutputPort* stickPort();
342  virtual DtConstrainedAnalogOutputPort* pedalPort();
343  virtual DtConstrainedAnalogOutputPort* brakePort();
344  virtual DtBooleanOutputPort* flapsDeployedPort();
345 
347  virtual void setMaxThrustAcceleration(double maxThrustAcceleration);
348 
350  virtual void setTakeOffDir(const DtVector& takeOffDir);
351  virtual const DtVector& takeOffDir() const;
352 
355  virtual DtReal maxTurningGsForTask() const;
356  virtual DtReal maxTurnRateCutoffAngle() const;
357  virtual DtReal maxTaxiingTurnSpeed() const;
358  virtual DtReal taxiingNearDistance() const;
359  virtual DtReal taxiingAtDistance() const;
360  virtual DtReal taxiingApproachSpeed() const;
361  virtual DtReal maxPitchAngle() const;
362  virtual DtReal timeToTargetAltitude() const;
364 
368  virtual double maxTurningGs() const;
369 
372  virtual bool terrainAvoidanceEnabled() const;
377  virtual double terrainAvoidanceLookaheadTime();
378 
382  static DtSimComponent * creator(const DtString& name,
383  DtLocalObject* owner,
384  DtSimulationServices* simManager,
385  DtComponentDescriptor* desc = 0,
386  DtReaderWriterRegistry* parentRegistry = 0);
387 
388 protected:
390  virtual DtReaderWriter* processProvideMaxThrustAcceleration();
391 
393  virtual bool createPorts() override;
394 
396  virtual bool createPortGroups() override;
397 
405  virtual void lookupAndCacheProcessSR();
406 
411  virtual bool postAddComponentsInit() override;
412 
415  virtual bool decideToGiveUpTask() const override;
416 
421  virtual void updateCurrentState();
422 
424  virtual void processEstimatedTotCalculation();
425 
431  virtual double calculateCollisionLookAhead(const double climbRate,
432  const double speed,
433  const double desiredAltitude);
434 
436  virtual void updateTaskVisualizations() override;
437 
439  virtual double convertSpeedtoGroundSpeed(double speed, double currentAlt, DtAirSpeedType speedType);
440 
441 protected:
442 
445 
448  orig);
449 
453 
454 protected:
455 
457 
460 
464 
471 
478 
485 
492 
499 
501 
508 
512 
525 
527  const double DtEstimatedTotCalcInterval = 5.0;
528 
538 };
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
double myCurrentHeading
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:520
Instances of DtConstrainedDualAxisAnalogOutputPort are output ports through which data producers can ...
Definition: constrainedDualAxisAnalogIOPort.h:61
virtual bool postAddComponentsInit() override
Calls enableTaskTypes()
DtFixedWingFlightPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: fixedWingPilotController.h:507
DtVector myCurrentLocalVelocity
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:517
virtual const char * type() const override=0
Returns a string identifies the class type of component. Type values are defined in compTypes...
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
double myCurrentTopoRoll
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:522
DtConstrainedAnalogOutputPort * myThrottlePort
Output Port Name: throttle Output Port Description: Output Port Range: 0. to 1. Output Port Default ...
Definition: fixedWingPilotController.h:470
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:22
DtConstrainedAnalogOutputPort * myBrakePort
Output Port Name: brake Output Port Description: Output Port Range: 0. to 1. Output Port Default Val...
Definition: fixedWingPilotController.h:491
Definition: readerWriter.h:85
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
DtOutputPortGroup is a data port group of a data provider. It may contain any number of DtOutputPorts...
Definition: outputPortGroup.h:34
DtFixedWingPilotController is a controller that models the capabilities of a fixed-wing pilot...
Definition: fixedWingPilotController.h:47
DtConstrainedAnalogOutputPort is a version of DtAnalogOutputPort which will constrain any outgoing va...
Definition: constrainedAnalogIOPort.h:57
DtAirspeedCalculator * myAirSpeedCalculator
Air Speed Calculator for updating state properties Created in init()
Definition: fixedWingPilotController.h:511
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: fixedWingPilotController.h:534
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:443
virtual bool init() override
Calls setRadio()
DtDcm myCurrentOrientationMatrix
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:519
class DtFixedWingFlightPSR:
Definition: fixedWingFlightPSR.h:41
DtVector myEstimatedTotTextPos
tot text position
Definition: fixedWingPilotController.h:536
This repository holds all information that is common to all the forms of local fixed wing entities wi...
Definition: fixedWingEntityStateRepository.h:41
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
DtConstrainedAnalogOutputPort * myPedalPort
Output Port Name: pedal Output Port Description: Output Port Range: -1. to 1. Output Port Default Va...
Definition: fixedWingPilotController.h:484
const double DtLandingTolerance
This is the tolerance for determining if a control point is close enough to the terrain (and maybe la...
Definition: fixedWingPilotController.h:38
const double DtTurningSpeedTol
Allow a turn of no more than 2 degrees when moving too fast, which equals ~ 0.0556 radians...
Definition: fixedWingPilotController.h:31
DtOutputPortGroup * myFixedWingControlPortGroup
Output Port Group Name: fixed-wing-control Output Port Group Description:
Definition: fixedWingPilotController.h:463
virtual bool createPorts()
Called by init. Derived classes should override this method to create all their input/output ports an...
virtual bool decideToGiveUpTask() const
This function is used to determine if the controller should give up trying to execute the current tas...
double myCurrentSpeed
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:518
DtConstrainedDualAxisAnalogOutputPort * myStickPort
Output Port Name: stick Output Port Description: Output Port Range: X: -1. to 1. Y: -1...
Definition: fixedWingPilotController.h:477
DtAirSpeedType
Air Speed Type PDU enums.
Definition: rwAirSpeedType.h:23
class DtAirspeedCalculator:
Definition: airSpeedCalculator.h:23
virtual bool createPortGroups()
Called by init. Derived classes should override this method to create all their input/output port gro...
double myCurrentTopoPitch
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:521
DtDcm myLocalToTopoDcm
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:523
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:96
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:89
DtVector myCurrentLocalPosition
State variables updated for the current time. Computed at the beginning of the tick, and used only in that tick.
Definition: fixedWingPilotController.h:516
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
virtual void clearTask() override
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
virtual void registerAttributeFunctions()
Called to register functions that provide system attribute values. Called by init(). Empty in this class. Overridden in different components to add attribute provider functions.
Definition: simComponent.h:131
double myEstimatedTotValue
the tot value
Definition: fixedWingPilotController.h:532
DtBooleanOutputPort * myFlapsDeployedPort
Output Port Name: flaps Output Port Description: Output Port Range: Output Port Default Value: true...
Definition: fixedWingPilotController.h:498
A DtTaskMsg is a DtRadioMsg with a pointer to a task. The type of the taskMsg is just the type of the...
Definition: taskMessage.h:21
DtPlatformLocalObjectFacade myPlatformLocalObjectFacade
Definition: fixedWingPilotController.h:537
DtFixedWingEntityStateRepository * myFixedWingEntityState
Definition: fixedWingPilotController.h:456
A locally simulated VRF object.
Definition: localObject.h:98
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: fixedWingPilotController.h:530

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)