robot

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChassisSpeedLevel added in v0.0.11

type ChassisSpeedLevel int8

ChassisSpeedLevel represents the speed level of the chassis.

const (
	// ChassisSpeedLevelFast is the fast speed level.
	ChassisSpeedLevelFast ChassisSpeedLevel = iota
	// ChassisSpeedLevelMedium is the medium speed level.
	ChassisSpeedLevelMedium
	// ChassisSpeedLevelSlow is the slow speed level.
	ChassisSpeedLevelSlow
	// ChassisSpeedLevelCustom is the custom speed level. This enables
	// individually setting speeds for each direction/axis. This is not
	// supported yet.
	//
	// TODO(bga): Add support for this.
	ChassisSpeedLevelCustom
	ChassisSpeedLevelTypeCount
)

type DeviceType

type DeviceType int16

DeviceType is the type of a device connected to the robot.

const (
	DeviceTypeImageTransmission DeviceType = 256
	DeviceTypeCamera            DeviceType = 260
	DeviceTypeChassis           DeviceType = 768
	DeviceTypeBattery           DeviceType = 778
	DeviceTypeESC0              DeviceType = 788
	DeviceTypeESC1              DeviceType = 789
	DeviceTypeESC2              DeviceType = 790
	DeviceTypeESC3              DeviceType = 791
	DeviceTypeServo1            DeviceType = 792
	DeviceTypeServo2            DeviceType = 793
	DeviceTypeServo3            DeviceType = 794
	DeviceTypeServo4            DeviceType = 795
	DeviceTypeArm               DeviceType = 798
	DeviceTypeGripper           DeviceType = 799 // TODO(bga): Verify.
	DeviceTypeGimbal            DeviceType = 1024
	DeviceTypeTOF1              DeviceType = 4609
	DeviceTypeTOF2              DeviceType = 4610
	DeviceTypeTOF3              DeviceType = 4611
	DeviceTypeTOF4              DeviceType = 4612
	DeviceTypeSensorAdapter1    DeviceType = 5633
	DeviceTypeSensorAdapter2    DeviceType = 5634
	DeviceTypeSensorAdapter3    DeviceType = 5635
	DeviceTypeSensorAdapter4    DeviceType = 5636
	DeviceTypeSensorAdapter5    DeviceType = 5637
	DeviceTypeSensorAdapter6    DeviceType = 5638
	DeviceTypeWaterGun          DeviceType = 5888
	DeviceTypeInfraredGun       DeviceType = 5889
	DeviceTypeBackArmor         DeviceType = 6145
	DeviceTypeFrontArmor        DeviceType = 6146
	DeviceTypeLeftArmor         DeviceType = 6147
	DeviceTypeRightArmor        DeviceType = 6148
	DeviceTypeLeftHeadArmor     DeviceType = 6149
	DeviceTypeRightHeadArmor    DeviceType = 6150
)

func (DeviceType) String

func (d DeviceType) String() string

type FunctionType

type FunctionType uint8
const (
	FunctionTypeBlooded FunctionType = iota + 2
	FunctionTypeMovementControl
	FunctionTypeGunControl
	FunctionTypeOffControlFunction
	FunctionTypeCount
)

func (FunctionType) String

func (f FunctionType) String() string

func (FunctionType) Valid

func (f FunctionType) Valid() bool

type Robot

type Robot struct {
	*internal.BaseModule
	// contains filtered or unexported fields
}

Robot is the module that controls the robot. It provides methods to generally set it up.

func New

New creates a new Robot instance.

func (*Robot) BatteryPowerPercent

func (r *Robot) BatteryPowerPercent() uint8

BatteryPowerPercent returns the current battery power percent.

func (*Robot) ChassisSpeedLevel

func (r *Robot) ChassisSpeedLevel() (ChassisSpeedLevel, error)

ChassisSpeedLevel returns the current chassis speed level.

func (*Robot) Devices

func (r *Robot) Devices() []DeviceType

Devices returns the list of working devices (i.e. devices connected to the robot and that are reported as working).

func (*Robot) EnableFunction

func (r *Robot) EnableFunction(ft FunctionType, enable bool) error

EnableFunction enables or disables the given function. This keeps track of previoudly enabled/didabled functions and always sends the full list with the current status of all functions to the Unity Bridge.

func (*Robot) HasDevice

func (r *Robot) HasDevice(device DeviceType) bool

HasFunction returns true if the given device is connected to the robot and is reported as working.

func (*Robot) SetChassisSpeedLevel

func (r *Robot) SetChassisSpeedLevel(speedLevel ChassisSpeedLevel) error

SetChassisSpeedLevel sets the chassis speed level.

func (*Robot) SetSpeakerVolume

func (r *Robot) SetSpeakerVolume(volume uint8) error

SetSpeakerVolume sets the speaker volume.

func (*Robot) SpeakerVolume

func (r *Robot) SpeakerVolume() (uint8, error)

SpeakerVolume returns the current speaker volume.

func (*Robot) Stop

func (r *Robot) Stop() error

Stop stops the Robot module.

func (*Robot) WaitForDevices

func (r *Robot) WaitForDevices(timeout time.Duration) bool

WaitForDevices waits for the robot to report devices as working. Returns true if an actual result was obtained and false otherwise (i.e. timeout).

Jump to

Keyboard shortcuts

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