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();
62 
64  virtual bool init();
65 
69  virtual void tick();
70 
73  virtual const char* type() const;
74 
77  virtual void clearTask();
78 
82  virtual void registerAttributeFunctions();
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 
177  virtual bool clearPathTo(const DtVector& localPosition, bool& dataAvailable);
178 
204  virtual void circle(const DtVector& center, double radius, double speed,
205  double altitude, bool clockwise = true);
206 
209  virtual double calcControlForRoll(double rollRate);
210 
224  virtual double calcControlForThrottle(double speed, bool& deployFlaps);
225 
237  virtual double decelerationLimitedClimbRate(double altitudeError,
238  double desiredSpeed, double finalClimbRate = 0.0);
239 
243  virtual void calcControlForTurnAndClimb(double turnRate, double climbRate,
244  double& stickX, double& pedal);
245 
250  virtual void calcControlForTurnAndPitch(double turnRate, double desiredPitch,
251  double& stickX, double& pedal, double rollRate = 0.0);
252 
259  virtual double calculateClimbRate(double altitude, double climbTime) const;
260 
266  // turn rate = (heading change / max-turnrate-cutoff-angle) *
267  // max-pitch-rate
274  virtual double calculateTurnRate(double turnAngle, double additionalTurnRate = 0) const;
275 
278  // roll angle = ATAN((speed * turn rate * 0.5) / 9.8)
279  virtual double calculateRollAngle(double turnRate, double speed)
280  const;
281 
284  virtual double calculateRollRate(double rollAngle, double turnRate);
285 
287 
301  virtual void calculateNormalizedBodyVelocity();
302 
308  virtual void calculateLocalAngularVelocity();
309 
315  // mySpeedRatioSquared
316  virtual void calculateSpeedRatioSquared();
317 
325  virtual void initializeControllerForTick();
326 
329  virtual bool createFixedWingControlPortGroup();
330  virtual bool createThrottlePort();
331  virtual bool createStickPort();
332  virtual bool createPedalPort();
333  virtual bool createBrakePort();
334 
336  virtual bool createFlapsDeployedPort();
337 
339  virtual DtConstrainedAnalogOutputPort* throttlePort();
340  virtual DtConstrainedDualAxisAnalogOutputPort* stickPort();
341  virtual DtConstrainedAnalogOutputPort* pedalPort();
342  virtual DtConstrainedAnalogOutputPort* brakePort();
343  virtual DtBooleanOutputPort* flapsDeployedPort();
344 
346  virtual void setMaxThrustAcceleration(double maxThrustAcceleration);
347 
349  virtual void setTakeOffDir(const DtVector& takeOffDir);
350  virtual const DtVector& takeOffDir() const;
351 
354  virtual DtReal maxTurningGsForTask() const;
355  virtual DtReal maxTurnRateCutoffAngle() const;
356  virtual DtReal maxTaxiingTurnSpeed() const;
357  virtual DtReal taxiingNearDistance() const;
358  virtual DtReal taxiingAtDistance() const;
359  virtual DtReal taxiingApproachSpeed() const;
360  virtual DtReal maxPitchAngle() const;
361  virtual DtReal timeToTargetAltitude() const;
363 
367  virtual double maxTurningGs() const;
368 
371  virtual bool terrainAvoidanceEnabled();
376  virtual double terrainAvoidanceLookaheadTime();
377 
381  static DtSimComponent * creator(const DtString& name,
382  DtLocalObject* owner,
383  DtSimulationServices* simManager,
384  DtComponentDescriptor* desc = 0,
385  DtReaderWriterRegistry* parentRegistry = 0);
386 
387 protected:
389  virtual DtReaderWriter* processProvideMaxThrustAcceleration();
390 
392  virtual bool createPorts();
393 
395  virtual bool createPortGroups();
396 
404  virtual void lookupAndCacheProcessSR();
405 
410  virtual bool postAddComponentsInit();
411 
414  virtual bool decideToGiveUpTask() const;
415 
420  virtual void updateCurrentState();
421 
423  virtual void processEstimatedTotCalculation();
424 
430  virtual double calculateCollisionLookAhead(const double climbRate,
431  const double speed,
432  const double desiredAltitude);
433 
435  virtual void updateTaskVisualizations();
436 
438  virtual double convertSpeedtoGroundSpeed(double speed, double currentAlt, DtAirSpeedType speedType);
439 
440 protected:
441 
444 
447  orig);
448 
452 
453 protected:
454 
456 
459 
463 
470 
477 
484 
491 
498 
500 
507 
511 
524 
526  const double DtEstimatedTotCalcInterval = 5.0;
527 
537 };
#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:519
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:506
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:516
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:521
DtConstrainedAnalogOutputPort * myThrottlePort
Output Port Name: throttle Output Port Description: Output Port Range: 0. to 1. Output Port Default ...
Definition: fixedWingPilotController.h:469
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:490
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:510
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: fixedWingPilotController.h:533
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick. Implemented by subclasses. ...
Definition: simComponent.h:437
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:518
class DtFixedWingFlightPSR:
Definition: fixedWingFlightPSR.h:41
DtVector myEstimatedTotTextPos
tot text position
Definition: fixedWingPilotController.h:535
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:483
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:462
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:517
DtConstrainedDualAxisAnalogOutputPort * myStickPort
Output Port Name: stick Output Port Description: Output Port Range: X: -1. to 1. Y: -1...
Definition: fixedWingPilotController.h:476
DtAirSpeedType
Air Speed Type PDU enums.
Definition: rwAirSpeedType.h:24
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:520
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:522
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:95
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:91
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:515
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:133
double myEstimatedTotValue
the tot value
Definition: fixedWingPilotController.h:531
DtBooleanOutputPort * myFlapsDeployedPort
Output Port Name: flaps Output Port Description: Output Port Range: Output Port Default Value: true...
Definition: fixedWingPilotController.h:497
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:536
DtFixedWingEntityStateRepository * myFixedWingEntityState
Definition: fixedWingPilotController.h:455
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: fixedWingPilotController.h:529

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)