SensorGimbal
(For high level concepts about how to use Lua to write scripted tasks, please see VR-Forces User's Guide.)
The SensorGimbal is a class of Lua object that represents a sensor that rotates on a gimbal. The functions defined below are methods available for this class of object.
Lua scripts cannot create SensorGimbals, but if an entity uses a sensor gimbal controller and actuator in one of its systems, then the sensor gimbal is automatically defined for the script. Each sensor gimbal is identified by its Sensor ID as configured for the entity's sensor in the the Simulation Object Editor. Some functions are accessed through the controller and some are accessed through the actuator. To access controller functions, the suffix "_Controller" must be added to the Sensor ID. To access actuator functions, the suffix "_Actuator" must be added to the Sensor ID.
Example: The MQ-9 Reaper UAV has a gimbaled visual sensor with a Sensor ID of "Gimbaled Sensor". Thus a Lua script could call
Gimbaled_Sensor_Actuator:gimbalLimitHit()
to query the actuator to find if the gimbal limit of the sensor has been hit. Note also that the space in the Sensor ID has been replaced with an underscore.
To make the gimbaled sensor point at something, use vrf:executeSetData("set-aim-sensor"...) and indicate a mode to track a target, point at a location, scan, or point at an angle. See the Set Catalog.
Function List
| gimbalLimitHit () | Determines if a sensor gimbal has reached a rotation limit. |
| isUnderManualControl () | Determines if the sensor gimbal is currently under manual user control. |
| lookingAt () | Returns the location that the sensor is looking at (as it it were lasing) |
| mode () | Gets a string representing the current mode of the sensor gimbal. |
| orientation () | Gets the azimuth and elevation of sensor. |
Functions
- gimbalLimitHit ()
-
Determines if a sensor gimbal has reached a rotation limit. This is a sensor gimbal actuator function.
Usage:
hitLimit =
_Actuator:gimbalLimitHit() Return value:
- True if sensor gimbal is in a position where it has reached its rotation limit on at least one axis.
- isUnderManualControl ()
-
Determines if the sensor gimbal is currently under manual user control. This is a sensor gimbal controller function.
Usage:
manuallyControlled =
_Controller:isUnderManualControl() Return value:
- True if the sensor is under manual control, i.e. when the sensor is currently being controlled via a joystick or when a user has the Sensor Control dialog open and has operated any of its controls.
- lookingAt ()
-
Returns the location that the sensor is looking at (as it it were lasing)
Usage:
spotting =
_Controller:lookingAt() Return value:
- DtLocation3D of the location the sensor is looking at
- mode ()
-
Gets a string representing the current mode of the sensor gimbal. This is a sensor gimbal controller function.
Usage:
gimbalMode =
_Controller:mode() Return value:
- A string indicating the current gimbal mode. Expected values are "FIXED ANGLE", "TRACK ENTITY", "TRACK LOCATION", "SCAN", "MANUAL", and "UNKNOWN".
- orientation ()
-
Gets the azimuth and elevation of sensor. Use the pitch of the entity to get the pitch
Usage:
azimuth, elevation =
_Controller:orientation() Return value:
- Two return values for azimuth and elevation. Return values are in radians
