Skip to navigation

Create an asset

Publish cameras, radars, and uncrewed vehicles as assets with health, sensors, and motion

An asset is an entity under your control, or under the control of another operator or system. Assets may accept tasks such as search or tracking.

This page explains the components every asset publishes, then walks through three common integrations:

  • Camera sensor: A fixed camera that pans, so its field of view changes over time.
  • Multi-panel radar: One radar system with four panels, each reporting its own state and coverage.
  • UxV with onboard sensors: A moving uncrewed vehicle (UxV) that reports its attitude and carries a gimbaled camera and an RF sensor.

Before you begin

gRPC authentication

These gRPC examples authenticate with a static environment token attached as request metadata. If you are using OAuth 2.0 client credentials instead, set up the token refresh module before running the examples on this page.

Common asset components

In addition to the required components, every asset publishes the following components:

ontology
OntologyRequired

Set template to TEMPLATE_ASSET. Set platform_type to a recognized platform type, such as CAMERA, RADAR, or UAV, so Lattice renders the right icon.

mil_view
MilViewRequired

Set the disposition and environment of the asset. Assets are generally under the control of friendly forces, so set disposition to DISPOSITION_FRIENDLY, and set environment to where the asset operates, such as ENVIRONMENT_LAND or ENVIRONMENT_AIR.

location
LocationRequired

Set the asset’s position. Moving assets also report velocity and attitude. For more information, see Orientation conventions.

health
HealthRequired

Report whether the asset is reachable and operating correctly. All assets, including sensors, effectors, and platforms, publish health. Alongside the top-level health_status, report one entry in components for each subsystem, such as a battery or a radar panel. Lattice sets connection_status to CONNECTION_STATUS_ONLINE while the asset publishes updates, and to CONNECTION_STATUS_OFFLINE after one minute without one. Health reporting is exclusive to assets: tracks and geo-entities never report health.

sensors
Sensors

Declare each sensor the asset carries in sensors. Give every sensor a stable sensor_id, a sensor_type, an operational_state, and at least one field of view, so Lattice can render its coverage. Tracks that the sensor produces refer back to the same sensor_id. For more information, see Create a track.

task_catalog
TaskCatalog

List the tasks the asset accepts in task_catalog. For more information, see Integrate an agent.

Set expiry_time in the future, and republish the asset before it lapses. Republish at least every 30 seconds so the asset stays online, and whenever its state changes. Set provenance.source_update_time to the time of each update, because Lattice uses it to detect changes.

Altitude references

The position component supports the following altitude references, specified in meters. Populate the references available to your integration:

altitude_hae_meters
DoubleValue

The entity’s height above the World Geodetic System 1984 (WGS84) ellipsoid.

altitude_agl_meters
DoubleValue

The entity’s height above the terrain. This is typically measured with a radar altimeter or by using a terrain tile set lookup.

altitude_asf_meters
DoubleValue

The entity’s height above the sea floor.

pressure_depth_meters
DoubleValue

The depth of the entity from the surface of the water.

Lattice doesn’t support Mean Sea Level (MSL) references, such as EGM-96 and EGM-08. If the only altitude reference available to your integration is MSL, convert it to Height Above Ellipsoid (HAE) and populate the altitude_hae_meters field. To apply this conversion, use an open-source library, such as EGM96 for Go.

Orientation conventions

Lattice describes direction with quaternions in a local East-North-Up (ENU) frame centered on the entity. Most hardware reports direction as compass angles instead, so every example on this page converts angles to quaternions. Keep the following conventions in mind:

  • Vehicle attitude: location.attitude_enu rotates the entity’s body frame into ENU. The body frame is front-left-up (FLU): +X points out of the nose, +Y to the left, and +Z up.
  • Sensor pointing: fields_of_view.center_ray_pose.orientation rotates the sensor frame, whose +X axis is the boresight, into ENU. The orientation is absolute, not relative to the vehicle, so a sensor mounted on a moving vehicle must combine the vehicle’s attitude with the mount angles.
  • Compass angles: A compass heading or azimuth is measured clockwise from true north, while ENU yaw is measured counterclockwise from east. Convert a heading to yaw with yaw = π/2 − heading.
  • Heading priority: If an entity sets both attitude_enu and velocity_enu, Lattice uses attitude_enu to render its heading.

Each example builds orientations from three elementary rotations, where angles are in radians and quaternions are written as (x, y, z, w):

RotationAboutQuaternion
qz(a)Up (yaw)(0, 0, sin(a/2), cos(a/2))
qy(a)Left (pitch)(0, sin(a/2), 0, cos(a/2))
qx(a)Forward (roll)(sin(a/2), 0, 0, cos(a/2))

Because positive rotation about the left axis tips the nose down, a nose-up pitch or an upward elevation e uses qy(−e). To point a boresight at azimuth az and elevation el, multiply qz(π/2 − az) ⊗ qy(−el). For example, an azimuth of 90° (due east) and an elevation of 0° produce the identity quaternion (0, 0, 0, 1), and an azimuth of 0° (due north) produces (0, 0, 0.7071, 0.7071).

Example: Camera sensor

A fixed electro-optical (EO) camera is one of the most common Lattice assets. In this example, a camera on a mast pans between east and south. As the camera pans, the integration updates the camera’s field of view, so operators can see where it looks in the Lattice UI. You can later attach the camera’s video feed to the same entity. For more information, see Create streams.

1

Define the entity

Define the camera’s components. At one instant, while the camera points southeast, you get the following entity object:

camera.json
{
"entityId": "e1374ef0-2aaa-5b42-89bf-17f16ec18402",
"description": "EO camera streaming live video",
"isLive": true,
"createdTime": "2026-11-06T19:00:00Z",
"expiryTime": "2026-11-06T19:01:00Z",
"aliases": {
"name": "Camera 01",
"alternateIds": [
{ "id": "camera-01", "type": "ALT_ID_TYPE_SERIAL_NUMBER" }
]
},
"ontology": {
"template": "TEMPLATE_ASSET",
"platformType": "CAMERA"
},
"milView": {
"disposition": "DISPOSITION_FRIENDLY",
"environment": "ENVIRONMENT_LAND",
"nationality": "NATIONALITY_UNITED_STATES_OF_AMERICA"
},
"location": {
"position": {
"latitudeDegrees": 36.66633492530301,
"longitudeDegrees": -116.9117674522639,
"altitudeHaeMeters": 780.0
}
},
"health": {
"connectionStatus": "CONNECTION_STATUS_ONLINE",
"healthStatus": "HEALTH_STATUS_HEALTHY",
"components": [
{
"id": "camera-01-eo",
"name": "EO camera sensor",
"health": "HEALTH_STATUS_HEALTHY"
}
],
"activeAlerts": []
},
"sensors": {
"sensors": [
{
"sensorId": "camera-01-eo",
"sensorType": "SENSOR_TYPE_CAMERA",
"operationalState": "OPERATIONAL_STATE_OPERATIONAL",
"sensorDescription": "EO camera, H.264",
"fieldsOfView": [
{
"centerRayPose": {
"pos": {
"latitudeDegrees": 36.66633492530301,
"longitudeDegrees": -116.9117674522639,
"altitudeHaeMeters": 780.0
},
"orientation": { "x": 0.01669, "y": 0.0403, "z": -0.38232, "w": 0.923 }
},
"horizontalFov": 1.204,
"verticalFov": 0.954,
"range": 150.0,
"mode": "SENSOR_MODE_SEARCH"
}
]
}
]
},
"provenance": {
"integrationName": "lattice_video_integration",
"dataType": "camera_video_feed",
"sourceUpdateTime": "2026-11-06T19:00:00Z"
}
}

In this example:

  • The entity ID is a UUIDv5 derived from the camera’s name, camera-01, so the camera keeps the same entity ID every time the integration restarts.
  • aliases.alternateIds records the serial number, so other systems can cross-reference the camera.
  • health.components reports the camera sensor itself, using the same ID as the sensor.
  • The integration republishes every 5 seconds with a 60-second expiryTime, so the camera disappears shortly after the integration stops.
2

Point the field of view

The sensors component tells Lattice where the camera looks. Set horizontalFov and verticalFov in radians from the lens’s current zoom, and range in meters. Place centerRayPose.pos at the camera, and set centerRayPose.orientation from the camera’s pan and tilt.

Pan-tilt cameras usually report pan as a compass azimuth and tilt as an elevation angle, so the example converts both into an ENU quaternion with the qz(π/2 − az) ⊗ qy(−el) rotation from Orientation conventions. A second helper simulates the pan sweep:

// This Go example uses the Lattice REST SDK (lattice-sdk-go) to publish a camera asset entity.
// Attaching a video to an asset requires the asset to already exist as a Lattice entity, so
// publish the camera on a heartbeat before starting an ingress stream.
package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
const (
cameraName = "camera-01"
integrationName = "lattice_video_integration"
dataType = "camera_video_feed"
publishInterval = 5 * time.Second
entityExpiryTtlSecs = 60
// Camera mount position.
cameraLatitudeDegrees = 36.66633492530301
cameraLongitudeDegrees = -116.9117674522639
cameraAltitudeHaeMeters = 780.0
// The camera pans back and forth between these compass azimuths (degrees clockwise
// from true north), moving panStepDegrees on every update, at a fixed tilt.
panMinAzimuthDegrees = 90.0
panMaxAzimuthDegrees = 180.0
panStepDegrees = 3.0
tiltElevationDegrees = -5.0
)
// pointingToQuaternionEnu converts a compass azimuth and elevation into the ENU quaternion
// (x, y, z, w) that rotates the sensor frame, whose +X axis is the boresight, into ENU.
//
// The azimuth is degrees clockwise from true north and the elevation is degrees above the
// horizon. The result is qz(pi/2 - azimuth) * qy(-elevation), which is already unit-normalized.
func pointingToQuaternionEnu(azimuthDeg, elevationDeg float64) *Lattice.Quaternion {
halfYaw := (math.Pi/2 - azimuthDeg*math.Pi/180) / 2
halfPitch := -elevationDeg * math.Pi / 180 / 2
return &Lattice.Quaternion{
X: Lattice.Float64(-math.Sin(halfYaw) * math.Sin(halfPitch)),
Y: Lattice.Float64(math.Cos(halfYaw) * math.Sin(halfPitch)),
Z: Lattice.Float64(math.Sin(halfYaw) * math.Cos(halfPitch)),
W: Lattice.Float64(math.Cos(halfYaw) * math.Cos(halfPitch)),
}
}
// panAzimuth returns the camera's azimuth after the given number of updates, sweeping
// back and forth between the minimum and maximum azimuth.
func panAzimuth(updateCount int) float64 {
span := panMaxAzimuthDegrees - panMinAzimuthDegrees
travel := math.Mod(float64(updateCount)*panStepDegrees, 2*span)
if travel > span {
travel = 2*span - travel
}
return panMinAzimuthDegrees + travel
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes.
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Stable entity ID derived from the camera's hardware identifier so the same
// physical camera maps to the same Lattice entity across restarts.
entityId := uuid.NewSHA1(uuid.NameSpaceURL, []byte(cameraName)).String()
creationTime := time.Now().UTC()
// Continuously publish the entity so it does not expire.
for updateCount := 0; ; updateCount++ {
latestTimestamp := time.Now().UTC()
// Pan the camera and recompute where it points on every update.
azimuthDeg := panAzimuth(updateCount)
ctx := context.Background()
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("EO camera streaming live video"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Camera 01"),
AlternateIDs: []*Lattice.AlternateID{
{
ID: Lattice.String(cameraName),
Type: Lattice.AlternateIDTypeAltIDTypeSerialNumber.Ptr(),
},
},
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
// ExpiryTime is set in the future and paired with a shorter publish loop,
// so the entity stays alive as long as the publisher runs.
ExpiryTime: Lattice.Time(latestTimestamp.Add(entityExpiryTtlSecs * time.Second)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("CAMERA"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentLand.Ptr(),
Nationality: Lattice.MilViewNationalityNationalityUnitedStatesOfAmerica.Ptr(),
},
// Overall classification of the entity's data.
DataClassification: &Lattice.Classification{
Default: &Lattice.ClassificationInformation{
Level: Lattice.ClassificationInformationLevelClassificationLevelsUnclassified.Ptr(),
},
},
Location: &Lattice.Location{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(cameraLatitudeDegrees),
LongitudeDegrees: Lattice.Float64(cameraLongitudeDegrees),
AltitudeHaeMeters: Lattice.Float64(cameraAltitudeHaeMeters),
},
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String(integrationName),
DataType: Lattice.String(dataType),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: Lattice.HealthHealthStatusHealthStatusHealthy.Ptr(),
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
// Per-subsystem health rolls up into the entity's overall
// health_status; report at least the camera sensor itself.
Components: []*Lattice.ComponentHealth{
{
ID: Lattice.String("camera-01-eo"),
Name: Lattice.String("EO camera sensor"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
},
},
// Declare the camera as a sensor so Lattice can render the sensor cone.
Sensors: &Lattice.Sensors{
Sensors: []*Lattice.Sensor{
{
SensorID: Lattice.String("camera-01-eo"),
SensorType: Lattice.SensorSensorTypeSensorTypeCamera.Ptr(),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
SensorDescription: Lattice.String("EO camera, H.264"),
FieldsOfView: []*Lattice.FieldOfView{
{
CenterRayPose: &Lattice.EntityManagerPose{
// The center ray pose is an absolute ENU orientation
// positioned at the camera.
Pos: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(cameraLatitudeDegrees),
LongitudeDegrees: Lattice.Float64(cameraLongitudeDegrees),
AltitudeHaeMeters: Lattice.Float64(cameraAltitudeHaeMeters),
},
Orientation: pointingToQuaternionEnu(azimuthDeg, tiltElevationDegrees),
},
HorizontalFov: Lattice.Float64(1.204), // ~69 deg (typical EO horizontal FoV)
VerticalFov: Lattice.Float64(0.954), // ~54.6 deg (typical EO vertical FoV)
Range: Lattice.Float64(150.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
},
},
TaskCatalog: &Lattice.TaskCatalog{
TaskDefinitions: []*Lattice.TaskDefinition{
{TaskSpecificationURL: Lattice.String("type.googleapis.com/<org>.<package>.<version>.<task>")},
},
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Printf("Publishing asset with entity ID: %s\n", entityId)
}
time.Sleep(publishInterval)
}
}

Keep sensorId stable across updates. Tracks that the camera produces refer to it in their trackedBy relationship.

3

Publish the entity

On every update, read the camera’s current pan, recompute the orientation, and publish the entity with the PublishEntity API method:

// This Go example uses the Lattice REST SDK (lattice-sdk-go) to publish a camera asset entity.
// Attaching a video to an asset requires the asset to already exist as a Lattice entity, so
// publish the camera on a heartbeat before starting an ingress stream.
package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
const (
cameraName = "camera-01"
integrationName = "lattice_video_integration"
dataType = "camera_video_feed"
publishInterval = 5 * time.Second
entityExpiryTtlSecs = 60
// Camera mount position.
cameraLatitudeDegrees = 36.66633492530301
cameraLongitudeDegrees = -116.9117674522639
cameraAltitudeHaeMeters = 780.0
// The camera pans back and forth between these compass azimuths (degrees clockwise
// from true north), moving panStepDegrees on every update, at a fixed tilt.
panMinAzimuthDegrees = 90.0
panMaxAzimuthDegrees = 180.0
panStepDegrees = 3.0
tiltElevationDegrees = -5.0
)
// pointingToQuaternionEnu converts a compass azimuth and elevation into the ENU quaternion
// (x, y, z, w) that rotates the sensor frame, whose +X axis is the boresight, into ENU.
//
// The azimuth is degrees clockwise from true north and the elevation is degrees above the
// horizon. The result is qz(pi/2 - azimuth) * qy(-elevation), which is already unit-normalized.
func pointingToQuaternionEnu(azimuthDeg, elevationDeg float64) *Lattice.Quaternion {
halfYaw := (math.Pi/2 - azimuthDeg*math.Pi/180) / 2
halfPitch := -elevationDeg * math.Pi / 180 / 2
return &Lattice.Quaternion{
X: Lattice.Float64(-math.Sin(halfYaw) * math.Sin(halfPitch)),
Y: Lattice.Float64(math.Cos(halfYaw) * math.Sin(halfPitch)),
Z: Lattice.Float64(math.Sin(halfYaw) * math.Cos(halfPitch)),
W: Lattice.Float64(math.Cos(halfYaw) * math.Cos(halfPitch)),
}
}
// panAzimuth returns the camera's azimuth after the given number of updates, sweeping
// back and forth between the minimum and maximum azimuth.
func panAzimuth(updateCount int) float64 {
span := panMaxAzimuthDegrees - panMinAzimuthDegrees
travel := math.Mod(float64(updateCount)*panStepDegrees, 2*span)
if travel > span {
travel = 2*span - travel
}
return panMinAzimuthDegrees + travel
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes.
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Stable entity ID derived from the camera's hardware identifier so the same
// physical camera maps to the same Lattice entity across restarts.
entityId := uuid.NewSHA1(uuid.NameSpaceURL, []byte(cameraName)).String()
creationTime := time.Now().UTC()
// Continuously publish the entity so it does not expire.
for updateCount := 0; ; updateCount++ {
latestTimestamp := time.Now().UTC()
// Pan the camera and recompute where it points on every update.
azimuthDeg := panAzimuth(updateCount)
ctx := context.Background()
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("EO camera streaming live video"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Camera 01"),
AlternateIDs: []*Lattice.AlternateID{
{
ID: Lattice.String(cameraName),
Type: Lattice.AlternateIDTypeAltIDTypeSerialNumber.Ptr(),
},
},
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
// ExpiryTime is set in the future and paired with a shorter publish loop,
// so the entity stays alive as long as the publisher runs.
ExpiryTime: Lattice.Time(latestTimestamp.Add(entityExpiryTtlSecs * time.Second)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("CAMERA"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentLand.Ptr(),
Nationality: Lattice.MilViewNationalityNationalityUnitedStatesOfAmerica.Ptr(),
},
// Overall classification of the entity's data.
DataClassification: &Lattice.Classification{
Default: &Lattice.ClassificationInformation{
Level: Lattice.ClassificationInformationLevelClassificationLevelsUnclassified.Ptr(),
},
},
Location: &Lattice.Location{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(cameraLatitudeDegrees),
LongitudeDegrees: Lattice.Float64(cameraLongitudeDegrees),
AltitudeHaeMeters: Lattice.Float64(cameraAltitudeHaeMeters),
},
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String(integrationName),
DataType: Lattice.String(dataType),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: Lattice.HealthHealthStatusHealthStatusHealthy.Ptr(),
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
// Per-subsystem health rolls up into the entity's overall
// health_status; report at least the camera sensor itself.
Components: []*Lattice.ComponentHealth{
{
ID: Lattice.String("camera-01-eo"),
Name: Lattice.String("EO camera sensor"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
},
},
// Declare the camera as a sensor so Lattice can render the sensor cone.
Sensors: &Lattice.Sensors{
Sensors: []*Lattice.Sensor{
{
SensorID: Lattice.String("camera-01-eo"),
SensorType: Lattice.SensorSensorTypeSensorTypeCamera.Ptr(),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
SensorDescription: Lattice.String("EO camera, H.264"),
FieldsOfView: []*Lattice.FieldOfView{
{
CenterRayPose: &Lattice.EntityManagerPose{
// The center ray pose is an absolute ENU orientation
// positioned at the camera.
Pos: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(cameraLatitudeDegrees),
LongitudeDegrees: Lattice.Float64(cameraLongitudeDegrees),
AltitudeHaeMeters: Lattice.Float64(cameraAltitudeHaeMeters),
},
Orientation: pointingToQuaternionEnu(azimuthDeg, tiltElevationDegrees),
},
HorizontalFov: Lattice.Float64(1.204), // ~69 deg (typical EO horizontal FoV)
VerticalFov: Lattice.Float64(0.954), // ~54.6 deg (typical EO vertical FoV)
Range: Lattice.Float64(150.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
},
},
TaskCatalog: &Lattice.TaskCatalog{
TaskDefinitions: []*Lattice.TaskDefinition{
{TaskSpecificationURL: Lattice.String("type.googleapis.com/<org>.<package>.<version>.<task>")},
},
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Printf("Publishing asset with entity ID: %s\n", entityId)
}
time.Sleep(publishInterval)
}
}

Republish the field of view whenever the camera pans, tilts, or zooms, so the cone in the Lattice UI matches where the camera points.

Example: Multi-panel radar

A ground radar often consists of several fixed panels that together cover 360 degrees. Model panels mounted on the same platform, or operating together as one radar system, as one asset entity, and list each panel as a sensor in sensors.sensors. Use separate asset entities only when radars are far apart or operate as independent systems.

This example publishes a radar with four panels facing north, east, south, and west. The integration reports each panel’s state and coverage, and one panel periodically reports reduced capability.

1

Define the entity

Define the radar’s components. At one instant, while Panel 3 reports reduced capability, you get the following entity object. Panels 2 to 4 follow the same shape as Panel 1:

radar.json
{
"entityId": "1146af7c-80a0-58f7-ba81-06d2f1abcdaa",
"description": "Four-panel radar asset",
"isLive": true,
"createdTime": "2026-11-06T18:55:00Z",
"expiryTime": "2026-11-06T19:05:00Z",
"aliases": { "name": "Radar 1" },
"ontology": { "template": "TEMPLATE_ASSET", "platformType": "RADAR" },
"milView": { "disposition": "DISPOSITION_FRIENDLY", "environment": "ENVIRONMENT_LAND" },
"location": {
"position": { "latitudeDegrees": 34.0, "longitudeDegrees": -118.0, "altitudeHaeMeters": 100.0 }
},
"health": {
"connectionStatus": "CONNECTION_STATUS_ONLINE",
"healthStatus": "HEALTH_STATUS_WARN",
"components": [
{
"id": "panel-1",
"name": "Panel 1",
"health": "HEALTH_STATUS_HEALTHY",
"messages": [{ "status": "HEALTH_STATUS_HEALTHY", "message": "Panel 1 is operating normally." }]
},
{
"id": "panel-3",
"name": "Panel 3",
"health": "HEALTH_STATUS_WARN",
"messages": [{ "status": "HEALTH_STATUS_WARN", "message": "Panel 3 is operating with reduced capability." }]
},
{
"id": "radar-controller",
"name": "Radar controller",
"health": "HEALTH_STATUS_HEALTHY"
}
],
"activeAlerts": []
},
"sensors": {
"sensors": [
{
"sensorId": "panel-1",
"sensorDescription": "Panel 1",
"sensorType": "SENSOR_TYPE_RADAR",
"operationalState": "OPERATIONAL_STATE_OPERATIONAL",
"fieldsOfView": [
{
"fovId": 1,
"centerRayPose": {
"pos": { "latitudeDegrees": 34.0, "longitudeDegrees": -118.0, "altitudeHaeMeters": 100.0 },
"orientation": { "x": 0.06163, "y": -0.06163, "z": 0.70442, "w": 0.70442 }
},
"horizontalFov": 1.5708,
"verticalFov": 0.5236,
"range": 10000,
"mode": "SENSOR_MODE_SEARCH"
}
]
},
{
"sensorId": "panel-3",
"sensorDescription": "Panel 3",
"sensorType": "SENSOR_TYPE_RADAR",
"operationalState": "OPERATIONAL_STATE_DEGRADED",
"fieldsOfView": [
{
"fovId": 1,
"centerRayPose": {
"pos": { "latitudeDegrees": 34.0, "longitudeDegrees": -118.0, "altitudeHaeMeters": 100.0 },
"orientation": { "x": -0.06163, "y": -0.06163, "z": -0.70442, "w": 0.70442 }
},
"horizontalFov": 1.5708,
"verticalFov": 0.5236,
"range": 10000,
"mode": "SENSOR_MODE_SEARCH"
}
]
}
]
},
"provenance": {
"integrationName": "your_integration_name",
"dataType": "radar_asset",
"sourceUpdateTime": "2026-11-06T19:00:00Z"
}
}
2

Describe each panel

Give each panel a stable sensorId, a short human-readable name in sensorDescription, and sensorType set to SENSOR_TYPE_RADAR. Keep the sensorId values unchanged across updates: tracks and tasks refer to individual panels by these IDs.

Each panel’s field of view starts at the radar’s position and points along the panel’s boresight. The example defines the panels as a table of IDs, names, and boresight azimuths, and converts each azimuth and a 10-degree upward tilt into a quaternion:

// This Go example publishes a four-panel radar as one asset entity. Each panel
// is a sensor on the asset with its own field of view.
package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
const (
radarName = "radar-01"
integrationName = "your_integration_name"
dataType = "radar_asset"
publishInterval = 5 * time.Second
entityExpiry = 5 * time.Minute
// Fixed radar position.
radarLat = 34.0
radarLon = -118.0
radarHae = 100.0
// Elevation of every panel boresight, in degrees above the horizon.
panelElevationDeg = 10.0
// Panel 3 flips between OPERATIONAL and DEGRADED every this many updates.
degradedFlipEvery = 3
)
// panel describes one radar panel and the compass azimuth its boresight faces.
type panel struct {
id string
description string
azimuthDeg float64
}
var panels = []panel{
{"panel-1", "Panel 1", 0},
{"panel-2", "Panel 2", 90},
{"panel-3", "Panel 3", 180},
{"panel-4", "Panel 4", 270},
}
// pointingToQuaternionEnu returns the ENU orientation that points a sensor's
// +X boresight at a compass azimuth (degrees clockwise from true north) and an
// elevation (degrees above the horizon). The quaternion is
// qz(pi/2 - azimuth) * qy(-elevation) using the Hamilton product, so an
// azimuth of 90 and an elevation of 0 gives the identity.
func pointingToQuaternionEnu(azimuthDeg, elevationDeg float64) *Lattice.Quaternion {
halfYaw := (math.Pi/2 - azimuthDeg*math.Pi/180) / 2
halfPitch := -elevationDeg * math.Pi / 180 / 2
sz, cz := math.Sin(halfYaw), math.Cos(halfYaw)
sy, cy := math.Sin(halfPitch), math.Cos(halfPitch)
return &Lattice.Quaternion{
X: Lattice.Float64(-sz * sy),
Y: Lattice.Float64(cz * sy),
Z: Lattice.Float64(sz * cy),
W: Lattice.Float64(cz * cy),
}
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Stable entity ID derived from the radar's name so the same radar maps to
// the same Lattice entity across restarts.
entityId := uuid.NewSHA1(uuid.NameSpaceURL, []byte(radarName)).String()
creationTime := time.Now().UTC()
// Continuously publish the entity so it does not expire.
for update := 0; ; update++ {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
// Simulate telemetry: panel-3 alternates between OPERATIONAL and
// DEGRADED. A real integration maps hardware telemetry to these
// states instead of using a timer.
panel3Degraded := (update/degradedFlipEvery)%2 == 1
// Build one sensor and one health component per panel. The panel ID
// links the two.
sensors := []*Lattice.Sensor{}
components := []*Lattice.ComponentHealth{}
anyDegraded := false
for _, p := range panels {
degraded := p.id == "panel-3" && panel3Degraded
anyDegraded = anyDegraded || degraded
operationalState := Lattice.SensorOperationalStateOperationalStateOperational
panelHealth := Lattice.ComponentHealthHealthHealthStatusHealthy
messageStatus := Lattice.ComponentMessageStatusHealthStatusHealthy
message := p.description + " is operating normally."
if degraded {
operationalState = Lattice.SensorOperationalStateOperationalStateDegraded
panelHealth = Lattice.ComponentHealthHealthHealthStatusWarn
messageStatus = Lattice.ComponentMessageStatusHealthStatusWarn
message = p.description + " is operating with reduced capability."
}
sensors = append(sensors, &Lattice.Sensor{
SensorID: Lattice.String(p.id),
SensorDescription: Lattice.String(p.description),
SensorType: Lattice.SensorSensorTypeSensorTypeRadar.Ptr(),
OperationalState: operationalState.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
FovID: Lattice.Int(1),
CenterRayPose: &Lattice.EntityManagerPose{
Pos: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(radarLat),
LongitudeDegrees: Lattice.Float64(radarLon),
AltitudeHaeMeters: Lattice.Float64(radarHae),
},
Orientation: pointingToQuaternionEnu(p.azimuthDeg, panelElevationDeg),
},
HorizontalFov: Lattice.Float64(math.Pi / 2),
VerticalFov: Lattice.Float64(math.Pi / 6),
Range: Lattice.Float64(10000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
})
components = append(components, &Lattice.ComponentHealth{
ID: Lattice.String(p.id),
Name: Lattice.String(p.description),
Health: panelHealth.Ptr(),
Messages: []*Lattice.ComponentMessage{
{Status: messageStatus.Ptr(), Message: Lattice.String(message)},
},
UpdateTime: Lattice.Time(latestTimestamp),
})
}
components = append(components, &Lattice.ComponentHealth{
ID: Lattice.String("radar-controller"),
Name: Lattice.String("Radar controller"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
Messages: []*Lattice.ComponentMessage{
{
Status: Lattice.ComponentMessageStatusHealthStatusHealthy.Ptr(),
Message: Lattice.String("Radar controller is operating normally."),
},
},
UpdateTime: Lattice.Time(latestTimestamp),
})
// The entity is WARN when any panel is degraded.
healthStatus := Lattice.HealthHealthStatusHealthStatusHealthy
if anyDegraded {
healthStatus = Lattice.HealthHealthStatusHealthStatusWarn
}
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Four-panel radar asset"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Radar 1"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
ExpiryTime: Lattice.Time(latestTimestamp.Add(entityExpiry)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("RADAR"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentLand.Ptr(),
},
Location: &Lattice.Location{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(radarLat),
LongitudeDegrees: Lattice.Float64(radarLon),
AltitudeHaeMeters: Lattice.Float64(radarHae),
},
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String(integrationName),
DataType: Lattice.String(dataType),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: healthStatus.Ptr(),
Components: components,
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
},
// Publish all panels as sensors on one asset entity.
Sensors: &Lattice.Sensors{Sensors: sensors},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Printf("Publishing asset with entity ID: %s\n", entityId)
}
time.Sleep(publishInterval)
}
}

One panel can have several fields of view, such as a broad SENSOR_MODE_SEARCH volume and a narrower SENSOR_MODE_TRACK beam. Give each one a fovId that stays stable and unique within the panel, rather than creating extra sensor entries. Remove coverage that is no longer active when the panel’s state or mode changes.

3

Report each panel's state

Report each panel’s current sensing state in operationalState, based on hardware telemetry:

operationalStateWhen to report it
OPERATIONAL_STATE_OPERATIONALThe panel is fully functional and sensing.
OPERATIONAL_STATE_DEGRADEDThe panel is sensing with reduced capability, such as reduced calibration quality.
OPERATIONAL_STATE_DENIEDThe panel is sensing but is being actively denied, such as by jamming.
OPERATIONAL_STATE_OFFSensing is deliberately disabled, such as after an operator stops transmission.
OPERATIONAL_STATE_NON_OPERATIONALThe panel can’t operate because of a fault, rather than an intentional off command.
OPERATIONAL_STATE_INVALIDDon’t publish this value. It’s the protobuf default, not an operating state.

A degraded or denied panel is still sensing, so don’t report it as off. Mirror each panel’s condition in a matching health.components entry, and roll the worst condition up into the top-level healthStatus. In the example, the radar reports HEALTH_STATUS_WARN while any panel is degraded.

4

Publish the entity

On every update, map telemetry to each panel’s state, rebuild the sensors and health components, and publish the entity with the PublishEntity API method. The example simulates the telemetry with a timer:

// This Go example publishes a four-panel radar as one asset entity. Each panel
// is a sensor on the asset with its own field of view.
package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
const (
radarName = "radar-01"
integrationName = "your_integration_name"
dataType = "radar_asset"
publishInterval = 5 * time.Second
entityExpiry = 5 * time.Minute
// Fixed radar position.
radarLat = 34.0
radarLon = -118.0
radarHae = 100.0
// Elevation of every panel boresight, in degrees above the horizon.
panelElevationDeg = 10.0
// Panel 3 flips between OPERATIONAL and DEGRADED every this many updates.
degradedFlipEvery = 3
)
// panel describes one radar panel and the compass azimuth its boresight faces.
type panel struct {
id string
description string
azimuthDeg float64
}
var panels = []panel{
{"panel-1", "Panel 1", 0},
{"panel-2", "Panel 2", 90},
{"panel-3", "Panel 3", 180},
{"panel-4", "Panel 4", 270},
}
// pointingToQuaternionEnu returns the ENU orientation that points a sensor's
// +X boresight at a compass azimuth (degrees clockwise from true north) and an
// elevation (degrees above the horizon). The quaternion is
// qz(pi/2 - azimuth) * qy(-elevation) using the Hamilton product, so an
// azimuth of 90 and an elevation of 0 gives the identity.
func pointingToQuaternionEnu(azimuthDeg, elevationDeg float64) *Lattice.Quaternion {
halfYaw := (math.Pi/2 - azimuthDeg*math.Pi/180) / 2
halfPitch := -elevationDeg * math.Pi / 180 / 2
sz, cz := math.Sin(halfYaw), math.Cos(halfYaw)
sy, cy := math.Sin(halfPitch), math.Cos(halfPitch)
return &Lattice.Quaternion{
X: Lattice.Float64(-sz * sy),
Y: Lattice.Float64(cz * sy),
Z: Lattice.Float64(sz * cy),
W: Lattice.Float64(cz * cy),
}
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Stable entity ID derived from the radar's name so the same radar maps to
// the same Lattice entity across restarts.
entityId := uuid.NewSHA1(uuid.NameSpaceURL, []byte(radarName)).String()
creationTime := time.Now().UTC()
// Continuously publish the entity so it does not expire.
for update := 0; ; update++ {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
// Simulate telemetry: panel-3 alternates between OPERATIONAL and
// DEGRADED. A real integration maps hardware telemetry to these
// states instead of using a timer.
panel3Degraded := (update/degradedFlipEvery)%2 == 1
// Build one sensor and one health component per panel. The panel ID
// links the two.
sensors := []*Lattice.Sensor{}
components := []*Lattice.ComponentHealth{}
anyDegraded := false
for _, p := range panels {
degraded := p.id == "panel-3" && panel3Degraded
anyDegraded = anyDegraded || degraded
operationalState := Lattice.SensorOperationalStateOperationalStateOperational
panelHealth := Lattice.ComponentHealthHealthHealthStatusHealthy
messageStatus := Lattice.ComponentMessageStatusHealthStatusHealthy
message := p.description + " is operating normally."
if degraded {
operationalState = Lattice.SensorOperationalStateOperationalStateDegraded
panelHealth = Lattice.ComponentHealthHealthHealthStatusWarn
messageStatus = Lattice.ComponentMessageStatusHealthStatusWarn
message = p.description + " is operating with reduced capability."
}
sensors = append(sensors, &Lattice.Sensor{
SensorID: Lattice.String(p.id),
SensorDescription: Lattice.String(p.description),
SensorType: Lattice.SensorSensorTypeSensorTypeRadar.Ptr(),
OperationalState: operationalState.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
FovID: Lattice.Int(1),
CenterRayPose: &Lattice.EntityManagerPose{
Pos: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(radarLat),
LongitudeDegrees: Lattice.Float64(radarLon),
AltitudeHaeMeters: Lattice.Float64(radarHae),
},
Orientation: pointingToQuaternionEnu(p.azimuthDeg, panelElevationDeg),
},
HorizontalFov: Lattice.Float64(math.Pi / 2),
VerticalFov: Lattice.Float64(math.Pi / 6),
Range: Lattice.Float64(10000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
})
components = append(components, &Lattice.ComponentHealth{
ID: Lattice.String(p.id),
Name: Lattice.String(p.description),
Health: panelHealth.Ptr(),
Messages: []*Lattice.ComponentMessage{
{Status: messageStatus.Ptr(), Message: Lattice.String(message)},
},
UpdateTime: Lattice.Time(latestTimestamp),
})
}
components = append(components, &Lattice.ComponentHealth{
ID: Lattice.String("radar-controller"),
Name: Lattice.String("Radar controller"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
Messages: []*Lattice.ComponentMessage{
{
Status: Lattice.ComponentMessageStatusHealthStatusHealthy.Ptr(),
Message: Lattice.String("Radar controller is operating normally."),
},
},
UpdateTime: Lattice.Time(latestTimestamp),
})
// The entity is WARN when any panel is degraded.
healthStatus := Lattice.HealthHealthStatusHealthStatusHealthy
if anyDegraded {
healthStatus = Lattice.HealthHealthStatusHealthStatusWarn
}
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Four-panel radar asset"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Radar 1"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
ExpiryTime: Lattice.Time(latestTimestamp.Add(entityExpiry)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("RADAR"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentLand.Ptr(),
},
Location: &Lattice.Location{
Position: &Lattice.Position{
LatitudeDegrees: Lattice.Float64(radarLat),
LongitudeDegrees: Lattice.Float64(radarLon),
AltitudeHaeMeters: Lattice.Float64(radarHae),
},
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String(integrationName),
DataType: Lattice.String(dataType),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: healthStatus.Ptr(),
Components: components,
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
},
// Publish all panels as sensors on one asset entity.
Sensors: &Lattice.Sensors{Sensors: sensors},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Printf("Publishing asset with entity ID: %s\n", entityId)
}
time.Sleep(publishInterval)
}
}

Example: UxV with onboard sensors

A UxV, such as a drone, reports how it moves as well as what its sensors see. In this example, a small uncrewed aircraft flies a wide circle at 20 meters per second while it carries two sensors:

  • An EO/IR camera on a gimbal that sweeps from side to side, relative to the aircraft’s nose.
  • An RF direction finder fixed to the airframe, which listens in every direction.

Because each field of view is an absolute ENU orientation, the integration combines the aircraft’s attitude with each sensor’s mount angles on every update.

1

Define the entity

Define the vehicle’s components. At one instant, while the aircraft flies on a course of 30 degrees and climbs, you get the following entity object:

uxv.json
{
"entityId": "UNIQUE_ENTITY_ID",
"description": "Friendly drone asset",
"isLive": true,
"createdTime": "2026-11-06T19:00:00Z",
"expiryTime": "2026-11-06T20:00:10Z",
"aliases": { "name": "Drone 1" },
"ontology": { "template": "TEMPLATE_ASSET", "platformType": "UAV" },
"milView": { "disposition": "DISPOSITION_FRIENDLY", "environment": "ENVIRONMENT_AIR" },
"location": {
"position": {
"latitudeDegrees": 50.91570322,
"longitudeDegrees": 0.79280022,
"altitudeHaeMeters": 317.3205
},
"velocityEnu": { "e": 10.0, "n": 17.3205, "u": 1.0472 },
"attitudeEnu": { "x": 0.05907, "y": 0.00395, "z": 0.50033, "w": 0.86381 }
},
"health": {
"connectionStatus": "CONNECTION_STATUS_ONLINE",
"healthStatus": "HEALTH_STATUS_HEALTHY",
"components": [
{
"id": "battery-0",
"name": "Battery",
"health": "HEALTH_STATUS_HEALTHY",
"messages": [{ "status": "HEALTH_STATUS_HEALTHY", "message": "Battery at 87% charge." }]
},
{ "id": "eoir-1", "name": "EO/IR gimbal", "health": "HEALTH_STATUS_HEALTHY" },
{ "id": "rf-1", "name": "RF direction finder", "health": "HEALTH_STATUS_HEALTHY" }
],
"activeAlerts": []
},
"sensors": {
"sensors": [
{
"sensorId": "eoir-1",
"sensorType": "SENSOR_TYPE_CAMERA",
"operationalState": "OPERATIONAL_STATE_OPERATIONAL",
"sensorDescription": "EO/IR gimbal",
"fieldsOfView": [
{
"centerRayPose": {
"pos": { "latitudeDegrees": 50.91570322, "longitudeDegrees": 0.79280022, "altitudeHaeMeters": 317.3205 },
"orientation": { "x": 0.02939, "y": 0.19768, "z": 0.13889, "w": 0.96993 }
},
"horizontalFov": 0.5,
"verticalFov": 0.3,
"range": 3000.0,
"mode": "SENSOR_MODE_SEARCH"
}
]
},
{
"sensorId": "rf-1",
"sensorType": "SENSOR_TYPE_RF",
"operationalState": "OPERATIONAL_STATE_OPERATIONAL",
"sensorDescription": "RF direction finder",
"fieldsOfView": [
{
"centerRayPose": {
"pos": { "latitudeDegrees": 50.91570322, "longitudeDegrees": 0.79280022, "altitudeHaeMeters": 317.3205 },
"orientation": { "x": 0.05907, "y": 0.00395, "z": 0.50033, "w": 0.86381 }
},
"horizontalFov": 6.28319,
"verticalFov": 1.0,
"range": 10000.0,
"mode": "SENSOR_MODE_SEARCH"
}
]
}
]
},
"taskCatalog": {
"taskDefinitions": [
{ "taskSpecificationUrl": "type.googleapis.com/anduril.tasks.v2.VisualId" },
{ "taskSpecificationUrl": "type.googleapis.com/anduril.tasks.v2.Investigate" }
]
},
"provenance": {
"integrationName": "your_integration_name",
"dataType": "your_data_type",
"sourceUpdateTime": "2026-11-06T19:00:10Z"
}
}

The taskCatalog advertises the tasks the vehicle accepts. For more information, see Integrate an agent.

2

Report motion

A moving asset reports its position, velocity, and attitude in location:

location.velocity_enu
ENU

The vehicle’s velocity in meters per second, in east, north, and up components. Autopilots usually report ground speed s and course c instead, which convert as e = s · sin(c) and n = s · cos(c). Set u to the climb rate.

location.attitude_enu
Quaternion

The rotation from the vehicle’s front-left-up body frame into ENU. Build it from the autopilot’s heading, pitch, and roll as qz(π/2 − heading) ⊗ qy(−pitch) ⊗ qx(roll), where pitch is positive nose up and roll is positive right wing down.

The example defines helpers for both rotations: attitudeToQuaternionEnu builds the vehicle’s attitude, and gimbalToQuaternionEnu combines that attitude with a sensor’s mount angles. If your autopilot reports only velocity, the fallback helpers derive a heading from the velocity vector instead:

package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
// Flight model constants.
const (
tickSeconds = 1.0 // Time between updates, in seconds.
groundSpeed = 20.0 // Ground speed, in meters per second.
turnRateDegSec = 3.0 // Constant right turn, in degrees per second.
baseAltHae = 300.0 // Mean altitude above the WGS84 ellipsoid, in meters.
altAmplitude = 20.0 // Altitude oscillation amplitude, in meters.
altPeriod = 60.0 // Altitude oscillation period, in seconds.
gimbalPanAmp = 45.0 // Gimbal pan sweep, in degrees either side of the nose.
gimbalPeriod = 40.0 // Gimbal pan sweep period, in seconds.
gimbalTiltDeg = -20.0 // Gimbal tilt, in degrees. Negative looks down.
gravity = 9.81 // Gravitational acceleration, in meters per second squared.
metersPerDeg = 111320.0
// Set to false to derive the attitude from velocity alone.
autopilotReportsAttitude = true
)
// quat is a quaternion in (x, y, z, w) order.
type quat struct{ x, y, z, w float64 }
// multiply returns the Hamilton product a ⊗ b.
func (a quat) multiply(b quat) quat {
return quat{
x: a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y,
y: a.w*b.y - a.x*b.z + a.y*b.w + a.z*b.x,
z: a.w*b.z + a.x*b.y - a.y*b.x + a.z*b.w,
w: a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z,
}
}
// Elementary rotations about the x, y, and z axes, in radians.
func qx(a float64) quat { return quat{x: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qy(a float64) quat { return quat{y: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qz(a float64) quat { return quat{z: math.Sin(a / 2), w: math.Cos(a / 2)} }
// attitudeToQuaternionEnu converts a compass heading (degrees clockwise from
// north), pitch (positive nose up), and roll (positive right wing down) into
// the attitude_enu quaternion. attitude_enu rotates the body frame (FLU) into
// the ENU world frame.
func attitudeToQuaternionEnu(headingDeg, pitchDeg, rollDeg float64) quat {
yaw := math.Pi/2 - headingDeg*math.Pi/180
return qz(yaw).multiply(qy(-pitchDeg * math.Pi / 180)).multiply(qx(rollDeg * math.Pi / 180))
}
// gimbalToQuaternionEnu composes the body attitude with a gimbal pointing
// relative to the nose. Pan is positive to the right and tilt is positive up.
// The result rotates the sensor frame (+X is the boresight) into ENU.
func gimbalToQuaternionEnu(body quat, panDeg, tiltDeg float64) quat {
mount := qz(-panDeg * math.Pi / 180).multiply(qy(-tiltDeg * math.Pi / 180))
return body.multiply(mount)
}
// velocityToYawEnu converts an ENU velocity vector into a yaw angle, in
// radians. Fallback when your autopilot reports only velocity.
func velocityToYawEnu(velocityEast, velocityNorth float64) float64 {
return math.Atan2(velocityNorth, velocityEast)
}
// yawToQuaternionEnu converts a yaw angle into an attitude_enu quaternion with
// zero pitch and roll. Fallback when your autopilot reports only velocity.
func yawToQuaternionEnu(yawRad float64) quat {
return qz(yawRad)
}
// toQuaternion converts a quat into the SDK type.
func toQuaternion(q quat) *Lattice.Quaternion {
return &Lattice.Quaternion{
X: Lattice.Float64(q.x),
Y: Lattice.Float64(q.y),
Z: Lattice.Float64(q.z),
W: Lattice.Float64(q.w),
}
}
// flightState is the simulated state of the vehicle.
type flightState struct {
lat, lon, altHae float64 // Position, in degrees and meters.
courseDeg float64 // Direction of travel, degrees clockwise from north.
velEast, velNorth, climb float64 // Velocity, in meters per second.
pitchDeg, rollDeg float64 // Pitch is positive nose up. Roll is positive right wing down.
elapsed float64 // Seconds since start.
}
// advanceState moves the simulation forward by dt seconds.
func advanceState(s *flightState, dt float64) {
s.elapsed += dt
// Turn at a constant rate and oscillate the altitude.
s.courseDeg = math.Mod(s.courseDeg+turnRateDegSec*dt, 360)
w := 2 * math.Pi / altPeriod
s.altHae = baseAltHae + altAmplitude*math.Sin(w*s.elapsed)
s.climb = altAmplitude * w * math.Cos(w*s.elapsed)
// Velocity from ground speed, course, and climb rate.
course := s.courseDeg * math.Pi / 180
s.velEast = groundSpeed * math.Sin(course)
s.velNorth = groundSpeed * math.Cos(course)
// Integrate position: meters to degrees, scaling longitude by cos(lat).
s.lat += s.velNorth * dt / metersPerDeg
s.lon += s.velEast * dt / (metersPerDeg * math.Cos(s.lat*math.Pi/180))
// Pitch follows the climb angle. Bank balances the turn: atan(v*omega/g).
s.pitchDeg = math.Atan2(s.climb, groundSpeed) * 180 / math.Pi
s.rollDeg = math.Atan(groundSpeed*turnRateDegSec*math.Pi/180/gravity) * 180 / math.Pi
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Generate a unique ID for the entity
entityId := uuid.New().String()
// Start near the origin, heading north.
state := &flightState{lat: 50.914, lon: 0.792, altHae: baseAltHae}
creationTime := time.Now().UTC()
// Continuously publish the entity
for {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
advanceState(state, tickSeconds)
// Heading equals course because the simulation has no wind.
bodyQuat := attitudeToQuaternionEnu(state.courseDeg, state.pitchDeg, state.rollDeg)
if !autopilotReportsAttitude {
bodyQuat = yawToQuaternionEnu(velocityToYawEnu(state.velEast, state.velNorth))
}
position := func() *Lattice.Position {
return &Lattice.Position{
LatitudeDegrees: Lattice.Float64(state.lat),
LongitudeDegrees: Lattice.Float64(state.lon),
AltitudeHaeMeters: Lattice.Float64(state.altHae),
}
}
// The gimbal sweeps relative to the nose. FieldOfView orientation is
// absolute ENU, so compose it with the body attitude.
gimbalPan := gimbalPanAmp * math.Sin(2*math.Pi*state.elapsed/gimbalPeriod)
gimbalQuat := gimbalToQuaternionEnu(bodyQuat, gimbalPan, gimbalTiltDeg)
batteryPercent := math.Max(87-0.01*state.elapsed, 0)
// Create entity to publish
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Friendly drone asset"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Drone 1"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
ExpiryTime: Lattice.Time(latestTimestamp.Add(1 * time.Hour)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("UAV"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentAir.Ptr(),
},
Location: &Lattice.Location{
Position: position(),
// Velocity in the ENU frame, in meters per second.
VelocityEnu: &Lattice.Enu{
E: Lattice.Float64(state.velEast),
N: Lattice.Float64(state.velNorth),
U: Lattice.Float64(state.climb),
},
// Body-to-ENU attitude. Lattice uses it for heading.
AttitudeEnu: toQuaternion(bodyQuat),
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String("your_integration_name"),
DataType: Lattice.String("your_data_type"),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: Lattice.HealthHealthStatusHealthStatusHealthy.Ptr(),
// Report the health of individual subsystems in components.
// Each component needs a stable ID, a display name, and a
// health status.
Components: []*Lattice.ComponentHealth{
{
ID: Lattice.String("battery-0"),
Name: Lattice.String("Battery"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
Messages: []*Lattice.ComponentMessage{
{
Status: Lattice.ComponentMessageStatusHealthStatusHealthy.Ptr(),
Message: Lattice.String(fmt.Sprintf("Battery at %.0f%% charge.", batteryPercent)),
},
},
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("eoir-1"),
Name: Lattice.String("EO/IR gimbal"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("rf-1"),
Name: Lattice.String("RF direction finder"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
},
// Live list of active alerts for the asset. Remove entries
// when the underlying condition clears; Lattice does not
// filter stale entries automatically.
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
},
// Declare the sensors carried by the asset. Each entry requires a
// stable sensor_id, a sensor_type, and at least one field of view
// so Lattice can render the sensor cone.
Sensors: &Lattice.Sensors{
Sensors: []*Lattice.Sensor{
{
SensorID: Lattice.String("eoir-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeCamera.Ptr(),
SensorDescription: Lattice.String("EO/IR gimbal"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(gimbalQuat),
},
HorizontalFov: Lattice.Float64(0.5),
VerticalFov: Lattice.Float64(0.3),
Range: Lattice.Float64(3000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
{
SensorID: Lattice.String("rf-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeRf.Ptr(),
SensorDescription: Lattice.String("RF direction finder"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
// Body-fixed, forward-facing mount.
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(bodyQuat),
},
HorizontalFov: Lattice.Float64(2 * math.Pi), // Omnidirectional.
VerticalFov: Lattice.Float64(1.0),
Range: Lattice.Float64(10000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
},
},
TaskCatalog: &Lattice.TaskCatalog{
TaskDefinitions: []*Lattice.TaskDefinition{
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.VisualId")},
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.Investigate")},
},
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
// Handle errors
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Println("Publishing asset")
}
// Wait before next request
time.Sleep(1 * time.Second)
}
}

Prefer the autopilot’s own heading over a heading derived from velocity. A velocity-derived heading points along the vehicle’s path, which differs from where the nose points in a crosswind, and is undefined while the vehicle hovers.

3

Point onboard sensors

Compute each sensor’s field of view from the vehicle’s attitude on every update:

  • Body-fixed sensors: A sensor fixed to the airframe and facing forward, such as the RF direction finder, uses the vehicle’s attitude as its orientation.
  • Gimbaled sensors: A sensor on a gimbal combines the attitude with the gimbal’s angles as q_body ⊗ qz(−pan) ⊗ qy(−tilt), where pan is positive to the right of the nose and tilt is positive up.

The following code advances the simulated flight, then converts the vehicle state into velocity, attitude, and sensor orientations:

package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
// Flight model constants.
const (
tickSeconds = 1.0 // Time between updates, in seconds.
groundSpeed = 20.0 // Ground speed, in meters per second.
turnRateDegSec = 3.0 // Constant right turn, in degrees per second.
baseAltHae = 300.0 // Mean altitude above the WGS84 ellipsoid, in meters.
altAmplitude = 20.0 // Altitude oscillation amplitude, in meters.
altPeriod = 60.0 // Altitude oscillation period, in seconds.
gimbalPanAmp = 45.0 // Gimbal pan sweep, in degrees either side of the nose.
gimbalPeriod = 40.0 // Gimbal pan sweep period, in seconds.
gimbalTiltDeg = -20.0 // Gimbal tilt, in degrees. Negative looks down.
gravity = 9.81 // Gravitational acceleration, in meters per second squared.
metersPerDeg = 111320.0
// Set to false to derive the attitude from velocity alone.
autopilotReportsAttitude = true
)
// quat is a quaternion in (x, y, z, w) order.
type quat struct{ x, y, z, w float64 }
// multiply returns the Hamilton product a ⊗ b.
func (a quat) multiply(b quat) quat {
return quat{
x: a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y,
y: a.w*b.y - a.x*b.z + a.y*b.w + a.z*b.x,
z: a.w*b.z + a.x*b.y - a.y*b.x + a.z*b.w,
w: a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z,
}
}
// Elementary rotations about the x, y, and z axes, in radians.
func qx(a float64) quat { return quat{x: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qy(a float64) quat { return quat{y: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qz(a float64) quat { return quat{z: math.Sin(a / 2), w: math.Cos(a / 2)} }
// attitudeToQuaternionEnu converts a compass heading (degrees clockwise from
// north), pitch (positive nose up), and roll (positive right wing down) into
// the attitude_enu quaternion. attitude_enu rotates the body frame (FLU) into
// the ENU world frame.
func attitudeToQuaternionEnu(headingDeg, pitchDeg, rollDeg float64) quat {
yaw := math.Pi/2 - headingDeg*math.Pi/180
return qz(yaw).multiply(qy(-pitchDeg * math.Pi / 180)).multiply(qx(rollDeg * math.Pi / 180))
}
// gimbalToQuaternionEnu composes the body attitude with a gimbal pointing
// relative to the nose. Pan is positive to the right and tilt is positive up.
// The result rotates the sensor frame (+X is the boresight) into ENU.
func gimbalToQuaternionEnu(body quat, panDeg, tiltDeg float64) quat {
mount := qz(-panDeg * math.Pi / 180).multiply(qy(-tiltDeg * math.Pi / 180))
return body.multiply(mount)
}
// velocityToYawEnu converts an ENU velocity vector into a yaw angle, in
// radians. Fallback when your autopilot reports only velocity.
func velocityToYawEnu(velocityEast, velocityNorth float64) float64 {
return math.Atan2(velocityNorth, velocityEast)
}
// yawToQuaternionEnu converts a yaw angle into an attitude_enu quaternion with
// zero pitch and roll. Fallback when your autopilot reports only velocity.
func yawToQuaternionEnu(yawRad float64) quat {
return qz(yawRad)
}
// toQuaternion converts a quat into the SDK type.
func toQuaternion(q quat) *Lattice.Quaternion {
return &Lattice.Quaternion{
X: Lattice.Float64(q.x),
Y: Lattice.Float64(q.y),
Z: Lattice.Float64(q.z),
W: Lattice.Float64(q.w),
}
}
// flightState is the simulated state of the vehicle.
type flightState struct {
lat, lon, altHae float64 // Position, in degrees and meters.
courseDeg float64 // Direction of travel, degrees clockwise from north.
velEast, velNorth, climb float64 // Velocity, in meters per second.
pitchDeg, rollDeg float64 // Pitch is positive nose up. Roll is positive right wing down.
elapsed float64 // Seconds since start.
}
// advanceState moves the simulation forward by dt seconds.
func advanceState(s *flightState, dt float64) {
s.elapsed += dt
// Turn at a constant rate and oscillate the altitude.
s.courseDeg = math.Mod(s.courseDeg+turnRateDegSec*dt, 360)
w := 2 * math.Pi / altPeriod
s.altHae = baseAltHae + altAmplitude*math.Sin(w*s.elapsed)
s.climb = altAmplitude * w * math.Cos(w*s.elapsed)
// Velocity from ground speed, course, and climb rate.
course := s.courseDeg * math.Pi / 180
s.velEast = groundSpeed * math.Sin(course)
s.velNorth = groundSpeed * math.Cos(course)
// Integrate position: meters to degrees, scaling longitude by cos(lat).
s.lat += s.velNorth * dt / metersPerDeg
s.lon += s.velEast * dt / (metersPerDeg * math.Cos(s.lat*math.Pi/180))
// Pitch follows the climb angle. Bank balances the turn: atan(v*omega/g).
s.pitchDeg = math.Atan2(s.climb, groundSpeed) * 180 / math.Pi
s.rollDeg = math.Atan(groundSpeed*turnRateDegSec*math.Pi/180/gravity) * 180 / math.Pi
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Generate a unique ID for the entity
entityId := uuid.New().String()
// Start near the origin, heading north.
state := &flightState{lat: 50.914, lon: 0.792, altHae: baseAltHae}
creationTime := time.Now().UTC()
// Continuously publish the entity
for {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
advanceState(state, tickSeconds)
// Heading equals course because the simulation has no wind.
bodyQuat := attitudeToQuaternionEnu(state.courseDeg, state.pitchDeg, state.rollDeg)
if !autopilotReportsAttitude {
bodyQuat = yawToQuaternionEnu(velocityToYawEnu(state.velEast, state.velNorth))
}
position := func() *Lattice.Position {
return &Lattice.Position{
LatitudeDegrees: Lattice.Float64(state.lat),
LongitudeDegrees: Lattice.Float64(state.lon),
AltitudeHaeMeters: Lattice.Float64(state.altHae),
}
}
// The gimbal sweeps relative to the nose. FieldOfView orientation is
// absolute ENU, so compose it with the body attitude.
gimbalPan := gimbalPanAmp * math.Sin(2*math.Pi*state.elapsed/gimbalPeriod)
gimbalQuat := gimbalToQuaternionEnu(bodyQuat, gimbalPan, gimbalTiltDeg)
batteryPercent := math.Max(87-0.01*state.elapsed, 0)
// Create entity to publish
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Friendly drone asset"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Drone 1"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
ExpiryTime: Lattice.Time(latestTimestamp.Add(1 * time.Hour)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("UAV"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentAir.Ptr(),
},
Location: &Lattice.Location{
Position: position(),
// Velocity in the ENU frame, in meters per second.
VelocityEnu: &Lattice.Enu{
E: Lattice.Float64(state.velEast),
N: Lattice.Float64(state.velNorth),
U: Lattice.Float64(state.climb),
},
// Body-to-ENU attitude. Lattice uses it for heading.
AttitudeEnu: toQuaternion(bodyQuat),
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String("your_integration_name"),
DataType: Lattice.String("your_data_type"),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: Lattice.HealthHealthStatusHealthStatusHealthy.Ptr(),
// Report the health of individual subsystems in components.
// Each component needs a stable ID, a display name, and a
// health status.
Components: []*Lattice.ComponentHealth{
{
ID: Lattice.String("battery-0"),
Name: Lattice.String("Battery"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
Messages: []*Lattice.ComponentMessage{
{
Status: Lattice.ComponentMessageStatusHealthStatusHealthy.Ptr(),
Message: Lattice.String(fmt.Sprintf("Battery at %.0f%% charge.", batteryPercent)),
},
},
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("eoir-1"),
Name: Lattice.String("EO/IR gimbal"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("rf-1"),
Name: Lattice.String("RF direction finder"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
},
// Live list of active alerts for the asset. Remove entries
// when the underlying condition clears; Lattice does not
// filter stale entries automatically.
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
},
// Declare the sensors carried by the asset. Each entry requires a
// stable sensor_id, a sensor_type, and at least one field of view
// so Lattice can render the sensor cone.
Sensors: &Lattice.Sensors{
Sensors: []*Lattice.Sensor{
{
SensorID: Lattice.String("eoir-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeCamera.Ptr(),
SensorDescription: Lattice.String("EO/IR gimbal"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(gimbalQuat),
},
HorizontalFov: Lattice.Float64(0.5),
VerticalFov: Lattice.Float64(0.3),
Range: Lattice.Float64(3000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
{
SensorID: Lattice.String("rf-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeRf.Ptr(),
SensorDescription: Lattice.String("RF direction finder"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
// Body-fixed, forward-facing mount.
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(bodyQuat),
},
HorizontalFov: Lattice.Float64(2 * math.Pi), // Omnidirectional.
VerticalFov: Lattice.Float64(1.0),
Range: Lattice.Float64(10000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
},
},
TaskCatalog: &Lattice.TaskCatalog{
TaskDefinitions: []*Lattice.TaskDefinition{
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.VisualId")},
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.Investigate")},
},
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
// Handle errors
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Println("Publishing asset")
}
// Wait before next request
time.Sleep(1 * time.Second)
}
}
4

Publish the entity

Declare both sensors with their fields of view, and publish the entity with the PublishEntity API method. Publish at the rate your autopilot reports, such as once per second, so the vehicle and its sensor coverage move smoothly on the map:

package main
import (
"context"
"fmt"
"math"
"net/http"
"os"
"time"
Lattice "github.com/anduril/lattice-sdk-go/v5"
"github.com/anduril/lattice-sdk-go/v5/client"
"github.com/anduril/lattice-sdk-go/v5/option"
"github.com/google/uuid"
)
// Flight model constants.
const (
tickSeconds = 1.0 // Time between updates, in seconds.
groundSpeed = 20.0 // Ground speed, in meters per second.
turnRateDegSec = 3.0 // Constant right turn, in degrees per second.
baseAltHae = 300.0 // Mean altitude above the WGS84 ellipsoid, in meters.
altAmplitude = 20.0 // Altitude oscillation amplitude, in meters.
altPeriod = 60.0 // Altitude oscillation period, in seconds.
gimbalPanAmp = 45.0 // Gimbal pan sweep, in degrees either side of the nose.
gimbalPeriod = 40.0 // Gimbal pan sweep period, in seconds.
gimbalTiltDeg = -20.0 // Gimbal tilt, in degrees. Negative looks down.
gravity = 9.81 // Gravitational acceleration, in meters per second squared.
metersPerDeg = 111320.0
// Set to false to derive the attitude from velocity alone.
autopilotReportsAttitude = true
)
// quat is a quaternion in (x, y, z, w) order.
type quat struct{ x, y, z, w float64 }
// multiply returns the Hamilton product a ⊗ b.
func (a quat) multiply(b quat) quat {
return quat{
x: a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y,
y: a.w*b.y - a.x*b.z + a.y*b.w + a.z*b.x,
z: a.w*b.z + a.x*b.y - a.y*b.x + a.z*b.w,
w: a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z,
}
}
// Elementary rotations about the x, y, and z axes, in radians.
func qx(a float64) quat { return quat{x: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qy(a float64) quat { return quat{y: math.Sin(a / 2), w: math.Cos(a / 2)} }
func qz(a float64) quat { return quat{z: math.Sin(a / 2), w: math.Cos(a / 2)} }
// attitudeToQuaternionEnu converts a compass heading (degrees clockwise from
// north), pitch (positive nose up), and roll (positive right wing down) into
// the attitude_enu quaternion. attitude_enu rotates the body frame (FLU) into
// the ENU world frame.
func attitudeToQuaternionEnu(headingDeg, pitchDeg, rollDeg float64) quat {
yaw := math.Pi/2 - headingDeg*math.Pi/180
return qz(yaw).multiply(qy(-pitchDeg * math.Pi / 180)).multiply(qx(rollDeg * math.Pi / 180))
}
// gimbalToQuaternionEnu composes the body attitude with a gimbal pointing
// relative to the nose. Pan is positive to the right and tilt is positive up.
// The result rotates the sensor frame (+X is the boresight) into ENU.
func gimbalToQuaternionEnu(body quat, panDeg, tiltDeg float64) quat {
mount := qz(-panDeg * math.Pi / 180).multiply(qy(-tiltDeg * math.Pi / 180))
return body.multiply(mount)
}
// velocityToYawEnu converts an ENU velocity vector into a yaw angle, in
// radians. Fallback when your autopilot reports only velocity.
func velocityToYawEnu(velocityEast, velocityNorth float64) float64 {
return math.Atan2(velocityNorth, velocityEast)
}
// yawToQuaternionEnu converts a yaw angle into an attitude_enu quaternion with
// zero pitch and roll. Fallback when your autopilot reports only velocity.
func yawToQuaternionEnu(yawRad float64) quat {
return qz(yawRad)
}
// toQuaternion converts a quat into the SDK type.
func toQuaternion(q quat) *Lattice.Quaternion {
return &Lattice.Quaternion{
X: Lattice.Float64(q.x),
Y: Lattice.Float64(q.y),
Z: Lattice.Float64(q.z),
W: Lattice.Float64(q.w),
}
}
// flightState is the simulated state of the vehicle.
type flightState struct {
lat, lon, altHae float64 // Position, in degrees and meters.
courseDeg float64 // Direction of travel, degrees clockwise from north.
velEast, velNorth, climb float64 // Velocity, in meters per second.
pitchDeg, rollDeg float64 // Pitch is positive nose up. Roll is positive right wing down.
elapsed float64 // Seconds since start.
}
// advanceState moves the simulation forward by dt seconds.
func advanceState(s *flightState, dt float64) {
s.elapsed += dt
// Turn at a constant rate and oscillate the altitude.
s.courseDeg = math.Mod(s.courseDeg+turnRateDegSec*dt, 360)
w := 2 * math.Pi / altPeriod
s.altHae = baseAltHae + altAmplitude*math.Sin(w*s.elapsed)
s.climb = altAmplitude * w * math.Cos(w*s.elapsed)
// Velocity from ground speed, course, and climb rate.
course := s.courseDeg * math.Pi / 180
s.velEast = groundSpeed * math.Sin(course)
s.velNorth = groundSpeed * math.Cos(course)
// Integrate position: meters to degrees, scaling longitude by cos(lat).
s.lat += s.velNorth * dt / metersPerDeg
s.lon += s.velEast * dt / (metersPerDeg * math.Cos(s.lat*math.Pi/180))
// Pitch follows the climb angle. Bank balances the turn: atan(v*omega/g).
s.pitchDeg = math.Atan2(s.climb, groundSpeed) * 180 / math.Pi
s.rollDeg = math.Atan(groundSpeed*turnRateDegSec*math.Pi/180/gravity) * 180 / math.Pi
}
func main() {
// Get environment variables
latticeEndpoint := os.Getenv("LATTICE_ENDPOINT")
environmentToken := os.Getenv("ENVIRONMENT_TOKEN")
// Remove sandboxesToken from the following statements if you are not developing on Sandboxes
sandboxesToken := os.Getenv("SANDBOXES_TOKEN")
// Check required environment variables
if latticeEndpoint == "" || environmentToken == "" || sandboxesToken == "" {
fmt.Println("Missing required environment variables")
os.Exit(1)
}
// Initialize headers for sandbox authorization
headers := http.Header{}
headers.Add("Anduril-Sandbox-Authorization", fmt.Sprintf("Bearer %s", sandboxesToken))
// Create the client
LatticeClient := client.NewClient(
option.WithToken(environmentToken),
option.WithBaseURL(fmt.Sprintf("https://%s", latticeEndpoint)),
option.WithHTTPHeader(headers),
)
// Generate a unique ID for the entity
entityId := uuid.New().String()
// Start near the origin, heading north.
state := &flightState{lat: 50.914, lon: 0.792, altHae: baseAltHae}
creationTime := time.Now().UTC()
// Continuously publish the entity
for {
latestTimestamp := time.Now().UTC()
ctx := context.Background()
advanceState(state, tickSeconds)
// Heading equals course because the simulation has no wind.
bodyQuat := attitudeToQuaternionEnu(state.courseDeg, state.pitchDeg, state.rollDeg)
if !autopilotReportsAttitude {
bodyQuat = yawToQuaternionEnu(velocityToYawEnu(state.velEast, state.velNorth))
}
position := func() *Lattice.Position {
return &Lattice.Position{
LatitudeDegrees: Lattice.Float64(state.lat),
LongitudeDegrees: Lattice.Float64(state.lon),
AltitudeHaeMeters: Lattice.Float64(state.altHae),
}
}
// The gimbal sweeps relative to the nose. FieldOfView orientation is
// absolute ENU, so compose it with the body attitude.
gimbalPan := gimbalPanAmp * math.Sin(2*math.Pi*state.elapsed/gimbalPeriod)
gimbalQuat := gimbalToQuaternionEnu(bodyQuat, gimbalPan, gimbalTiltDeg)
batteryPercent := math.Max(87-0.01*state.elapsed, 0)
// Create entity to publish
entity := Lattice.Entity{
EntityID: &entityId,
Description: Lattice.String("Friendly drone asset"),
Aliases: &Lattice.Aliases{
Name: Lattice.String("Drone 1"),
},
IsLive: Lattice.Bool(true),
CreatedTime: Lattice.Time(creationTime),
ExpiryTime: Lattice.Time(latestTimestamp.Add(1 * time.Hour)),
Ontology: &Lattice.Ontology{
Template: Lattice.OntologyTemplateTemplateAsset.Ptr(),
PlatformType: Lattice.String("UAV"),
},
MilView: &Lattice.MilView{
Disposition: Lattice.MilViewDispositionDispositionFriendly.Ptr(),
Environment: Lattice.MilViewEnvironmentEnvironmentAir.Ptr(),
},
Location: &Lattice.Location{
Position: position(),
// Velocity in the ENU frame, in meters per second.
VelocityEnu: &Lattice.Enu{
E: Lattice.Float64(state.velEast),
N: Lattice.Float64(state.velNorth),
U: Lattice.Float64(state.climb),
},
// Body-to-ENU attitude. Lattice uses it for heading.
AttitudeEnu: toQuaternion(bodyQuat),
},
Provenance: &Lattice.Provenance{
IntegrationName: Lattice.String("your_integration_name"),
DataType: Lattice.String("your_data_type"),
SourceUpdateTime: Lattice.Time(latestTimestamp),
},
Health: &Lattice.Health{
ConnectionStatus: Lattice.HealthConnectionStatusConnectionStatusOnline.Ptr(),
HealthStatus: Lattice.HealthHealthStatusHealthStatusHealthy.Ptr(),
// Report the health of individual subsystems in components.
// Each component needs a stable ID, a display name, and a
// health status.
Components: []*Lattice.ComponentHealth{
{
ID: Lattice.String("battery-0"),
Name: Lattice.String("Battery"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
Messages: []*Lattice.ComponentMessage{
{
Status: Lattice.ComponentMessageStatusHealthStatusHealthy.Ptr(),
Message: Lattice.String(fmt.Sprintf("Battery at %.0f%% charge.", batteryPercent)),
},
},
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("eoir-1"),
Name: Lattice.String("EO/IR gimbal"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
{
ID: Lattice.String("rf-1"),
Name: Lattice.String("RF direction finder"),
Health: Lattice.ComponentHealthHealthHealthStatusHealthy.Ptr(),
UpdateTime: Lattice.Time(latestTimestamp),
},
},
// Live list of active alerts for the asset. Remove entries
// when the underlying condition clears; Lattice does not
// filter stale entries automatically.
ActiveAlerts: []*Lattice.Alert{},
UpdateTime: Lattice.Time(latestTimestamp),
},
// Declare the sensors carried by the asset. Each entry requires a
// stable sensor_id, a sensor_type, and at least one field of view
// so Lattice can render the sensor cone.
Sensors: &Lattice.Sensors{
Sensors: []*Lattice.Sensor{
{
SensorID: Lattice.String("eoir-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeCamera.Ptr(),
SensorDescription: Lattice.String("EO/IR gimbal"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(gimbalQuat),
},
HorizontalFov: Lattice.Float64(0.5),
VerticalFov: Lattice.Float64(0.3),
Range: Lattice.Float64(3000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
{
SensorID: Lattice.String("rf-1"),
SensorType: Lattice.SensorSensorTypeSensorTypeRf.Ptr(),
SensorDescription: Lattice.String("RF direction finder"),
OperationalState: Lattice.SensorOperationalStateOperationalStateOperational.Ptr(),
FieldsOfView: []*Lattice.FieldOfView{
{
// Body-fixed, forward-facing mount.
CenterRayPose: &Lattice.EntityManagerPose{
Pos: position(),
Orientation: toQuaternion(bodyQuat),
},
HorizontalFov: Lattice.Float64(2 * math.Pi), // Omnidirectional.
VerticalFov: Lattice.Float64(1.0),
Range: Lattice.Float64(10000.0),
Mode: Lattice.FieldOfViewModeSensorModeSearch.Ptr(),
},
},
},
},
},
TaskCatalog: &Lattice.TaskCatalog{
TaskDefinitions: []*Lattice.TaskDefinition{
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.VisualId")},
{TaskSpecificationURL: Lattice.String("type.googleapis.com/anduril.tasks.v2.Investigate")},
},
},
}
// Publish the entity
_, err := LatticeClient.Entities.PublishEntity(ctx, &entity)
// Handle errors
if err != nil {
fmt.Printf("Error publishing entity: %v\n", err)
} else {
fmt.Println("Publishing asset")
}
// Wait before next request
time.Sleep(1 * time.Second)
}
}

The RF direction finder uses sensorId rf-1. A line-of-bearing track from this sensor refers to it in its trackedBy relationship. For more information, see Create a track.

What’s next?