Flashlight
HoloOcean vehicles have one or more built-in flashlights that are off by default.
Location
The location and number of flashlights vary by vehicle:
Commands
There are two commands available to control the flashlights, TurnOnFlashlightCommand and TurnOffFlashlightCommand. The TurnOnFlashlightCommand allows you to optionally customize several parameters, such as: intensity, beam width, location, rotation, and color.
Note
Flashlight color values use normalized RGB in the range 0.0 – 1.0, not the standard 0 – 255 scale.
Refer to the Python API documentation for full usage details:
Usage Example (for a HoveringAUV/BlueROV2)
In a scenario
config = {
"name": "test_flashlight",
"main_agent": "auv0",
...
"flashlight":[
{
"agent_tag": "auv0",
"flashlight_name": "flashlight1",
"intensity": 10000,
"beam_width": 60,
},
{
"agent_tag": "auv0",
"flashlight_name": "flashlight4",
"intensity": 10000,
"color_G": 0,
"angle_pitch": -30,
},
]
}
Programmatically
with holoocean.make("...") as env:
while True:
if 'o' in pressed_keys:
env.turn_on_flashlight("auv0", "flashlight1")
env.turn_on_flashlight("auv0", "flashlight4", beam_width=80, color_B=0) #Turning on auv0's flashlight 4 with a beam width of 80 degrees and setting the blue color component to zero
if 'p' in pressed_keys:
env.turn_off_flashlight("auv0", "flashlight1")
env.turn_off_flashlight("auv0", "flashlight4")
env.tick()
Note
As of HoloOcean 2.4.0, turn_on_flashlight and turn_off_flashlight take the agent tag as their first argument.
Code written for earlier versions, such as env.turn_off_flashlight("flashlight1"), must be updated to
env.turn_off_flashlight("auv0", "flashlight1"). In scenario configs, agent_tag defaults to auv0 if omitted.
Note
When calling turn_on_flashlight("agent_tag", "flashlight_name") without specifying additional parameters, the system will first look for values defined in the scenario config. If the flashlight was configured there, those values become its defaults. Only if no config values are found will the command fall back to its built-in default parameters.