![]() |
VR-Forces 5.0.1 Developer's Guide
|
This example extends the CIS generic attack/strike fixed-wing entity (SU-25 1) to have a radar warning receiver.
It also adds a reactive behavior to the plane, such that when its radar warning receiver detects a radar, the entity moves to a designated safe location. The safe location is a control point positioned out of range of the radar threat. Once it has reached the safe location, it resumes the task it was executing (if any).
The radarWarnRx example demonstrates how to add a new sensor component and connect it to controller components. It adds the following new capabilities and behaviors to existing entities in VR-Forces:
VR-Forces provides a basic emitter, DtEmitterComponent (emitterComp.h), so we can derive our radar sensor from this component. Anytime you create a new component, you have to provide the following member items in your new class:
The radar warning receiver class, DtSimpleRadarWarningReceiver (simpleRadar- WarnRx.h), needs to detect the emissions and notify any interested controllers that it has detected one or more radars. In this example it merely checks for anything sending out emissions within a 5 Km radius. The class has a VR-Link DtReflectedEmitterSystem- List data member, myReflectedEmitterList, which it uses to gain knowledge of all entities generating emission PDUs over the network
If it finds any, it extracts the host ID of the emitter and places that host ID on an emitter list port. The radar warning receiver uses the existing DtEntityListOutputPort class to communicate the identity of the set of radars it has detected in the current tick. It will ultimately be connected to the radar warning response controller that will receive the data on the emitter list port (a list of detected radars) and use that information to drive its behavior
As a provider of data (the list of detected emitters), the DtSimpleRadarWarningReceiver has a DtEntityListPort data member, myEmitterListPort. It is responsible for creating and setting values on the port. Each tick, it does the following:
The new controller component, DtSimpleRadarWarningResponse (simpleRdrWrnResp.h), provides a simple response when it receives a warning from the radar warning receiver. It attempts to move toward a waypoint named Safe Haven, if an object by that name exists in the simulation.
The controller for handling the reaction to a threat detected by the radar warning receiver is intended for a fixed-wing entity. All of the movement-related controllers for fixed-wing aircraft are derived from DtFixedWingPilotController, so we derive from that class for our new controller. Among other things, we inherit the ports required to control a DtFixedWingActuatorComponent, the actuator used by the F-16 entity.
Like the sensor components created in “Creating the New Sensor Components,” previously in this example, the following member functions must be implemented for the component to function correctly within the component architecture:
The string returned by the type() function is the key into the component factory that VR-Forces uses to instantiate new components. Please see compTypes.h for the set of string types for VR-Forces component classes.
We need to connect the radar warning receiver sensor to the radar warning response controller. As a consumer of data, the radar warning response class has a DtEntityListInputPort member variable, myEmitterListPort, through which it receives the identity of any detected radars (generated by the radar warning receiver). We override createPorts() to instantiate the input port member and add it to our list of input ports. The name of the port, emitter-list, identifies the port when connecting components to one another in the object parameter database. Similarly, in the sensor controller, we override create- Ports() to create its output port member variable, myEmitterListPort, also with the name emitter-list. These two components are connected to one another through these ports by name, in the object parameter database entry.
To implement the reactive behavior in DtSimpleRadarWarningResponse, we override the tick() function to perform the following:
To get your new sensor and controller components into VR-Forces you must register the creators with the component factory. The function DtInitializeVrfPlugin in plugin.cxx demonstrates how to do this.
Now that we have incorporated the new components into the application, we need to configure specific entities to use the new components. We also want to add a new configuration parameter to our radar warning receiver called emitter-detection-range. This indicates the range at which emitters will be detected. This is done by creating a new descriptor for the radar warning receiver. We will call this descriptor radar-warn-receiver-descriptor and add our new parameter to it.
In this example, we extended the CIS generic attack/strike fixed-wing entity (SU-25 1) with the new radar warning receiver and corresponding response controller.
;;
;; Entry for CIS generic attack/strike fixed wing platform
;;
(CIS-attack-strike-fixed-wing-platform
(parameter-type "fixed-wing-entity-param")
...
(sensors
. . .
(simple-radar-warning-rx
;; Use the new descriptor type
(component-descriptor-type "radar-warn-receiver-descriptor")
;; This identifies the class type to create for this sensor. It
;; should match the string returned by
;; DtRadarWarningReceiver::type().
(component-type "simple-radar-warning-receiver")
(emitter-detection-range 5000.0)
...
)
)
...
) ;; end US-attack-strike-fixed-wing-entity
In the fixed-wing-fighter-jet.sysdef file:
(controllers
. . .
;;
;; Add our new controller component
;;
(simple-radar-warning-reaction-controller
(component-descriptor-type "fixed-wing-pilot-controllerdescriptor")
(component-type "simple-radar-warning-response")
(attached-to-list )
(min-tick-period -1.000000)
(min-tick-period-variance -1.000000)
(process-state-repository-name "")
(process-state-repository-type "")
(max-turnrate-cutoff-angle 0.523600)
; Additional parameters for the descriptor class we're using
...
)
)
(actuators
. . .
) ;; end actuators
(connections
. . .
;; Configure new controller inputs (emitter-list) to be system
;;inputs
(connect system:emitter-list
simple-radar-warning-reaction-controller:emitter-list)
;; Connect the new controller to the fixed wing actuator
(connect simple-radar-warning-reaction-controller:
fixed-wing-control flight-kinematics:fixed-wing-control)
. . .
) ;; end connections
A modified object parameter database (configured with the new components) is in ./data/simulationModelSets/developer_toolkit_examples/radarWarnRx/vrfSim/Radar-WarnRx.opd.
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application
This example demonstrates how add a new kind of behavior, detect and react to a perceived threat.
The sensors and behaviors implemented in this example are not realistic. The purpose of the example is to show how and where you would incorporate your own algorithms and models into VR-Forces.
An example scenario demonstrating the new behaviors is in ./examples/RadarWarnRx/scenario/RadarWarnRx.scn. The scenario loads an object parameters database that configures the CIS generic attack/strike fixed-wing entity with new sensor and behavior components. The example contains a single CIS generic attack/strike fixed-wing entity. The entity has a plan that contains a task to move-to waypoint Alpha. As it moves toward the waypoint, it comes within detection range of the radar. When it comes into range, it reacts by moving to a safe location (a control point named Safe Haven). Upon reaching the control point, it resumes its original task to move toward waypoint Alpha.
The Radar Warning example demonstrates the following:
When adding a new sim component that will be added as part of a new system, it is also recommended that you create a Simulation Object Editor plugin so that the SOE will know how to read and write the configuration for the new sim component. The Radar Warn Editor example is related to this example and shows to to register the new sim components with the SOE.
In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.
To view the behavior:
| DtSimpleRadarWarningReceiver | This subclass of DtSimComponent will check to see if there are any emitter systems in the area that could sense a fixed wing. |
| DtSimpleRadarWarningResponse | This subclass of DtFixedWingPilotController will fly away from a radar installation if signalled to do so by the DtSimpleRadarWarningReceiver. |
| DtRadarWarningReceiverDescriptor | This subclass of DtComponentDescriptor allows for the specification of new attributes for this sensor, in this case the maximum detection range of emitters. |