base

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: AGPL-3.0 Imports: 19 Imported by: 6

Documentation

Overview

Package base defines the base that a robot uses to move around.

Package base contains a gRPC based base client

Package base contains a gRPC based arm service server.

Index

Constants

View Source
const SubtypeName = resource.SubtypeName("base")

SubtypeName is a constant that identifies the component resource subtype string "base".

Variables

Subtype is a constant that identifies the component resource subtype.

Functions

func CreateStatus

func CreateStatus(ctx context.Context, resource interface{}) (*commonpb.ActuatorStatus, error)

CreateStatus creates a status from the base.

func DependencyTypeError

func DependencyTypeError(name, actual interface{}) error

DependencyTypeError is used when a resource doesn't implement the expected interface.

func DoMove

func DoMove(ctx context.Context, move Move, base Base) error

DoMove performs the given move on the given base.

func Named

func Named(name string) resource.Name

Named is a helper for getting the named Base's typed resource name.

func NamesFromRobot

func NamesFromRobot(r robot.Robot) []string

NamesFromRobot is a helper for getting all base names from the given Robot.

func NewServer

func NewServer(s subtype.Service) pb.BaseServiceServer

NewServer constructs a base gRPC service server.

func NewUnimplementedInterfaceError

func NewUnimplementedInterfaceError(actual interface{}) error

NewUnimplementedInterfaceError is used when there is a failed interface check.

func NewUnimplementedLocalInterfaceError

func NewUnimplementedLocalInterfaceError(actual interface{}) error

NewUnimplementedLocalInterfaceError is used when there is a failed interface check.

func WrapWithReconfigurable

func WrapWithReconfigurable(r interface{}, name resource.Name) (resource.Reconfigurable, error)

WrapWithReconfigurable converts a regular LocalBase implementation to a reconfigurableBase. If base is already a reconfigurableBase, then nothing is done.

Types

type Base

type Base interface {
	// MoveStraight moves the robot straight a given distance at a given speed.
	// If a distance or speed of zero is given, the base will stop.
	// This method blocks until completed or cancelled
	MoveStraight(ctx context.Context, distanceMm int, mmPerSec float64, extra map[string]interface{}) error

	// Spin spins the robot by a given angle in degrees at a given speed.
	// If a speed of 0 the base will stop.
	// This method blocks until completed or cancelled
	Spin(ctx context.Context, angleDeg, degsPerSec float64, extra map[string]interface{}) error

	SetPower(ctx context.Context, linear, angular r3.Vector, extra map[string]interface{}) error

	// linear is in mmPerSec
	// angular is in degsPerSec
	SetVelocity(ctx context.Context, linear, angular r3.Vector, extra map[string]interface{}) error

	// Stop stops the base. It is assumed the base stops immediately.
	Stop(ctx context.Context, extra map[string]interface{}) error

	generic.Generic
}

A Base represents a physical base of a robot.

func FromDependencies

func FromDependencies(deps registry.Dependencies, name string) (Base, error)

FromDependencies is a helper for getting the named base from a collection of dependencies.

func FromRobot

func FromRobot(r robot.Robot, name string) (Base, error)

FromRobot is a helper for getting the named base from the given Robot.

func NewClientFromConn

func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, name string, logger golog.Logger) Base

NewClientFromConn constructs a new Client from connection passed in.

type LocalBase

type LocalBase interface {
	Base
	// Width returns the width of the base in millimeters.
	Width(ctx context.Context) (int, error)
	resource.MovingCheckable
}

A LocalBase represents a physical base of a robot that can report the width of itself.

type Move

type Move struct {
	DistanceMm int
	MmPerSec   float64
	AngleDeg   float64
	DegsPerSec float64
	Extra      map[string]interface{}
}

A Move describes instructions for a robot to spin followed by moving straight.

Directories

Path Synopsis
Package limo implements the AgileX Limo base
Package limo implements the AgileX Limo base
Package boat implements a base for a boat with support for N motors in any position or angle This is an Experimental package
Package boat implements a base for a boat with support for N motors in any position or angle This is an Experimental package
Package fake implements a fake base.
Package fake implements a fake base.
Package register registers all relevant bases
Package register registers all relevant bases
Package wheeled implements some bases, like a wheeled base.
Package wheeled implements some bases, like a wheeled base.

Jump to

Keyboard shortcuts

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