VR-Forces 4.8 Class Documentation
 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 
15 #include <matrix/LibMatrix.h>
16 
17 class DtString;
18 class DtSimManager;
23 class DtTaskMessage;
25 
28 const double DtTurningSpeedTol = 0.0556;
29 
35 const double DtLandingTolerance = 2.5;
36 
45 {
46 
47 public:
48 
52  DtVrfObject* owner,
53  DtSimManager* simManager,
54  DtComponentDescriptor* desc = 0,
55  DtReaderWriterRegistry* parentRegistry = 0);
56 
58  virtual ~DtFixedWingPilotController();
59 
61  virtual bool init();
62 
66  virtual void tick();
67 
70  virtual const char* type() const;
71 
74  virtual void clearTask();
75 
90  virtual void taxiTo(const DtVector& destination, double speed);
91 
98  virtual void taxi(double speed, double turnRate);
99 
103  virtual double calculateSteering(double turnAngle) const;
104 
107  virtual double approximateThrottle(double speed);
108 
111  virtual double calculateCurrentBrakingDistance() const;
113 
114 
127  virtual void flyTo(const DtVector& destination, double speed, double maxTerrainAvoidanceLookaheadDist = -1);
128 
134  virtual void flyToDirect(const DtVector& destination, double speed, double maxTerrainAvoidanceLookaheadDist = -1);
135 
144  virtual void fly(double speed, double turnRate, double climbRate, double maxTerrainAvoidanceLookaheadDist = -1);
145 
154  virtual void flyFixedPitch(double speed, double turnRate, double desiredPitch, double maxTerrainAvoidanceLookaheadDist = -1);
155 
159  virtual double terrainAvoidancePitch(double speed, double desiredPitch, double maxTerrainAvoidanceLookaheadDist);
160 
163  virtual bool clearPathTo(const DtVector& localPosition);
164 
190  virtual void circle(const DtVector& center, double radius, double speed,
191  double altitude, bool clockwise = true);
192 
195  virtual double calcControlForRoll(double rollRate);
196 
210  virtual double calcControlForThrottle(double speed, bool& deployFlaps);
211 
223  virtual double decelerationLimitedClimbRate(double altitudeError,
224  double desiredSpeed, double finalClimbRate = 0.0);
225 
229  virtual void calcControlForTurnAndClimb(double turnRate, double climbRate,
230  double& stickX, double& pedal);
231 
236  virtual void calcControlForTurnAndPitch(double turnRate, double desiredPitch,
237  double& stickX, double& pedal, double rollRate = 0.0);
238 
245  virtual double calculateClimbRate(double altitude, double climbTime) const;
246 
252  // turn rate = (heading change / max-turnrate-cutoff-angle) *
253  // max-pitch-rate
260  virtual double calculateTurnRate(double turnAngle, double additionalTurnRate = 0) const;
261 
264  // roll angle = ATAN((speed * turn rate * 0.5) / 9.8)
265  virtual double calculateRollAngle(double turnRate, double speed)
266  const;
267 
270  virtual double calculateRollRate(double rollAngle, double turnRate);
271 
273 
287  virtual void calculateNormalizedBodyVelocity();
288 
294  virtual void calculateLocalAngularVelocity();
295 
301  // mySpeedRatioSquared
302  virtual void calculateSpeedRatioSquared();
303 
311  virtual void initializeControllerForTick();
312 
315  virtual bool createFixedWingControlPortGroup();
316  virtual bool createThrottlePort();
317  virtual bool createStickPort();
318  virtual bool createPedalPort();
319  virtual bool createBrakePort();
320 
322  virtual bool createFlapsDeployedPort();
323 
325  virtual DtConstrainedAnalogOutputPort* throttlePort();
326  virtual DtConstrainedDualAxisAnalogOutputPort* stickPort();
327  virtual DtConstrainedAnalogOutputPort* pedalPort();
328  virtual DtConstrainedAnalogOutputPort* brakePort();
329  virtual DtBooleanOutputPort* flapsDeployedPort();
330 
332  virtual void setMaxThrustAcceleration(double maxThrustAcceleration);
333 
335  virtual void setTakeOffDir(const DtVector& takeOffDir);
336  virtual const DtVector& takeOffDir() const;
337 
340  virtual DtReal maxTurningGsForTask() const;
341  virtual DtReal maxTurnRateCutoffAngle() const;
342  virtual DtReal maxTaxiingTurnSpeed() const;
343  virtual DtReal taxiingNearDistance() const;
344  virtual DtReal taxiingAtDistance() const;
345  virtual DtReal taxiingApproachSpeed() const;
346  virtual DtReal maxPitchAngle() const;
347  virtual DtReal timeToTargetAltitude() const;
349 
353  virtual double maxTurningGs() const;
354 
357  virtual bool terrainAvoidanceEnabled();
362  virtual double terrainAvoidanceLookaheadTime();
363 
367  static DtSimComponent * creator(const DtString& name,
368  DtVrfObject* owner,
369  DtSimManager* simManager,
370  DtComponentDescriptor* desc = 0,
371  DtReaderWriterRegistry* parentRegistry = 0);
372 
373 protected:
374 
376  virtual bool createPorts();
377 
379  virtual bool createPortGroups();
380 
388  virtual void lookupAndCacheProcessSR();
389 
394  virtual bool postAddComponentsInit();
395 
398  virtual bool decideToGiveUpTask() const;
399 
404  virtual void updateCurrentState();
405 
407  virtual void processEstimatedTotCalculation();
408 
414  virtual double calculateCollisionLookAhead(const double climbRate,
415  const double speed,
416  const double desiredAltitude);
417 
419  virtual void updateTaskVisualizations();
420 
421 protected:
422 
425 
428  orig);
429 
433 
434 protected:
435 
437 
440 
444 
451 
458 
465 
472 
479 
481 
488 
501 
503  const double DtEstimatedTotCalcInterval = 5.0;
504 
513 
514 };
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
virtual bool postAddComponentsInit()
Called after all components have been created, initialized and added to the component manager...
Definition: simComponent.h:144
double myCurrentHeading
Definition: fixedWingPilotController.h:496
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
Instances of DtConstrainedDualAxisAnalogOutputPort are output ports through which data producers can ...
Definition: constrainedDualAxisAnalogIOPort.h:61
DtFixedWingFlightPSR * myProcessState
Pointer to a process state repository used to store state data associated with this component...
Definition: fixedWingPilotController.h:487
DtVector myCurrentLocalVelocity
Definition: fixedWingPilotController.h:493
Instances of DtBooleanOutputPort are output ports through which data producers can send boolean data...
Definition: boolIOPort.h:45
double myCurrentTopoRoll
Definition: fixedWingPilotController.h:498
DtConstrainedAnalogOutputPort * myThrottlePort
Output Port Name: throttle Output Port Description: Output Port Range: 0.
Definition: fixedWingPilotController.h:450
This class provides a base class for all controllers that are capable of executing a DtSimTask...
Definition: singleTaskControllerComponent.h:20
DtConstrainedAnalogOutputPort * myBrakePort
Output Port Name: brake Output Port Description: Output Port Range: 0.
Definition: fixedWingPilotController.h:471
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
Definition: readerWriterRegistry.h:39
virtual const char * type() const =0
Returns a string identifies the class type of component.
DtOutputPortGroup is a data port group of a data provider.
Definition: outputPortGroup.h:30
DtFixedWingPilotController is a controller that models the capabilities of a fixed-wing pilot...
Definition: fixedWingPilotController.h:44
virtual bool init()
Calls setRadio()
DtConstrainedAnalogOutputPort is a version of DtAnalogOutputPort which will constrain any outgoing va...
Definition: constrainedAnalogIOPort.h:54
virtual void clearTask()
If component is currently tasked, calls clearPendingSubtasks(), sets the tasked flag to false...
double myEstimatedTotLastCalcTime
used for tot calculation intervals
Definition: fixedWingPilotController.h:510
virtual void updateTaskVisualizations()
Called to update task visualizations after every tick.
Definition: simComponent.h:485
DtDcm myCurrentOrientationMatrix
Definition: fixedWingPilotController.h:495
class DtFixedWingFlightPSR:
Definition: fixedWingFlightPSR.h:38
DtVector myEstimatedTotTextPos
tot text position
Definition: fixedWingPilotController.h:512
This repository holds all information that is common to all the forms of local fixed wing entities wi...
Definition: fixedWingEntityStateRepository.h:37
virtual void tick()
This gives the thread of control to the component.
DtConstrainedAnalogOutputPort * myPedalPort
Output Port Name: pedal Output Port Description: Output Port Range: -1.
Definition: fixedWingPilotController.h:464
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:35
const double DtTurningSpeedTol
Allow a turn of no more than 2 degrees when moving too fast, which equals ~ 0.0556 radians...
Definition: fixedWingPilotController.h:28
DtOutputPortGroup * myFixedWingControlPortGroup
Output Port Group Name: fixed-wing-control Output Port Group Description:
Definition: fixedWingPilotController.h:443
virtual bool createPorts()
Called by init.
virtual bool decideToGiveUpTask() const
This function is used to determine if the controller should give up trying to execute the current tas...
double myCurrentSpeed
Definition: fixedWingPilotController.h:494
DtConstrainedDualAxisAnalogOutputPort * myStickPort
Output Port Name: stick Output Port Description: Output Port Range: X: -1.
Definition: fixedWingPilotController.h:457
virtual bool createPortGroups()
Called by init.
double myCurrentTopoPitch
Definition: fixedWingPilotController.h:497
DtDcm myLocalToTopoDcm
Definition: fixedWingPilotController.h:499
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
DtVector myCurrentLocalPosition
State variables updated for the current time.
Definition: fixedWingPilotController.h:492
const DtTaskControllerComponent & operator=(const DtTaskControllerComponent &orig)
assignment operator
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:102
double myEstimatedTotValue
the tot value
Definition: fixedWingPilotController.h:508
DtBooleanOutputPort * myFlapsDeployedPort
Output Port Name: flaps Output Port Description: Output Port Range: Output Port Default Value: true...
Definition: fixedWingPilotController.h:478
A DtTaskMsg is a DtRadioMsg with a pointer to a task.
Definition: taskMessage.h:19
DtFixedWingEntityStateRepository * myFixedWingEntityState
Definition: fixedWingPilotController.h:436
bool myEstimatedTotCalcEnabled
enabled flag for the tot calculations
Definition: fixedWingPilotController.h:506

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)