trossen

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package trossen implements arms from Trossen Robotics.

Index

Constants

View Source
const (
	// ModelNameWX250S is the string used to refer to the wx250s arm model.
	ModelNameWX250S = "wx250s"

	// ModelNameVX300S is the string used to refer to the vx300s arm model.
	ModelNameVX300S = "vx300s"
)

Variables

View Source
var OffAngles = map[string]float64{
	"Waist":       2048,
	"Shoulder":    795,
	"Elbow":       3091,
	"Forearm_rot": 2048,
	"Wrist":       2566,
	"Wrist_rot":   2048,
}

OffAngles are the angles the arm falls into after torque is off.

View Source
var SleepAngles = map[string]float64{
	"Waist":       2048,
	"Shoulder":    840,
	"Elbow":       3090,
	"Forearm_rot": 2048,
	"Wrist":       2509,
	"Wrist_rot":   2048,
}

SleepAngles are the angles we go to to prepare to turn off torque.

Functions

func NewArm

func NewArm(r robot.Robot, cfg config.Component, logger golog.Logger, json []byte) (arm.LocalArm, error)

NewArm returns an instance of Arm given a model json.

Types

type Arm

type Arm struct {
	generic.Unimplemented
	Joints map[string][]*servo.Servo
	// contains filtered or unexported fields
}

Arm TODO.

func (*Arm) Close

func (a *Arm) Close()

Close will get the arm ready to be turned off.

func (*Arm) CurrentInputs

func (a *Arm) CurrentInputs(ctx context.Context) ([]referenceframe.Input, error)

CurrentInputs TODO.

func (*Arm) EndPosition

func (a *Arm) EndPosition(ctx context.Context, extra map[string]interface{}) (spatialmath.Pose, error)

EndPosition computes and returns the current cartesian position.

func (*Arm) GetAllAngles

func (a *Arm) GetAllAngles() (map[string]float64, error)

GetAllAngles will return a map of the angles of each joint, denominated in servo position.

func (*Arm) GetAllServos

func (a *Arm) GetAllServos() []*servo.Servo

GetAllServos returns a slice containing all servos in the arm.

func (*Arm) GetMoveLock

func (a *Arm) GetMoveLock() *sync.Mutex

GetMoveLock TODO.

func (*Arm) GetServos

func (a *Arm) GetServos(jointName string) []*servo.Servo

GetServos returns a slice containing all servos in the named joint.

func (*Arm) GoToInputs

func (a *Arm) GoToInputs(ctx context.Context, goal []referenceframe.Input) error

GoToInputs TODO.

func (*Arm) HomePosition

func (a *Arm) HomePosition(ctx context.Context) error

HomePosition goes to the home position.

func (*Arm) IsMoving

func (a *Arm) IsMoving(ctx context.Context) (bool, error)

IsMoving returns whether the arm is moving.

func (*Arm) JointOrder

func (a *Arm) JointOrder() []string

JointOrder TODO.

func (*Arm) JointPositions

func (a *Arm) JointPositions(ctx context.Context, extra map[string]interface{}) (*pb.JointPositions, error)

JointPositions returns an empty struct, because the wx250s should use joint angles from kinematics.

func (*Arm) JointTo

func (a *Arm) JointTo(jointName string, pos int, block bool)

JointTo sets a joint to a position.

func (*Arm) ModelFrame

func (a *Arm) ModelFrame() referenceframe.Model

ModelFrame TODO.

func (*Arm) MoveToJointPositions

func (a *Arm) MoveToJointPositions(ctx context.Context, jp *pb.JointPositions, extra map[string]interface{}) error

MoveToJointPositions takes a list of degrees and sets the corresponding joints to that position.

func (*Arm) MoveToPosition

func (a *Arm) MoveToPosition(
	ctx context.Context,
	pos spatialmath.Pose,
	worldState *referenceframe.WorldState,
	extra map[string]interface{},
) error

MoveToPosition moves the arm to the specified cartesian position.

func (*Arm) PrintPositions

func (a *Arm) PrintPositions() error

PrintPositions prints positions of all servos. TODO(pl): Print joint names, not just servo numbers.

func (*Arm) SetAcceleration

func (a *Arm) SetAcceleration(accel int) error

SetAcceleration sets acceleration for servos.

func (*Arm) SetVelocity

func (a *Arm) SetVelocity(veloc int) error

SetVelocity sets velocity for servos in travel time; recommended value 1000.

func (*Arm) SleepPosition

func (a *Arm) SleepPosition(ctx context.Context) error

SleepPosition goes back to the sleep position, ready to turn off torque.

func (*Arm) Stop

func (a *Arm) Stop(ctx context.Context, extra map[string]interface{}) error

Stop is unimplemented for trossen.

func (*Arm) TorqueOff

func (a *Arm) TorqueOff() error

TorqueOff turns off torque for all servos.

func (*Arm) TorqueOn

func (a *Arm) TorqueOn() error

TorqueOn turns on torque for all servos.

func (*Arm) WaitForMovement

func (a *Arm) WaitForMovement(ctx context.Context) error

WaitForMovement takes some servos, and will block until the servos are done moving.

type AttrConfig

type AttrConfig struct {
	UsbPort       string `json:"serial_path"`
	BaudRate      int    `json:"serial_baud_rate"`
	ArmServoCount int    `json:"arm_servo_count"`
}

AttrConfig is used for converting Arm config attributes.

func (*AttrConfig) Validate

func (config *AttrConfig) Validate(path string) error

Validate ensures all parts of the config are valid.

Jump to

Keyboard shortcuts

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