servo

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: AGPL-3.0 Imports: 17 Imported by: 4

Documentation

Overview

Package servo contains a gRPC bases servo client

Package servo contains a gRPC based servo service server

Index

Constants

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

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

Variables

Subtype is a constant that identifies the component resource subtype.

Functions

func CreateStatus

func CreateStatus(ctx context.Context, resource interface{}) (*pb.Status, error)

CreateStatus creates a status from the servo.

func Named

func Named(name string) resource.Name

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

func NamesFromRobot

func NamesFromRobot(r robot.Robot) []string

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

func NewServer

func NewServer(service subtype.Service) pb.ServoServiceServer

NewServer constructs a servo 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 Servo implementation to a reconfigurableServo. If servo is already a reconfigurableServo, then nothing is done.

Types

type LocalServo

type LocalServo interface {
	Servo
}

A LocalServo represents a Servo that can report whether it is moving or not.

type Position added in v0.1.2

type Position struct {
	Position uint32
}

Position wraps the returned set angle (degrees) value.

type Servo

type Servo interface {
	// Move moves the servo to the given angle (0-180 degrees)
	// This will block until done or a new operation cancels this one
	Move(ctx context.Context, angleDeg uint32, extra map[string]interface{}) error

	// Position returns the current set angle (degrees) of the servo.
	Position(ctx context.Context, extra map[string]interface{}) (uint32, error)

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

	generic.Generic
	resource.MovingCheckable
}

A Servo represents a physical servo connected to a board.

func FromRobot

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

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

func NewClientFromConn

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

NewClientFromConn constructs a new Client from connection passed in.

Directories

Path Synopsis
Package fake implements a fake servo.
Package fake implements a fake servo.
Package gpio implements a pin based servo
Package gpio implements a pin based servo
Package register registers all relevant servos
Package register registers all relevant servos

Jump to

Keyboard shortcuts

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