VR-Forces 5.1.1 Lua Function Documentation

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 sensor that rotates on a gimbal. It is represented in Lua by two classes, sensor-gimbal-controller and a sensor-gimbal-actuator. The functions defined below are methods available for objects of these classes.

Lua scripts cannot create SensorGimbals, but if an entity uses a sensor gimbal controller and actuator in one of its systems (e.g. the Gimbaled Visual Sensor system), then sensor gimbal controller and actuator objects are automatically defined for the Lua API for that entity. Each sensor gimbal is identified by its Sensor ID as configured for the entity's sensor system in the the Simulation Object Editor. The name of the controller object is the Sensor ID with '.' and ' ' replaced by '_', and the string "_Controller" added to the end. Similarly, the name of the actuator object is the Sensor ID with '.' and ' ' replaced by '_', and the string "_Actuator" added to the end. 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.

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 if 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 if it were lasing). Controller function.

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. Controller function.

Usage:

    azimuth, elevation = _Controller:orientation()

Return value:

    Two return values for azimuth and elevation. Return values are in radians.

Copyright© 2024 MAK Technologies, Inc. All rights reserved.