AtDepth

Check if submarine is at target depth

Usage: Used in 2 task(s)

Lua Implementation

-- At Depth
function evaluate(params)
    local targetDepth = params.target_depth
    local currentDepth = -this:getLocation3D():getAlt()  -- Negative for underwater
    local tolerance = params.tolerance or 5  -- meters

    return math.abs(currentDepth - targetDepth) <= tolerance
end