VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
DtBaseMountingController Class Reference

DtBaseMountingController is a controller that generates the azimuth and elevation controls needed to manipulate a weapon mount to the a desired azimuth and elevation. More...

Inheritance diagram for DtBaseMountingController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtBaseMountingController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtBaseMountingController ()
 destructor
virtual bool postAddComponentsInit ()
 Overridden to activate myMountingControlPortGroup.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual DtOutputPortGroupmountingControlPortGroup ()
 Returns myMountingControlPortGroup.
virtual DtInputPortGroupazimuthInfoPortGroup ()
 Returns myAzimuthInfoPortGroup.
virtual DtInputPortGroupelevationInfoPortGroup ()
 Returns myAzimuthInfoPortGroup.
virtual void tick ()
 Calculate new control values.
virtual void reorientMounting ()
 Spin the mounting to point toward the desired targetPoint or desiredAzimuth/desiredElevation.
virtual void findDesiredAzimuthAndElevation ()
virtual bool desiredOrientationIsInRange (double &azimuthOutOfRangeBy, double &elevationOutOfRangeBy, double additionalAzimuthMargin=0.0, double additionalElevationMargin=0.0)
 Returns true if the desired azimuth and elevation are within the range that this mounting can do.
virtual bool createAzimuthPort ()
 These are called in init to create the ports used to communicate with the actuator.
virtual
DtConstrainedAnalogOutputPort
azimuthPort () const
virtual bool createElevationPort ()
virtual
DtConstrainedAnalogOutputPort
elevationPort () const
virtual bool createAzimuthInfoPorts ()
 creates the ports used by myAzimuthInfoPortGroup
virtual bool createElevationInfoPorts ()
 creates the ports used by myElevationInfoPortGroup
virtual double approximateMountSwing (double angleChange, double maxRate)
 Determine how fast a mounting should swing given the angle it must travel through (angleChange) and the maxRate of its transit.
virtual void setDesiredAzimuth (DtReal desiredAzimuth)
virtual DtReal desiredAzimuth ()
virtual void setDesiredElevation (DtReal desiredElevation)
virtual DtReal desiredElevation ()

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,

Protected Member Functions

virtual bool createPortGroups ()
 Overridden to create mounting port groups.
virtual bool createPorts ()
 Overridden to create mounting ports.
 DtBaseMountingController ()
 default constructor; not implemented
 DtBaseMountingController (const DtBaseMountingController &orig)
 copy constructor; not implemented
const DtBaseMountingControlleroperator= (const DtBaseMountingController &orig)
 assignment operator; not implemented

Protected Attributes

DtArticulatedPartStateRepositorymyAzimuthMountPart
DtArticulatedPartStateRepositorymyElevationMountPart
DtArticulatedPartStateRepositorymyChildSimBody
DtReal myDesiredAzimuth
 Desired azimuth angle relative to the body.
DtReal myDesiredElevation
 Desired elevation angle relative to the body.
DtReal myAngleApproxMargin
 To prevent endless fine adjustments to the azimuth and elevation we'll use a constant margin to determine when the azimuth and elevation are close enough.
Ports and Port Groups
DtInputPortGroupmyAzimuthInfoPortGroup
 Input Port Group Name: azimuth-info
Input Port Group Description: Used to get azimuth information from the actuator.
DtAnalogInputPortmyNominalAzimuthPort
 Input Port Name: nominal-azimuth
Input Port Description: Nominal azimuth value.
DtAnalogInputPortmyAzimuthRangePort
 Input Port Name: azimuth-range
Input Port Description: Azimuth sweep range.
DtAnalogInputPortmyMaxAzimuthRatePort
 Input Port Name: azimuth-rate
Input Port Description: Max azimuth rate.
DtIntegerInputPortmyAzimuthPartTypePort
 Input Port Name: azimuth-part-type
Input Port Description: Type of articulated part.
DtInputPortGroupmyElevationInfoPortGroup
 Input Port Group Name: elevation-info
Input Port Group Description: Used to get elevation information from the actuator.
DtAnalogInputPortmyNominalElevationPort
 Input Port Name: nominal-elevation Input Port Description: Nominal elevation value.
DtAnalogInputPortmyElevationRangePort
 Input Port Name: elevation-range Input Port Description: Elevation sweep range
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.
DtAnalogInputPortmyMaxElevationRatePort
 Input Port Name: elevation-rate Input Port Description: Max elevation rate
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.
DtIntegerInputPortmyElevationPartTypePort
 Input Port Name: elevation-part-type Input Port Description: Type of articulated part
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.
DtOutputPortGroupmyMountingControlPortGroup
 Output Port Group Name: mounting-control
Output Port Group Description: Accepts output from the missile launcher controller and indirect fire controller.
DtConstrainedAnalogOutputPortmyAzimuthPort
 Output Port Name: azimuth Output Port Description:
Output Port Range: -1.
DtConstrainedAnalogOutputPortmyElevationPort
 Output Port Name: elevation Output Port Description:
Output Port Range: -1.

Detailed Description

DtBaseMountingController is a controller that generates the azimuth and elevation controls needed to manipulate a weapon mount to the a desired azimuth and elevation.

It expects to control an azimuth and/or elevation mount actuator(s).

Uses Descriptor Type: DtComponentDescriptor


Constructor & Destructor Documentation

DtBaseMountingController::DtBaseMountingController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

default constructor; not implemented

copy constructor; not implemented


Member Function Documentation

Overridden to activate myMountingControlPortGroup.

Reimplemented from DtSimComponent.

virtual DtString DtBaseMountingController::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtBaseMountingControllerType

Reimplemented from DtControllerComponent.

Reimplemented in DtMountingController.

Returns myMountingControlPortGroup.

Returns myAzimuthInfoPortGroup.

Returns myAzimuthInfoPortGroup.

virtual void DtBaseMountingController::tick ( ) [virtual]

Calculate new control values.

Reimplemented from DtSimComponent.

virtual void DtBaseMountingController::reorientMounting ( ) [virtual]

Spin the mounting to point toward the desired targetPoint or desiredAzimuth/desiredElevation.

Takes the current orientation of myChildSimBody (the DtSimBody part that has the combined azimuth and elevation orientation of the mounting), and generates the azimuth and elevation steering input needed to maneuver the mounting toward the desired azimuth and elevation. It obtains the orientation of the mount point in body coordinates of the entity, from myChildSimBody. These Euler angles give the current azimuth and elevation settings of the mount point. It then calls the static functions DtMountingAzimuthActuator::computeDeltaOutsideAzimuthRange(), and DtMountingElevationActuator::computeDeltaOutsideElevationRange(), to determine the extent to which the current orientation is off-target. If the azimuth or elevation angular extent returned is zero, the corresponding port value is set to zero. If not, the function is called to generate a control input, given the amount the angle is off approximateMountSwing() by, and the maximum angular rate at which it can swing. It sets the control input for the port with the value returned by approximateMountSwing().

virtual void DtBaseMountingController::setDesiredAzimuth ( DtReal  desiredAzimuth) [virtual]

Set an azimuth you want this mounting to point towards. This azimuth is relative to the body.

virtual DtReal DtBaseMountingController::desiredAzimuth ( ) [virtual]

Set an azimuth you want this mounting to point towards. This azimuth is relative to the body.

virtual void DtBaseMountingController::setDesiredElevation ( DtReal  desiredElevation) [virtual]

Set an elevation you want this mounting to point towards. This elevation is relative to the body.

virtual DtReal DtBaseMountingController::desiredElevation ( ) [virtual]

Set an elevation you want this mounting to point towards. This elevation is relative to the body.

Reimplemented in DtMountingController.

virtual bool DtBaseMountingController::desiredOrientationIsInRange ( double &  azimuthOutOfRangeBy,
double &  elevationOutOfRangeBy,
double  additionalAzimuthMargin = 0.0,
double  additionalElevationMargin = 0.0 
) [virtual]

Returns true if the desired azimuth and elevation are within the range that this mounting can do.

If it's out of range, the method returns false and puts the outOfRangeBy amounts into the appropriate "out" params. The params for additionalMargin allows the caller to broaden the acceptable azimuth and elevation range by the passed in values.

These are called in init to create the ports used to communicate with the actuator.

creates the ports used by myAzimuthInfoPortGroup

creates the ports used by myElevationInfoPortGroup

virtual double DtBaseMountingController::approximateMountSwing ( double  angleChange,
double  maxRate 
) [virtual]

Determine how fast a mounting should swing given the angle it must travel through (angleChange) and the maxRate of its transit.

Takes as input the amount of angle to be changed and the maximum angular rate of change, and returns a value between -1.0 and 1.0, representing the scaled rate at which the angle should change. It computes this value to be the amount of angular change desired, divided by the maximum angular rate times the current frame duration, dT, for example:

Returns:
angleChange / (maxRate * dT());
static DtSimComponent* DtBaseMountingController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.

Reimplemented in DtMountingController.

virtual bool DtBaseMountingController::createPortGroups ( ) [protected, virtual]

Overridden to create mounting port groups.

Reimplemented from DtSimComponent.

virtual bool DtBaseMountingController::createPorts ( ) [protected, virtual]

Overridden to create mounting ports.

Reimplemented from DtSimComponent.

const DtBaseMountingController& DtBaseMountingController::operator= ( const DtBaseMountingController orig) [protected]

assignment operator; not implemented


Member Data Documentation

Input Port Group Name: azimuth-info
Input Port Group Description: Used to get azimuth information from the actuator.

Input Port Name: nominal-azimuth
Input Port Description: Nominal azimuth value.


Input Port Range:
Input Port Default Value:
Input Group Parent: azimuth-info

Input Port Name: azimuth-range
Input Port Description: Azimuth sweep range.


Input Port Range:
Input Port Default Value:
Input Group Parent: azimuth-info

Input Port Name: azimuth-rate
Input Port Description: Max azimuth rate.


Input Port Range:
Input Port Default Value:
Input Group Parent: azimuth-info

Input Port Name: azimuth-part-type
Input Port Description: Type of articulated part.


Input Port Range:
Input Port Default Value:
Input Group Parent: azimuth-info

Input Port Group Name: elevation-info
Input Port Group Description: Used to get elevation information from the actuator.

Input Port Name: nominal-elevation Input Port Description: Nominal elevation value.


Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info

Input Port Name: elevation-range Input Port Description: Elevation sweep range
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.

Input Port Name: elevation-rate Input Port Description: Max elevation rate
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.

Input Port Name: elevation-part-type Input Port Description: Type of articulated part
Input Port Range:
Input Port Default Value:
Input Group Parent: elevation-info.

Output Port Group Name: mounting-control
Output Port Group Description: Accepts output from the missile launcher controller and indirect fire controller.

Output Port Name: azimuth Output Port Description:
Output Port Range: -1.

to 1.
Output Port Default Value:
Output Group Parent: mounting-control

Output Port Name: elevation Output Port Description:
Output Port Range: -1.

to 1.
Output Port Default Value:
Output Group Parent: mounting-control

Desired azimuth angle relative to the body.

Desired elevation angle relative to the body.

To prevent endless fine adjustments to the azimuth and elevation we'll use a constant margin to determine when the azimuth and elevation are close enough.


The documentation for this class was generated from the following file:

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)