Documentation
¶
Overview ¶
Package reachymini is a Go client for the Reachy Mini daemon's REST/WebSocket API (the same interface used by Pollen Robotics' own TypeScript SDK and desktop app), so the robot can be piloted without writing any Python.
Index ¶
- type APIError
- type AppInfo
- type AppState
- type AppStatus
- type AppUpdateStatus
- type AppUpdatesResponse
- type AudioParamPair
- type BackendStatus
- type CameraSpecs
- type CameraStreamOptions
- type Client
- func (c *Client) ApplyAudioConfig(ctx context.Context, config []AudioParamPair, verify bool) (bool, error)
- func (c *Client) CheckAppUpdates(ctx context.Context, force bool) (AppUpdatesResponse, error)
- func (c *Client) ClearIncomingAudio(ctx context.Context) (map[string]string, error)
- func (c *Client) DeleteSound(ctx context.Context, filename string) error
- func (c *Client) EnsureMotorMode(ctx context.Context, mode MotorControlMode) (changed bool, err error)
- func (c *Client) GetCameraSpecs(ctx context.Context) (CameraSpecs, error)
- func (c *Client) GetCurrentAppStatus(ctx context.Context) (*AppStatus, error)
- func (c *Client) GetDaemonStatus(ctx context.Context) (DaemonStatus, error)
- func (c *Client) GetDoA(ctx context.Context) (DoAInfo, error)
- func (c *Client) GetFullState(ctx context.Context) (FullState, error)
- func (c *Client) GetJobStatus(ctx context.Context, jobID string) (JobInfo, error)
- func (c *Client) GetKinematicsInfo(ctx context.Context) (map[string]any, error)
- func (c *Client) GetKinematicsSTL(ctx context.Context, filename string) ([]byte, error)
- func (c *Client) GetMicrophoneVolume(ctx context.Context) (VolumeInfo, error)
- func (c *Client) GetMotorStatus(ctx context.Context) (MotorStatus, error)
- func (c *Client) GetPresentAntennaPositions(ctx context.Context) ([2]float64, error)
- func (c *Client) GetPresentBodyYaw(ctx context.Context) (float64, error)
- func (c *Client) GetPresentHeadPose(ctx context.Context) (Pose, error)
- func (c *Client) GetURDF(ctx context.Context) (map[string]string, error)
- func (c *Client) GetVolume(ctx context.Context) (VolumeInfo, error)
- func (c *Client) Goto(ctx context.Context, req GotoRequest) (MoveUUID, error)
- func (c *Client) GotoSleep(ctx context.Context) (MoveUUID, error)
- func (c *Client) InstallApp(ctx context.Context, app AppInfo) (map[string]string, error)
- func (c *Client) InstallPrivateSpace(ctx context.Context, spaceID string) (map[string]string, error)
- func (c *Client) ListAvailableApps(ctx context.Context) ([]AppInfo, error)
- func (c *Client) ListAvailableAppsBySource(ctx context.Context, source SourceKind) ([]AppInfo, error)
- func (c *Client) ListRecordedMoveDatasets(ctx context.Context, datasetName string) ([]string, error)
- func (c *Client) ListRunningMoves(ctx context.Context) ([]MoveUUID, error)
- func (c *Client) ListSounds(ctx context.Context) ([]string, error)
- func (c *Client) PlayRecordedMoveDataset(ctx context.Context, datasetName, moveName string) (MoveUUID, error)
- func (c *Client) PlaySound(ctx context.Context, file string) error
- func (c *Client) ReadAudioParameter(ctx context.Context, name string) (ReadAudioParameterResponse, error)
- func (c *Client) RemoveApp(ctx context.Context, appName string) (map[string]string, error)
- func (c *Client) ResetAppsCache(ctx context.Context) (map[string]string, error)
- func (c *Client) RestartCurrentApp(ctx context.Context) (AppStatus, error)
- func (c *Client) RestartDaemon(ctx context.Context) (string, error)
- func (c *Client) SetMicrophoneVolume(ctx context.Context, volume int) (VolumeInfo, error)
- func (c *Client) SetMotorMode(ctx context.Context, mode MotorControlMode) error
- func (c *Client) SetTarget(ctx context.Context, target FullBodyTarget) error
- func (c *Client) SetVolume(ctx context.Context, volume int) (VolumeInfo, error)
- func (c *Client) StartApp(ctx context.Context, appName string) (AppStatus, error)
- func (c *Client) Stop(ctx context.Context, uuid MoveUUID) error
- func (c *Client) StopCurrentApp(ctx context.Context) error
- func (c *Client) StopSound(ctx context.Context) error
- func (c *Client) StreamCameraFrames(ctx context.Context, opts CameraStreamOptions) (<-chan Frame, <-chan error, error)
- func (c *Client) StreamFullState(ctx context.Context) (<-chan FullState, <-chan error, error)
- func (c *Client) StreamSetTarget(ctx context.Context) (chan<- FullBodyTarget, <-chan error, error)
- func (c *Client) TestSound(ctx context.Context) (TestSoundResult, error)
- func (c *Client) UpdateApp(ctx context.Context, appName string) (map[string]string, error)
- func (c *Client) UploadSound(ctx context.Context, localPath string) error
- func (c *Client) WakeUp(ctx context.Context) (MoveUUID, error)
- type ControlLoopStats
- type DaemonStatus
- type DoAInfo
- type Frame
- type FullBodyTarget
- type FullState
- type GotoRequest
- type InterpolationTechnique
- type JobInfo
- type JobStatus
- type Matrix4x4Pose
- type MotorControlMode
- type MotorStatus
- type MoveUUID
- type Pose
- type ReadAudioParameterResponse
- type ResolutionInfo
- type SourceKind
- type TestSoundResult
- type VolumeInfo
- type XYZRPYPose
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppInfo ¶
type AppInfo struct {
Name string `json:"name"`
SourceKind SourceKind `json:"source_kind"`
Description string `json:"description,omitempty"`
URL *string `json:"url,omitempty"`
Extra map[string]any `json:"extra,omitempty"`
}
AppInfo describes an app available from the robot's app store or already installed.
type AppStatus ¶
type AppStatus struct {
Info AppInfo `json:"info"`
State AppState `json:"state"`
Error *string `json:"error,omitempty"`
}
AppStatus is the status of a running (or just-started/stopped) app.
type AppUpdateStatus ¶
type AppUpdateStatus struct {
AppName string `json:"app_name"`
SpaceID string `json:"space_id"`
InstalledSHA string `json:"installed_sha"`
LatestSHA string `json:"latest_sha"`
UpdateAvailable bool `json:"update_available"`
LastModified *string `json:"last_modified,omitempty"`
}
AppUpdateStatus is the result of checking one installed app for updates.
type AppUpdatesResponse ¶
type AppUpdatesResponse struct {
AppsWithUpdates []AppUpdateStatus `json:"apps_with_updates"`
AppsChecked int `json:"apps_checked"`
AppsSkipped int `json:"apps_skipped"`
}
AppUpdatesResponse is the response of GET /api/apps/check-updates.
type AudioParamPair ¶
AudioParamPair is one (parameter name, values) pair in an audio config payload, as used by ApplyAudioConfig.
type BackendStatus ¶
type BackendStatus struct {
Ready bool `json:"ready"`
MotorControlMode MotorControlMode `json:"motor_control_mode"`
LastAlive any `json:"last_alive"`
ControlLoopStats *ControlLoopStats `json:"control_loop_stats"`
Error any `json:"error"`
}
BackendStatus reports the motor/hardware backend's health. Ready has been observed false even during normal operation, so don't gate on it; State on the enclosing DaemonStatus is the more reliable liveness signal.
type CameraSpecs ¶
type CameraSpecs struct {
Name string `json:"name"`
AvailableResolutions []ResolutionInfo `json:"available_resolutions"`
DefaultResolution ResolutionInfo `json:"default_resolution"`
K [][]float64 `json:"K"`
D []float64 `json:"D"`
}
CameraSpecs is the response of GET /api/camera/specs: full camera specifications as detected by the daemon, including the intrinsic matrix K and distortion coefficients D (standard OpenCV pinhole camera model).
type CameraStreamOptions ¶
type CameraStreamOptions struct {
// SignallingURL is the WebRTC signalling server's WebSocket URL, e.g.
// "ws://localhost:8443". This is a *separate* connection from the
// daemon's REST API -- see webrtc_signalling.go. Defaults to Client's
// BaseURL host on port 8443 if empty.
SignallingURL string
// ProducerName optionally selects a specific producer by its
// advertised meta name, if the signalling server lists more than one.
// If empty, the first available producer is used.
ProducerName string
// FFmpegPath overrides the ffmpeg binary used to decode video to raw
// RGB frames. Defaults to "ffmpeg" (resolved via PATH). This is a
// runtime dependency of the calling machine, not a Go dependency --
// there is no production-quality pure-Go decoder for either codec the
// daemon may negotiate (see below).
FFmpegPath string
}
CameraStreamOptions configures StreamCameraFrames.
type Client ¶
Client talks to a Reachy Mini daemon reachable at BaseURL (e.g. "http://localhost:8000" when tunneled over SSH with `ssh -L 8000:localhost:8000 <user>@<robot-host>`).
func New ¶
New returns a Client pointed at baseURL, e.g. "http://localhost:8000".
func (*Client) ApplyAudioConfig ¶
func (c *Client) ApplyAudioConfig(ctx context.Context, config []AudioParamPair, verify bool) (bool, error)
ApplyAudioConfig applies low-level audio mixer parameters. If verify is true (the daemon's own default), it reads each parameter back after writing to confirm it took effect.
func (*Client) CheckAppUpdates ¶
CheckAppUpdates checks installed apps for available updates. Set force to bypass any cached result.
func (*Client) ClearIncomingAudio ¶
ClearIncomingAudio discards any buffered incoming audio (e.g. from the microphone/direction-of-arrival pipeline).
func (*Client) DeleteSound ¶
DeleteSound removes a sound file from the robot.
func (*Client) EnsureMotorMode ¶
func (c *Client) EnsureMotorMode(ctx context.Context, mode MotorControlMode) (changed bool, err error)
EnsureMotorMode sets the robot's motor control mode to mode if it isn't already there, and reports whether a change was made. Movement commands (Goto, SetTarget, WakeUp, GotoSleep, ...) are accepted by the daemon and silently no-op if the robot isn't actually in MotorModeEnabled, so this is meant to be called at the top of anything that's about to move the robot.
func (*Client) GetCameraSpecs ¶
func (c *Client) GetCameraSpecs(ctx context.Context) (CameraSpecs, error)
GetCameraSpecs returns the robot's camera specifications.
func (*Client) GetCurrentAppStatus ¶
GetCurrentAppStatus returns the currently running app's status, or nil if no app is running.
func (*Client) GetDaemonStatus ¶
func (c *Client) GetDaemonStatus(ctx context.Context) (DaemonStatus, error)
GetDaemonStatus returns the daemon's current status, including hardware backend health and motor control mode.
func (*Client) GetFullState ¶
GetFullState returns the robot's complete current state.
func (*Client) GetJobStatus ¶
GetJobStatus returns the status of an install/update job started by InstallApp, InstallPrivateSpace, or UpdateApp.
func (*Client) GetKinematicsInfo ¶
GetKinematicsInfo returns the daemon's kinematics configuration as a free-form map -- the daemon's OpenAPI spec declares this endpoint's response as an open object with no fixed schema.
func (*Client) GetKinematicsSTL ¶
GetKinematicsSTL downloads the raw STL mesh file named filename (as referenced by GetURDF/GetKinematicsInfo) and returns its bytes.
func (*Client) GetMicrophoneVolume ¶
func (c *Client) GetMicrophoneVolume(ctx context.Context) (VolumeInfo, error)
GetMicrophoneVolume returns the current microphone volume.
func (*Client) GetMotorStatus ¶
func (c *Client) GetMotorStatus(ctx context.Context) (MotorStatus, error)
GetMotorStatus returns the robot's current motor control mode.
func (*Client) GetPresentAntennaPositions ¶
GetPresentAntennaPositions returns the [left, right] antenna joint positions.
func (*Client) GetPresentBodyYaw ¶
GetPresentBodyYaw returns the body's current yaw.
func (*Client) GetPresentHeadPose ¶
GetPresentHeadPose returns the head's current pose.
func (*Client) GetURDF ¶
GetURDF returns the robot's URDF description as a set of named file contents (e.g. a "urdf" key holding the XML).
func (*Client) GetVolume ¶
func (c *Client) GetVolume(ctx context.Context) (VolumeInfo, error)
GetVolume returns the current speaker volume.
func (*Client) InstallApp ¶
InstallApp installs app and returns the daemon's raw install job response (the daemon's OpenAPI spec declares no fixed schema for it beyond string-to-string). Poll GetJobStatus to track progress.
func (*Client) InstallPrivateSpace ¶
func (c *Client) InstallPrivateSpace(ctx context.Context, spaceID string) (map[string]string, error)
InstallPrivateSpace installs a private Hugging Face Space by ID.
func (*Client) ListAvailableApps ¶
ListAvailableApps lists all apps available to install, across all sources.
func (*Client) ListAvailableAppsBySource ¶
func (c *Client) ListAvailableAppsBySource(ctx context.Context, source SourceKind) ([]AppInfo, error)
ListAvailableAppsBySource lists apps available from a single source.
func (*Client) ListRecordedMoveDatasets ¶
func (c *Client) ListRecordedMoveDatasets(ctx context.Context, datasetName string) ([]string, error)
ListRecordedMoveDatasets lists the recorded moves available in datasetName.
func (*Client) ListRunningMoves ¶
ListRunningMoves returns the UUIDs of moves currently in progress.
func (*Client) ListSounds ¶
ListSounds lists the sound files available on the robot.
func (*Client) PlayRecordedMoveDataset ¶
func (c *Client) PlayRecordedMoveDataset(ctx context.Context, datasetName, moveName string) (MoveUUID, error)
PlayRecordedMoveDataset plays moveName from datasetName.
func (*Client) PlaySound ¶
PlaySound plays a sound file already stored on the robot (see ListSounds).
func (*Client) ReadAudioParameter ¶
func (c *Client) ReadAudioParameter(ctx context.Context, name string) (ReadAudioParameterResponse, error)
ReadAudioParameter reads a single low-level audio mixer parameter by name. Valid names are specific to the daemon's audio backend and aren't enumerated anywhere in the API itself.
func (*Client) ResetAppsCache ¶
ResetAppsCache clears the daemon's cached app store listing. Note this endpoint is mounted at /cache/reset-apps, not under /api like everything else -- that's how the daemon itself exposes it.
func (*Client) RestartCurrentApp ¶
RestartCurrentApp restarts whichever app is currently running.
func (*Client) RestartDaemon ¶
RestartDaemon restarts the daemon process, which re-initializes its connection to the motor/hardware backend. Useful when a joint has silently dropped off the control loop (no error reported, motor mode still "enabled", but it stops responding to position commands) -- cycling motor mode alone does not fix that, but a daemon restart does. Returns the daemon's internal job ID for the restart operation; the restart is asynchronous and briefly interrupts connectivity, so poll GetDaemonStatus afterward rather than assuming it's done when this returns.
func (*Client) SetMicrophoneVolume ¶
SetMicrophoneVolume sets the microphone volume (0-100).
func (*Client) SetMotorMode ¶
func (c *Client) SetMotorMode(ctx context.Context, mode MotorControlMode) error
SetMotorMode changes the robot's motor control mode (e.g. enabling/disabling torque).
func (*Client) SetTarget ¶
func (c *Client) SetTarget(ctx context.Context, target FullBodyTarget) error
SetTarget directly commands a target pose with no interpolation (lower latency than Goto, useful for teleop). For continuous streaming control, use StreamSetTarget instead.
func (*Client) Stop ¶
Stop halts the move identified by uuid (as returned by Goto, WakeUp, GotoSleep, or PlayRecordedMoveDataset; see also ListRunningMoves).
func (*Client) StopCurrentApp ¶
StopCurrentApp stops whichever app is currently running.
func (*Client) StreamCameraFrames ¶
func (c *Client) StreamCameraFrames(ctx context.Context, opts CameraStreamOptions) (<-chan Frame, <-chan error, error)
StreamCameraFrames connects to the daemon's WebRTC camera feed and decodes it to raw RGB frames, delivered on the returned channel until ctx is cancelled. Requires an `ffmpeg` binary on PATH (or set opts.FFmpegPath).
The negotiated video codec isn't known until after WebRTC negotiation completes, so the decoder is started lazily from the OnTrack callback. Verified live end-to-end against Pollen's desktop simulator (signalling, WebRTC negotiation, VP8 depacketization, IVF muxing, and ffmpeg decode all confirmed producing real, correctly-decoded frames). Real hardware has been observed (in the daemon's own source) to use hardware H.264 on Raspberry Pi instead -- both codecs are handled here, but only the VP8 path has actually been exercised against a live producer so far.
func (*Client) StreamFullState ¶
StreamFullState streams FullState frames from WS /api/state/ws/full until ctx is cancelled. The returned channels are closed when the stream ends; drain errs (buffered, size 1) to see why.
func (*Client) StreamSetTarget ¶
StreamSetTarget opens WS /api/move/ws/set_target and forwards every FullBodyTarget sent on the returned channel to the robot, until ctx is cancelled or the channel is closed. Useful for continuous/teleop control (e.g. driving the head from a joystick loop) where the lower per-call latency of a persistent connection matters; for one-off commands use SetTarget instead.
func (*Client) TestSound ¶
func (c *Client) TestSound(ctx context.Context) (TestSoundResult, error)
TestSound plays a short sound at the current volume -- useful for letting a user confirm audio is working after changing the volume.
func (*Client) UploadSound ¶
UploadSound uploads the local file at localPath to the robot's sound library.
type ControlLoopStats ¶
type ControlLoopStats struct {
MeanControlLoopFrequency float64 `json:"mean_control_loop_frequency"`
MaxControlLoopInterval float64 `json:"max_control_loop_interval"`
NbError int `json:"nb_error"`
MotorController string `json:"motor_controller"`
}
ControlLoopStats reports low-level motor control loop timing/health.
type DaemonStatus ¶
type DaemonStatus struct {
Type string `json:"type"`
RobotName string `json:"robot_name"`
State string `json:"state"`
WirelessVersion bool `json:"wireless_version"`
DesktopAppDaemon bool `json:"desktop_app_daemon"`
SimulationEnabled bool `json:"simulation_enabled"`
MockupSimEnabled bool `json:"mockup_sim_enabled"`
NoMedia bool `json:"no_media"`
MediaReleased bool `json:"media_released"`
CameraSpecsName string `json:"camera_specs_name"`
BackendStatus BackendStatus `json:"backend_status"`
Error any `json:"error"`
WlanIP string `json:"wlan_ip"`
Version string `json:"version"`
HardwareID string `json:"hardware_id"`
}
DaemonStatus is the response of GET /api/daemon/status.
type Frame ¶
Frame is one decoded video frame from StreamCameraFrames: 8-bit RGB, row-major, Width*Height*3 bytes.
type FullBodyTarget ¶
type FullBodyTarget struct {
TargetHeadPose *Pose `json:"target_head_pose,omitempty"`
TargetAntennas *[2]float64 `json:"target_antennas,omitempty"`
TargetBodyYaw *float64 `json:"target_body_yaw,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
}
FullBodyTarget is the body of POST /api/move/set_target and each frame of WS /api/move/ws/set_target.
type FullState ¶
type FullState struct {
ControlMode *MotorControlMode `json:"control_mode,omitempty"`
HeadPose *Pose `json:"head_pose,omitempty"`
HeadJoints []float64 `json:"head_joints,omitempty"`
BodyYaw *float64 `json:"body_yaw,omitempty"`
AntennasPosition []float64 `json:"antennas_position,omitempty"`
PassiveJoints []float64 `json:"passive_joints,omitempty"`
DoA *DoAInfo `json:"doa,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
}
FullState is the response of GET /api/state/full and each frame of WS /api/state/ws/full.
type GotoRequest ¶
type GotoRequest struct {
HeadPose *Pose `json:"head_pose,omitempty"`
Antennas *[2]float64 `json:"antennas,omitempty"`
BodyYaw *float64 `json:"body_yaw,omitempty"`
Duration float64 `json:"duration"`
Interpolation InterpolationTechnique `json:"interpolation"`
}
GotoRequest is the body of POST /api/move/goto.
type InterpolationTechnique ¶
type InterpolationTechnique string
InterpolationTechnique selects how `Goto` blends between the current and target pose. Verified against a live daemon's /openapi.json.
const ( InterpolationLinear InterpolationTechnique = "linear" InterpolationMinJerk InterpolationTechnique = "minjerk" InterpolationEaseInOut InterpolationTechnique = "ease_in_out" InterpolationCartoon InterpolationTechnique = "cartoon" )
type JobInfo ¶
type JobInfo struct {
Command string `json:"command"`
Status JobStatus `json:"status"`
Logs []string `json:"logs"`
}
JobInfo is the status of an async app install/update job (see InstallApp, InstallPrivateSpace, UpdateApp).
type Matrix4x4Pose ¶
type Matrix4x4Pose struct {
M [16]float64 `json:"m"`
}
Matrix4x4Pose is a raw row-major 4x4 homogeneous transform.
type MotorControlMode ¶
type MotorControlMode string
MotorControlMode selects the robot's motor control mode. Verified against a live daemon's /openapi.json.
const ( MotorModeEnabled MotorControlMode = "enabled" MotorModeDisabled MotorControlMode = "disabled" MotorModeGravityCompensation MotorControlMode = "gravity_compensation" )
type MotorStatus ¶
type MotorStatus struct {
Mode MotorControlMode `json:"mode"`
}
MotorStatus is the response of GET /api/motors/status.
type MoveUUID ¶
type MoveUUID struct {
UUID string `json:"uuid"`
}
MoveUUID identifies a move started via Goto, WakeUp, GotoSleep, or PlayRecordedMoveDataset, for use with Stop/ws/updates.
type Pose ¶
type Pose struct {
XYZRPY *XYZRPYPose
Matrix *Matrix4x4Pose
}
Pose mirrors the daemon's `AnyPose = XYZRPYPose | Matrix4x4Pose` union. Exactly one of XYZRPY or Matrix should be set.
func NewMatrixPose ¶
NewMatrixPose builds a Pose from a raw 4x4 transform.
func NewXYZRPYPose ¶
NewXYZRPYPose builds a Pose from Cartesian position and roll/pitch/yaw.
func (Pose) MarshalJSON ¶
MarshalJSON emits whichever variant is set. The daemon's Pydantic model distinguishes the union by field shape rather than an explicit tag, so we match on the presence of the "m" field (verified against a live daemon's /openapi.json: XYZRPYPose has no "m" field, Matrix4x4Pose requires one).
func (*Pose) UnmarshalJSON ¶
type ReadAudioParameterResponse ¶
type ReadAudioParameterResponse struct {
Name string `json:"name"`
Values []float64 `json:"values"`
}
ReadAudioParameterResponse is the response of GET /api/audio/config/parameter/{name}.
type ResolutionInfo ¶
type ResolutionInfo struct {
Name string `json:"name"`
Width int `json:"width"`
Height int `json:"height"`
FPS int `json:"fps"`
CropFactor float64 `json:"crop_factor"`
}
ResolutionInfo is a single camera resolution entry.
type SourceKind ¶
type SourceKind string
SourceKind is where an app comes from.
const ( SourceKindHFSpace SourceKind = "hf_space" SourceKindDashboardSelection SourceKind = "dashboard_selection" SourceKindLocal SourceKind = "local" SourceKindInstalled SourceKind = "installed" )
type TestSoundResult ¶
TestSoundResult is the response of POST /api/volume/test-sound.
type VolumeInfo ¶
type VolumeInfo struct {
Volume int `json:"volume"`
Platform string `json:"platform"`
Device string `json:"device"`
}
VolumeInfo reports the current volume level for a device.