client

package
v1.34.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 29 Imported by: 1

Documentation

Overview

Package client is the legacy v1 drawing client for motion-tools.

Deprecated: client is deprecated and will be removed in a future release. Use github.com/viam-labs/motion-tools/client/api instead. See the v1 → v2 migration guide: https://viamrobotics.github.io/visualization/migration/v1-to-v2/

Index

Constants

This section is empty.

Variables

View Source
var DefaultColorMap = []string{"#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", "#FF7F00", "#FFFF33", "#A65628", "#F781BF", "#999999"}

DefaultColorMap is a list of sensible colors to cycle between this is also the "Set1" colormap in Matplotlib

Functions

func DrawFrameSystem

DrawFrameSystem will draw a frame system in the visualizer. Parameters:

  • fs: A frame system
  • inputs: Frame system inputs

func DrawFrames added in v0.14.5

func DrawFrames(frames []referenceframe.Frame) error

DrawFrames draws Frames in the visualizer.

Parameters:

  • frames: a slice of frames

func DrawGLTF

func DrawGLTF(filePath string) error

DrawGLTF will draw a glTF file in the visualizer.

Parameters:

  • filePath: The gltf filepath

func DrawGeometries

func DrawGeometries(geometriesInFrame *referenceframe.GeometriesInFrame, colors []string) error

DrawGeometries draws a list of geometries in the visualizer.

Labels must be unique within a world. Calling DrawGeometries with labels that already exist will instead update the pose of that geometry. Only poses can be updated, geometries must be cleared if their shape is to change.

Parameters:

  • geometriesInFrame: a list of geometries
  • colors: a list of corresponding colors for each geometry

func DrawGeometry

func DrawGeometry(geometry spatialmath.Geometry, color string) error

DrawGeometry draws a geometry in the visualizer.

Labels must be unique within a world. Calling DrawGeometry with labels that already exist will instead update the pose of that geometry. Only poses can be updated, geometries must be cleared if their shape is to change.

Parameters:

  • geometry: a geometry
  • color: a corresponding color

func DrawLine added in v0.8.0

func DrawLine(label string, points []spatialmath.Pose, color *[3]uint8, dotColor *[3]uint8) error

DrawLine draws a line in the visualizer.

Parameters:

  • label: an identifier string used for reference in the treeview.
  • points: a list of poses, each representing a point in the line
  • color: An optional color of the line
  • dotColor: An optional color for dots at each vertex in the line

func DrawNurbs

func DrawNurbs(nurbs shapes.Nurbs, color string, name string) error

DrawNurbs draws a nurbs curve in the visualizer.

Parameters:

  • nurbs: A nurbs curve
  • color: The color of the line
  • name: A unique label for the curve

func DrawPointCloud

func DrawPointCloud(label string, pc pointcloud.PointCloud, overrideColor *[3]uint8) error

DrawPointCloud draws a PointCloud in the visualizer.

Parameters:

  • label: an identifier string used for reference in the treeview
  • pc: a PointCloud
  • color: an optional override color [R, G, B] (0–255); use nil for original color.

func DrawPoints added in v0.5.4

func DrawPoints(label string, points []spatialmath.Pose, colors [][3]uint8, color *[3]uint8) error

DrawPoints draws a list of points in the visualizer.

Parameters:

  • label: an identifier string used for reference in the treeview
  • points: a list of poses, each representing a point
  • colors: Individual point color, optional, and will fallback to defaultColor
  • color: an optional fallback color [R, G, B] (0–255); use nil for black

func DrawPoses

func DrawPoses(poses []spatialmath.Pose, colors []string, arrowHeadAtPose bool) error

DrawPoses draws a list of poses in the visualizer as arrows.

Parameters:

  • poses: a list of poses
  • colors: Individual arrow color
  • arrowHeadAtPose: whether the tip of the cone of the arrow will be at the pose. default is false

func DrawRobot

func DrawRobot(ctx context.Context, myRobot robot.Robot, ws *referenceframe.WorldState) error

DrawRobot will draw a robot in the visualizer.

Parameters:

  • ctx: A context
  • myRobot: A robot
  • ws: An optional world state

func DrawWorldState

DrawWorldState will draw a world state in the visualizer.

Parameters:

  • ws: A world state
  • fs: A frame system
  • inputs: Frame system inputs

func Record added in v0.11.0

func Record(filename string) error

Record writes all operations between now and `StopRecord` to the input filename. Record calls assume it's starting from a blank state and will call `RemoveAllSpatialObjects` under the hood. Not clearing the state first would otherwise result in a replay file that is not entirely self-contained. Something would need to have existed in the browser before a file could be replayed to faithfully re-envision what the original recording produced.

func RemoveAllSpatialObjects

func RemoveAllSpatialObjects() error

RemoveAllSpatialObjects clears all drawn items from the visualizer.

Parameters:

  • names: A list of names of items to clear

func RemoveSpatialObjects

func RemoveSpatialObjects(names []string) error

RemoveSpatialObjects clears a list of drawn items.

Parameters:

  • names: A list of names of items to clear

func Replay added in v0.11.0

func Replay(filename string, playbackSpeed float64) error

Replay replays a prior recorded rendering from the `Record` method. playbackSpeed controls for how fast the recording will be played. For example, a `playbackSpeed` of 1 will use the existing sleep timings between frames. A playback speed of 2 will be twice as fast and 0.5 will halve the FPS.

func SetCameraPose added in v0.8.0

func SetCameraPose(position r3.Vector, lookAt r3.Vector, animate bool) error

SetCameraPose will set the visualizer's camera pose. Parameters:

  • position: The camera position
  • lookAt: The direction the camera should look at
  • animate: Whether or not to animate to this pose

func SetURL

func SetURL(preferredURL string)

SetURL sets the url for communicating with the visualizer. This is useful when using multiple visualizer windows, or when drawing to a visualizer on another computer.

The port should be :3000, which is the port of the drawing server.

Parameters:

  • preferredURL: a url string

func StopRecord added in v0.11.0

func StopRecord()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL