Skip to content

client/api

import "github.com/viam-labs/motion-tools/client/api"

Package api provides high-level drawing functions for the motion-tools visualizer.

This package contains the drawing API for creating and managing 3D visualizations in a live motion-tools visualizer instance. All functions communicate with the DrawService via Connect-RPC, allowing real-time updates to geometric primitives, 3D models, reference frames, and robot states.

Before using any drawing functions, start the visualizer:

make up

The visualizer will be available at http://localhost:5173.

The package provides high-level drawing functions organized into three categories:

  • Drawings: Visual primitives like lines, points, NURBS curves, and 3D models
  • Transforms: Spatial objects like geometries, frames, and robot states
  • Removal: Clear all or subsets of drawn objects

Each Draw* function accepts an options struct and returns a UUID identifying the drawn object. Calling a Draw* function with an existing ID updates that object in place.

package main

import (
    "github.com/golang/geo/r3"
    "github.com/viam-labs/motion-tools/client/api"
    "github.com/viam-labs/motion-tools/draw"
)

func main() {
    // The visualizer must be running: make up

    // Draw a line
    positions := []r3.Vector{{X: 0, Y: 0, Z: 0}, {X: 100, Y: 100, Z: 100}}
    api.DrawLine(api.DrawLineOptions{
        Name:      "my-line",
        Positions: positions,
    })
}

ErrVisualizerNotRunning is returned when the visualizer is not running.

var ErrVisualizerNotRunning = errors.New("visualizer is not running; start it with `make up`")

func CreateRelationship(options CreateRelationshipOptions) error

CreateRelationship creates or replaces a directed relationship from options.SourceUUID to options.TargetUUID. If a relationship from the same source to the same target already exists, it is replaced in place; otherwise a new relationship is appended to the source entity’s metadata.

Returns ErrVisualizerNotRunning if no visualizer is reachable, or a wrapped RPC error otherwise — most commonly InvalidArgument when source and target UUIDs are equal or malformed, or NotFound when either entity does not exist.

func DeleteRelationship(options DeleteRelationshipOptions) error

DeleteRelationship removes the directed relationship from options.SourceUUID to options.TargetUUID.

Returns ErrVisualizerNotRunning if no visualizer is reachable, or a wrapped RPC error otherwise — most commonly NotFound when the source entity or the matching relationship does not exist, or InvalidArgument when a UUID is missing or malformed.

func DrawFrameSystem(options DrawFrameSystemOptions) ([][]byte, error)

DrawFrameSystem renders every geometry in a reference frame system as a transform, evaluated at the given inputs. Identities are namespaced by ID when set, so calling DrawFrameSystem again with the same ID and matching geometries updates the previous batch in place. Returns one UUID per emitted transform.

Returns ErrVisualizerNotRunning if no visualizer is reachable, the underlying error if frame system geometry resolution fails, or a wrapped RPC error if any AddEntity call fails.

func DrawFrames(options DrawFramesOptions) ([][]byte, error)

DrawFrames sends a batch of reference frames to the visualizer as transforms. A frame with no geometry contributes a single bare-axes transform; a frame with geometry contributes one transform per geometry, labelled “frameName:geometryLabel”. Identities are namespaced by ID when set, so calling DrawFrames again with the same ID and matching frames updates the previous batch in place. Returns one UUID per emitted transform.

Returns ErrVisualizerNotRunning if no visualizer is reachable, the underlying error if any frame’s transform or geometries cannot be resolved, or a wrapped RPC error if any AddEntity call fails.

func DrawGLTF(options DrawGLTFOptions) ([]byte, error)

DrawGLTF reads a GLB/GLTF file from disk, sends its bytes to the visualizer inline, and renders it as a drawing. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, a wrapped filesystem error if FilePath cannot be read, the underlying validation error if the model cannot be constructed (see draw.NewBinaryModelAsset, draw.NewModel — empty file, partial-zero Scale, etc.), or a wrapped RPC error if the AddEntity call fails.

func DrawGeometriesInFrame(options DrawGeometriesInFrameOptions) ([][]byte, error)

DrawGeometriesInFrame sends a batch of geometries to the visualizer as transforms, one transform per geometry. Each transform’s identity is derived from “ID:geometryLabel:parentFrame” (or “geometryLabel:parentFrame” when ID is empty), so calling DrawGeometriesInFrame again with the same ID and a geometry whose label and parent match a previously drawn one updates that entity in place. Returns one UUID per drawn geometry, in input order.

Returns ErrVisualizerNotRunning if no visualizer is reachable, an error if Geometries is empty or the underlying construction fails (see draw.NewDrawnGeometriesInFrame), or a wrapped RPC error if any AddEntity call fails.

func DrawGeometry(options DrawGeometryOptions) ([]byte, error)

DrawGeometry sends a single geometry to the visualizer as a transform. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. Returns the UUID assigned by the server.

Returns ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the geometry cannot be wrapped (see draw.NewDrawnGeometry), or a wrapped RPC error if the AddEntity call fails.

func DrawLine(options DrawLineOptions) ([]byte, error)

DrawLine sends a polyline to the visualizer as a drawing. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the line cannot be constructed (see draw.NewLine — fewer than two positions, mismatched color count, etc.), or a wrapped RPC error if the AddEntity call fails.

func DrawNurbs(options DrawNurbsOptions) ([]byte, error)

DrawNurbs sends a NURBS curve to the visualizer as a drawing. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the curve cannot be constructed (see draw.NewNurbs — empty control points or knots, mismatched lengths, non-positive degree, etc.), or a wrapped RPC error if the AddEntity call fails.

func DrawPointCloud(options DrawPointCloudOptions) ([]byte, error)

DrawPointCloud sends a point cloud to the visualizer as a transform. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. When ChunkSize > 0, the cloud is streamed over multiple RPCs and OnProgress (if provided) is invoked after each chunk. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the cloud cannot be constructed (see draw.NewDrawnPointCloud — negative downscaling threshold, etc.), or a wrapped RPC error if a network call fails.

func DrawPoints(options DrawPointsOptions) ([]byte, error)

DrawPoints sends a set of points to the visualizer as a drawing. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. When ChunkSize > 0, the positions are streamed over multiple RPCs and OnProgress (if provided) is invoked after each chunk. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the points cannot be constructed (see draw.NewPoints — empty positions, mismatched color count, etc.), or a wrapped RPC error if a network call fails.

func DrawPosesAsArrows(options DrawPosesAsArrowsOptions) ([]byte, error)

DrawPosesAsArrows sends a set of poses to the visualizer as a drawing of arrows, one arrow per pose. Passing an ID that already exists updates the previously drawn entity in place; otherwise a new entity is created. Returns the UUID assigned by the server.

Returns an error when Name is not ASCII printable or exceeds 100 characters, ErrVisualizerNotRunning if no visualizer is reachable, the underlying validation error if the arrows cannot be constructed (see draw.NewArrows — mismatched color count), or a wrapped RPC error if the AddEntity call fails.

func DrawRobot(options DrawRobotOptions) ([][]byte, error)

DrawRobot snapshots a robot at its current joint positions and renders every frame-system geometry as a transform, optionally drawing a world state with obstacles alongside it. It is a composite of three lower-level calls — DrawWorldState (when WorldState is non-nil), one DrawGeometriesInFrame per WorldState transform, and one DrawGeometriesInFrame per frame-system geometry group — each invoked with an ID derived from the supplied ID prefix. Returns a flat list of UUIDs in the order they were created.

Returns ErrVisualizerNotRunning if no visualizer is reachable, a wrapped error if the robot’s frame system or inputs cannot be obtained, or any of the underlying Draw* errors if a sub-call fails.

func DrawWorldState(options DrawWorldStateOptions) ([][]byte, error)

DrawWorldState resolves the obstacles in a world state to the world frame and renders each as a transform. Identities are namespaced by ID when set, so calling DrawWorldState again with the same ID and matching obstacles updates the previous batch in place. Returns one UUID per obstacle.

Returns ErrVisualizerNotRunning if no visualizer is reachable, the underlying error if obstacle resolution fails or geometry construction fails (see draw.NewDrawnGeometriesInFrame), or a wrapped RPC error if any AddEntity call fails.

func Record(filename string) error

Record starts recording every subsequent draw-service RPC made by this process to filename, in a custom line-based hex format consumed by Replay. The scene is cleared via RemoveAll before recording begins so the resulting file represents a complete session that can be replayed against an empty scene. Call StopRecord to flush and close the recording.

Returns ErrVisualizerNotRunning if no visualizer is reachable, or a wrapped error if RemoveAll or recorder startup fails.

func RemoveAll() (int32, error)

RemoveAll clears all drawn items from the visualizer. Returns the number of items removed, or an error if the server is not running or the removal fails.

func RemoveDrawings() (int32, error)

RemoveDrawings clears all drawn Drawings from the visualizer. Returns the number of Drawings removed, or an error if the server is not running or the removal fails.

func RemoveTransforms() (int32, error)

RemoveTransforms clears all drawn transforms from the visualizer. Returns the number of transforms removed, or an error if the server is not running or the removal fails.

func Replay(filename string, playbackSpeed float64) error

Replay replays a previously recorded session from filename. Any active recording is stopped first, then RemoveAll clears the current scene to match the recording’s empty starting state. Each recorded RPC is decoded from its hex payload and dispatched against the live draw service.

playbackSpeed scales the inter-RPC sleep durations: 1.0 plays back at real-time, 2.0 plays back at 2× speed, 0.5 plays back at half speed. playbackSpeed must be > 0; values <= 0 cause divisions that produce undefined sleep durations.

Returns ErrVisualizerNotRunning if no visualizer is reachable, a wrapped filesystem error if filename cannot be opened, or a wrapped RPC error if any replayed call fails.

func ResetCamera() error

ResetCamera moves the visualizer’s camera back to the package-default pose (draw.DefaultSceneCamera: an isometric view from [3000, 3000, 3000]mm looking at the origin), without animation. Returns ErrVisualizerNotRunning if no visualizer is reachable, or a wrapped RPC error if the SetScene call fails.

func SetCamera(options SetCameraPoseOptions) error

SetCamera repositions the visualizer’s camera to the given pose. The camera type (perspective or orthographic) is left untouched. Returns ErrVisualizerNotRunning if no visualizer is reachable, or a wrapped RPC error if the SetScene call fails.

func StopRecord()

StopRecord stops the current recording session, flushing and closing the output file. Calling StopRecord when no recording is active is a no-op.

Attrs holds common attributes for all Draw* calls.

type Attrs struct {
    // ShowAxesHelper controls whether the axes helper is shown. Nil defaults to true.
    ShowAxesHelper *bool

    // Invisible controls whether the entity is hidden by default. Nil defaults to false.
    Invisible *bool
}

CreateRelationshipOptions configures a CreateRelationship call.

type CreateRelationshipOptions struct {
    // SourceUUID identifies the entity the relationship originates from.
    SourceUUID []byte

    // TargetUUID identifies the entity the relationship points to.
    TargetUUID []byte

    // Type is a free-form string identifying the relationship kind (e.g. "HoverLink").
    Type string

    // IndexMapping is an optional filtrex expression. Empty defaults to the
    // server's "index" mapping.
    IndexMapping string
}

DeleteRelationshipOptions configures a DeleteRelationship call.

type DeleteRelationshipOptions struct {
    // SourceUUID identifies the entity the relationship originates from.
    SourceUUID []byte

    // TargetUUID identifies the entity the relationship points to.
    TargetUUID []byte
}

DrawFrameSystemOptions configures a DrawFrameSystem call.

type DrawFrameSystemOptions struct {
    // ID is an optional identifier prefix for this batch. When non-empty,
    // each emitted transform's identity is derived from
    // "ID:geometryLabel:parent" rather than the default "geometryLabel:parent",
    // which prevents collisions between frame systems that share geometry
    // labels (e.g., two robots in the same scene). Calling DrawFrameSystem
    // again with the same ID and matching geometries updates the previous
    // batch in place.
    ID  string
    // FrameSystem is the reference frame system to render. Required.
    FrameSystem *referenceframe.FrameSystem
    // Inputs are the frame system inputs (joint positions, etc.) used to
    // resolve each frame's pose.
    Inputs referenceframe.FrameSystemInputs
    // Colors maps frame names to render colors. Frames not present in the
    // map inherit their color from their parent frame, falling back to
    // magenta at the root.
    Colors map[string]draw.Color
}

DrawFramesOptions configures a DrawFrames call.

type DrawFramesOptions struct {
    // ID is an optional identifier prefix for this batch. When non-empty,
    // each emitted transform's identity is derived from
    // "ID:frameName:parent" (or "ID:geometryLabel:parent" for the inner
    // geometry transforms) rather than the default form, which prevents
    // collisions between batches that share frame or geometry names. Calling
    // DrawFrames again with the same ID and matching frames updates the
    // previous batch in place; passing a fresh ID creates a new, independent
    // set of entities.
    ID  string
    // Frames are the reference frames to render. Frames with no geometry are
    // rendered as bare coordinate axes; frames with geometry are rendered as
    // one transform per geometry.
    Frames []referenceframe.Frame
    // Colors maps frame names to render colors. Frames not present in the
    // map fall back to draw.DefaultFrameColor (red).
    Colors map[string]draw.Color
}

DrawGLTFOptions configures a DrawGLTF call.

type DrawGLTFOptions struct {
    // ID is a stable identifier for the entity. When set, calling DrawGLTF
    // again with the same ID updates the existing entity in place; when empty,
    // each call creates a new entity with a freshly generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // Parent is the reference frame the model is attached to. Defaults to
    // "world" when empty.
    Parent string
    // FilePath is the local filesystem path to a .glb or .gltf file. Required.
    // The entire file is read into memory and sent inline with the AddEntity
    // RPC.
    FilePath string
    // Scale is the per-axis scaling factor applied to the model. The zero
    // value is treated as "no scaling specified" and falls back to
    // draw.DefaultModelScale (1, 1, 1). When any field is set, every field
    // must be non-zero, otherwise NewModel rejects the scale.
    Scale r3.Vector
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawGeometriesInFrameOptions configures a DrawGeometriesInFrame call.

type DrawGeometriesInFrameOptions struct {
    // ID is an optional identifier prefix for this batch. When non-empty, each
    // drawn geometry's identity is derived from "ID:label:parent" rather than
    // the default "label:parent", which prevents collisions between batches
    // that share geometry labels and a parent frame (e.g., two robots whose
    // link geometries collide on label). Calling DrawGeometriesInFrame again
    // with the same ID and matching geometries updates the previous batch in
    // place; passing a fresh ID creates a new, independent set of entities.
    ID  string
    // Geometries is the set of geometries to render. Required and must contain
    // at least one geometry.
    Geometries *referenceframe.GeometriesInFrame
    // Colors controls how the geometries are colored. When empty, every
    // geometry is rendered red. Pass one color to share it across all
    // geometries; pass exactly len(Geometries) colors for per-geometry colors;
    // pass any other count to cycle through the slice as a palette.
    Colors []draw.Color
    // DownscalingThreshold reduces the rendered point count for any point-cloud
    // geometries by keeping only points whose mutual distance exceeds this
    // threshold (millimeters). 0 (the default) disables downscaling. Has no
    // effect on non-point-cloud geometries.
    DownscalingThreshold float64
}

DrawGeometryOptions configures a DrawGeometry call.

type DrawGeometryOptions struct {
    // ID is a stable identifier for the entity. When set, calling DrawGeometry
    // again with the same ID updates the existing entity in place; when empty,
    // each call creates a new entity with a freshly generated UUID.
    ID  string
    // Name labels the entity in the visualizer. When empty, the geometry's own
    // label is used.
    Name string
    // Parent is the reference frame the geometry is attached to. Defaults to
    // "world" when empty.
    Parent string
    // Geometry is the spatial geometry to render. Required.
    Geometry spatialmath.Geometry
    // Color is the render color for the geometry.
    Color draw.Color
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawLineOptions configures a DrawLine call.

type DrawLineOptions struct {
    // ID is a stable identifier for the entity. When set, calling DrawLine
    // again with the same ID updates the existing entity in place; when empty,
    // each call creates a new entity with a freshly generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // Parent is the reference frame the line is attached to. Defaults to
    // "world" when empty.
    Parent string
    // Positions defines the polyline vertices in order. Must contain at least
    // two positions.
    Positions []r3.Vector
    // Colors controls how line segments are colored. With no colors, segments
    // use draw.DefaultLineColor (blue). Pass one color to share it across all
    // segments; pass exactly len(Positions) colors for per-vertex colors; pass
    // any other count to cycle through the slice as a palette.
    Colors []draw.Color
    // DotColors controls how the vertex dots are colored, following the same
    // count rules as Colors. When DotColors is empty, the dots fall back to
    // Colors (so dots and segments share their palette by default); if both
    // are empty, dots use draw.DefaultLineDotColor (dark blue).
    DotColors []draw.Color
    // LineWidth is the rendered thickness of segments in millimeters. 0 (the
    // default) uses draw.DefaultLineWidth (5mm).
    LineWidth float32
    // DotSize is the rendered diameter of vertex dots in millimeters. 0 (the
    // default) uses draw.DefaultLineDotSize (10mm).
    DotSize float32
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawNurbsOptions configures a DrawNurbs call.

type DrawNurbsOptions struct {
    // ID is a stable identifier for the entity. When set, calling DrawNurbs
    // again with the same ID updates the existing entity in place; when empty,
    // each call creates a new entity with a freshly generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // Parent is the reference frame the curve is attached to. Defaults to
    // "world" when empty.
    Parent string
    // ControlPoints defines the poses that influence the curve's shape.
    // Required.
    ControlPoints []spatialmath.Pose
    // Knots is the knot vector that determines parameter values along the
    // curve. Length must equal len(ControlPoints) + Degree + 1.
    Knots []float64
    // Color is the render color for the curve.
    Color draw.Color
    // Degree is the polynomial degree of the curve. Higher degrees produce
    // smoother curves but require more control points and a longer knot
    // vector. 0 (the default) uses draw.DefaultNurbsDegree (3, cubic).
    Degree int32
    // Weights sets the per-control-point influence on the curve; higher
    // weights pull the curve closer to that control point. When non-empty,
    // length must equal len(ControlPoints). Empty (the default) is treated as
    // 1.0 for every control point (uniform weighting).
    Weights []float64
    // LineWidth is the rendered thickness of the curve in millimeters. 0 (the
    // default) uses draw.DefaultLineWidth (5mm).
    LineWidth float32
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawPointCloudOptions configures a DrawPointCloud call.

type DrawPointCloudOptions struct {
    // ID is a stable identifier for the entity. When set, calling
    // DrawPointCloud again with the same ID updates the existing entity in
    // place; when empty, each call creates a new entity with a freshly
    // generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // PointCloud is the underlying cloud to render. Required.
    PointCloud pointcloud.PointCloud
    // Parent is the reference frame the cloud is attached to. Defaults to
    // "world" when empty.
    Parent string
    // DownscalingThreshold reduces the rendered point count by keeping only
    // points whose mutual distance exceeds this threshold (millimeters). 0
    // (the default) disables downscaling. Note: downscaling is O(n^2) in the
    // input point count.
    DownscalingThreshold float64
    // Colors controls how the cloud is colored. With no colors, the cloud's
    // own per-point color data (if any) is used by the visualizer. Pass one
    // color to override with a single shared color; pass exactly
    // PointCloud.Size() colors for per-point colors; pass any other count to
    // cycle through the slice as a palette.
    Colors []draw.Color
    // ChunkSize, when > 0, splits the cloud into chunks of this many points
    // and delivers them progressively over multiple RPCs (one AddEntity call
    // followed by UpdateEntity calls). When 0, the entire cloud is sent in a
    // single AddEntity call. Use chunked delivery for large clouds to avoid
    // oversize payloads and surface progress in the UI.
    ChunkSize int
    // OnProgress is invoked after each chunk is sent during chunked delivery.
    // Ignored when ChunkSize is 0. Pass nil to skip progress reporting.
    OnProgress func(draw.ChunkProgress)
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawPointsOptions configures a DrawPoints call.

type DrawPointsOptions struct {
    // ID is a stable identifier for the entity. When set, calling DrawPoints
    // again with the same ID updates the existing entity in place; when empty,
    // each call creates a new entity with a freshly generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // Parent is the reference frame the points are attached to. Defaults to
    // "world" when empty.
    Parent string
    // Positions are the locations of each point. Must contain at least one
    // position.
    Positions []r3.Vector
    // Colors controls how the points are colored. With no colors, every point
    // uses draw.DefaultPointColor (gray). Pass one color to share it across all
    // points; pass exactly len(Positions) colors for per-point colors; pass any
    // other count to cycle through the slice as a palette.
    Colors []draw.Color
    // PointSize is the rendered diameter of each point in millimeters. 0 (the
    // default) uses draw.DefaultPointSize (10mm).
    PointSize float32
    // ChunkSize, when > 0, splits the positions into chunks of this size and
    // delivers them progressively over multiple RPCs (one AddEntity call
    // followed by UpdateEntity calls). When 0, the entire payload is sent in a
    // single AddEntity call.
    ChunkSize int
    // OnProgress is invoked after each chunk is sent during chunked delivery.
    // Ignored when ChunkSize is 0. Pass nil to skip progress reporting.
    OnProgress func(draw.ChunkProgress)
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawPosesAsArrowsOptions configures a DrawPosesAsArrows call.

type DrawPosesAsArrowsOptions struct {
    // ID is a stable identifier for the entity. When set, calling
    // DrawPosesAsArrows again with the same ID updates the existing entity in
    // place; when empty, each call creates a new entity with a freshly
    // generated UUID.
    ID  string
    // Name labels the entity in the visualizer. Must be ASCII printable and at
    // most 100 characters.
    Name string
    // Parent is the reference frame the arrows are attached to. Defaults to
    // "world" when empty.
    Parent string
    // Poses are the positions and orientations rendered as individual arrows.
    // Required.
    Poses []spatialmath.Pose
    // Colors controls how the arrows are colored. With no colors, every arrow
    // uses draw.DefaultArrowColor (green). Pass one color to share it across
    // all arrows; pass exactly len(Poses) colors for per-arrow colors; pass
    // any other count to cycle through the slice as a palette.
    Colors []draw.Color
    // Attrs carries optional shared display attributes (axes helper, default
    // visibility). Nil leaves all attributes at their defaults.
    Attrs *Attrs
}

DrawRobotOptions configures a DrawRobot call.

type DrawRobotOptions struct {
    // Ctx is the context used for inputs collection and the robot's
    // FrameSystemConfig RPC.
    Ctx context.Context
    // Robot is the robot whose frame system and joint positions are
    // snapshotted and drawn. Required.
    Robot robot.Robot
    // WorldState, when non-nil, is also drawn alongside the robot's frame
    // system geometries.
    WorldState *referenceframe.WorldState
    // Colors is the palette used to color obstacles and frame-system
    // geometries. When empty, a curated nine-color palette is used.
    Colors []draw.Color
    // ID is an optional identifier prefix used to namespace every entity
    // produced by this call. The prefix is composed with internal suffixes
    // to derive unique IDs for the world state ("ID_worldstate"), each
    // world-state transform ("ID_ws_transform_N"), and each frame-system
    // geometry batch ("ID_fs_N"). Reuse the same ID across calls to update
    // a previously drawn robot in place; pass distinct IDs to draw multiple
    // robots in the same scene without identity collisions.
    ID  string
}

DrawWorldStateOptions configures a DrawWorldState call.

type DrawWorldStateOptions struct {
    // ID is an optional identifier prefix for this batch. When non-empty,
    // each emitted transform's identity is derived from
    // "ID:geometryLabel:parent" rather than the default "geometryLabel:parent",
    // which prevents collisions between world-state batches that share
    // geometry labels. Calling DrawWorldState again with the same ID and
    // matching obstacles updates the previous batch in place.
    ID  string
    // WorldState contains the obstacles to render. Required.
    WorldState *referenceframe.WorldState
    // FrameSystem is the reference frame system used to resolve obstacles
    // expressed in non-world frames into the world frame.
    FrameSystem *referenceframe.FrameSystem
    // Inputs are the frame system inputs used to evaluate frame poses during
    // obstacle resolution.
    Inputs referenceframe.FrameSystemInputs
    // Colors controls how the obstacles are colored. With no colors,
    // obstacles are colored by cycling draw.ChromaticColorChooser. Pass one
    // color to share it across all obstacles; pass exactly the obstacle
    // count for per-obstacle colors; pass any other count to cycle through
    // the slice as a palette.
    Colors []draw.Color
}

SetCameraPoseOptions configures a SetCamera call.

type SetCameraPoseOptions struct {
    // Position is the camera location in millimeters, expressed in world
    // coordinates.
    Position r3.Vector
    // LookAt is the point in millimeters, expressed in world coordinates, that
    // the camera is aimed at.
    LookAt r3.Vector
    // Animate, when true, smoothly animates the camera from its current pose
    // rather than snapping to the new one.
    Animate bool
}

Generated by gomarkdoc