vbody

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LED_GREEN = 0x00FF00
	LED_RED   = 0x0000FF
	LED_BLUE  = 0xFF0000
	LED_OFF   = 0x0
)

Variables

View Source
var ReadOnly bool = false

Functions

func GetButtonChan added in v1.2.3

func GetButtonChan() chan bool

Get a button press channel. Sends true when press, false when released.

frameChan := GetButtonChannel()

for frame := range frameChan {
	<do whatever you need to with frame>
	<this will repeat whenever a new frame is ready>
}

func GetFrameChan added in v1.2.2

func GetFrameChan() chan DataFrame

Get a frame channel. In your code, you should use it like:

frameChan := GetFrameChan()

for frame := range frameChan {
	<do whatever you need to with frame>
	<this will repeat whenever a new frame is ready>
}

func InitSpine

func InitSpine() error

Init spine communication. This must be run before you try to get a frame. Starts getting and sending frames, filling the currentDataFrame buffer. Checks if body is functional.

func IsInited added in v1.2.1

func IsInited() bool

Check if body comms are initiated.

func SetLEDs

func SetLEDs(front uint32, middle uint32, back uint32) error

Use LED_GREEN, LED_BLUE, and LED_RED consts as reference.

func SetMotors

func SetMotors(m1 int16, m2 int16, m3 int16, m4 int16) error

Set the motors to desired speed. Accepts negative values. Order (relative to robot): right wheel, left wheel, lift, head

func StopSpine

func StopSpine()

Close communication channel with body, stop sending/getting frames.

Types

type DataFrame

type DataFrame struct {
	Seq    uint32
	Cliffs [4]uint32
	// right wheel, left wheel, lift, head
	Encoders           MotorStatus
	BattVoltage        int16
	ChargerVoltage     int16
	BodyTemp           int16
	Touch              uint16
	ButtonState        bool
	MicData            []int16
	ProxSigmaMM        uint8
	ProxRawRangeMM     uint16
	ProxSignalRateMCPS uint16
	ProxAmbient        uint16
	ProxSPADCount      uint16
	ProxSampleCount    uint16
	ProxCalibResult    uint32
}

This is the data each spine frame from GetFrame() contains.

type MotorStatus

type MotorStatus [4]struct {
	Pos int32
	DLT int32
	TM  uint32
}

Jump to

Keyboard shortcuts

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