![]() |
VR-Forces 4.0.4 Class Documentation
|
DtTurretActuatorComponent provides a simple model of a rotating turret that knows how to drive the articulating parts objects of the local state repository. More...

Public Member Functions | |
| DtTurretActuatorComponent (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) | |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
| virtual | ~DtTurretActuatorComponent () |
| destructor | |
| virtual bool | postAddComponentsInit () |
| Calls lookupAndCacheProcessSR() and initProcessSR() | |
| virtual DtString | type () const |
| Returns a string identifies the class type of component. | |
| virtual void | tick () |
| Calculate new kinematic state. | |
| virtual void | setTurretArtPart (DtArtPartType turretArtPart) |
| virtual DtArtPartType | turretArtPart () const |
| virtual void | setMaxSlewRate (DtReal maxSlewRate) |
| virtual DtReal | maxSlewRate () const |
| virtual void | initProcessSR () |
| Sets the art part type and slew rate in myProcessState from the DtSimArtPartDescriptor. | |
Static Public Member Functions | |
| static DtSimComponent * | creator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| (const DtString&,DtVrfObject*,DtSimManager*, | |
Protected Member Functions | |
| virtual bool | createPorts () |
| Creates the slew port. | |
| virtual void | lookupAndCacheProcessSR () |
This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in
myProcessState. | |
| DtTurretActuatorComponent () | |
| default constructor; not implemented | |
| DtTurretActuatorComponent (const DtTurretActuatorComponent &orig) | |
| copy constructor; not implemented | |
| const DtTurretActuatorComponent & | operator= (const DtTurretActuatorComponent &orig) |
| assignment operator; not implemented | |
Protected Attributes | |
| const DtTurretComponentDescriptor * | myTurretComponentDescriptor |
| DtVrfTurretedBalGunPSR * | myProcessState |
| Pointer to a process state repository used to store state data associated with this component. | |
| bool | myRotation360 |
| Cache for the condition for 360 rotation, which is hasFixedAzimuth = false and leftLimit = rightLimit (all info from turretComponentDescriptor) | |
| DtReal | myLeftSlewLimit |
| Local copies of the parameters in the turret descriptor, conditioned to be between 0 and 2pi. | |
| DtReal | myRightSlewLimit |
Ports and Port Groups | |
| DtConstrainedAnalogInputPort * | mySlewPort |
| Input Port Name: slew Input Port Description: -1.0 indicates maximum left slew, 1.0 indicates maximum right slew Input Port Range: -1. | |
DtTurretActuatorComponent provides a simple model of a rotating turret that knows how to drive the articulating parts objects of the local state repository.
End User Description: The turret actuator updates the articulated part specified in its component descriptor, based on slew data it receives. It expects an input (via a mySlewPort) of a slew amount between -1. and +1.
Developer Description: The tick() function first checks to see if dT is 0.0. If it is, it just returns. Otherwise, it looks up the DtArticulatedPartStateRepository object kept by the entity to maintain state for the turret using DtAttachmentManager::findPartByType with the turret art part type from the process state repository as the argument. The current angle of the turret (with respect to whatever is it attached to) is retrieved from the DtArticulatedPartStateRepository which represents the turret by going through the kinematic state to get the "psi" component of the parent orientation. The slewRate to use is calculated using: the value on the slew port * myMaxSlewRate The new turret angle is calculated as: the current angle + (slew rate * dT) The angle is then constrained to be between 0.0 and 2 * PI using the VR-Link utility function DtModPerLo(). The new angle is then stored in the kinematic state of the rotating body.
Uses Descriptor Type: DtTurretComponentDescriptor
| DtTurretActuatorComponent::DtTurretActuatorComponent | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual DtTurretActuatorComponent::~DtTurretActuatorComponent | ( | ) | [virtual] |
destructor
| DtTurretActuatorComponent::DtTurretActuatorComponent | ( | ) | [protected] |
default constructor; not implemented
| DtTurretActuatorComponent::DtTurretActuatorComponent | ( | const DtTurretActuatorComponent & | orig | ) | [protected] |
copy constructor; not implemented
| virtual bool DtTurretActuatorComponent::postAddComponentsInit | ( | ) | [virtual] |
Calls lookupAndCacheProcessSR() and initProcessSR()
Reimplemented from DtSimComponent.
| virtual DtString DtTurretActuatorComponent::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.
Reimplemented from DtSimComponent.
| virtual void DtTurretActuatorComponent::tick | ( | ) | [virtual] |
Calculate new kinematic state.
Reimplemented from DtSimComponent.
| virtual void DtTurretActuatorComponent::setTurretArtPart | ( | DtArtPartType | turretArtPart | ) | [virtual] |
| virtual DtArtPartType DtTurretActuatorComponent::turretArtPart | ( | ) | const [virtual] |
| virtual void DtTurretActuatorComponent::setMaxSlewRate | ( | DtReal | maxSlewRate | ) | [virtual] |
| virtual DtReal DtTurretActuatorComponent::maxSlewRate | ( | ) | const [virtual] |
| virtual void DtTurretActuatorComponent::initProcessSR | ( | ) | [virtual] |
Sets the art part type and slew rate in myProcessState from the DtSimArtPartDescriptor.
| static DtSimComponent* DtTurretActuatorComponent::creator | ( | const DtString & | name, |
| DtVrfObject * | owner, | ||
| DtSimManager * | simManager, | ||
| DtComponentDescriptor * | desc = 0, |
||
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) | [static] |
(const DtString&,DtVrfObject*,DtSimManager*,
| name | Reader writer name of this component. |
| owner | The DtVrfObject that owns this component |
| simManager | The simulation manager (provides access to terrain, message interface, simulation clock). |
| desc | The component descriptor used to initialize this component. |
| parentRegistry | Pointer to the parent reader writer registry (the containing object that reads/writes this object). |
| virtual bool DtTurretActuatorComponent::createPorts | ( | ) | [protected, virtual] |
Creates the slew port.
Reimplemented from DtSimComponent.
| virtual void DtTurretActuatorComponent::lookupAndCacheProcessSR | ( | ) | [protected, virtual] |
This function looks up a process state repository in the process state repository manager by name, and caches a pointer to it in
The name (if it exists) is given in the component descriptor (DtComponentDescriptor::processStateRepositoryName). If the name does not exist, it uses the appropriate default name defined in procSRTypes.h. Another component is responsible for creating and destroying the process state repository.
| const DtTurretActuatorComponent& DtTurretActuatorComponent::operator= | ( | const DtTurretActuatorComponent & | orig | ) | [protected] |
assignment operator; not implemented
Input Port Name: slew
Input Port Description: -1.0 indicates maximum left slew, 1.0 indicates maximum right slew
Input Port Range: -1.
to 1.
Input Port Default Value:
Input Group Parent:
const DtTurretComponentDescriptor* DtTurretActuatorComponent::myTurretComponentDescriptor [protected] |
Pointer to a process state repository used to store state data associated with this component.
This process state repository is shared with other components. Another component is responsible for creating and destroying the process state repository. This state is saved and restored as part of a scenario (or checkpoint).
bool DtTurretActuatorComponent::myRotation360 [protected] |
Cache for the condition for 360 rotation, which is hasFixedAzimuth = false and leftLimit = rightLimit (all info from turretComponentDescriptor)
DtReal DtTurretActuatorComponent::myLeftSlewLimit [protected] |
Local copies of the parameters in the turret descriptor, conditioned to be between 0 and 2pi.
DtReal DtTurretActuatorComponent::myRightSlewLimit [protected] |