mobile

package module
v0.0.0-...-9211d55 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: 0

README

mobile

Go Mobile wrapper for the Robomaster SDK. This is mostly to address several limitations of Go Mobile and to expose things in a way that it will hopefully not complain about. This shoudl hopefully work with both Android and iOS.

Documentation

Index

Constants

View Source
const (
	CameraHorizontalResolutionPoints = camera.HorizontalResolutionPoints
	CameraVerticalResolutionPoints   = camera.VerticalResolutionPoints
	CameraHorizontalFOVDegrees       = camera.HorizontalFOVDegrees
	CameraVerticalFOVDegrees         = camera.VerticalFOVDegrees
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App holds the ID for a specific app.

func NewApp

func NewApp(id int64) (*App, error)

NewApp creates a new App instance with the given ID. If the ID is 0, a new ID will be generated.

func (*App) ID

func (a *App) ID() int64

ID returns the ID for the App instance.

type Camera

type Camera struct {
	// contains filtered or unexported fields
}

Camera allows controlling the robot camera.

func (*Camera) GLTextureData

func (c *Camera) GLTextureData() (*GLTextureData, error)

GLTextureData returns information about the current texture used for rendering frames. See RenderNextFrame() above.

func (*Camera) IsRecordingVideo

func (c *Camera) IsRecordingVideo() (isRecording bool, err error)

IsRecordingVideo returns true if the camera is currently recording video.

func (*Camera) RecordingTimeInSeconds

func (c *Camera) RecordingTimeInSeconds() (recordingTime int64)

RecordingTimeInSeconds returns the current recording time in seconds.

func (*Camera) RenderNextFrame

func (c *Camera) RenderNextFrame()

RenderNextFrame requests the next frame to be rendered. This is used by iOS and the frame will be rendered to a texture associated with an OpenGLES 2.0 context that was current when Start() is called. This should be called for for each frame to be rendered (up to 60 times per second).

func (*Camera) StartRecordingVideo

func (c *Camera) StartRecordingVideo() (err error)

StartRecordingVideo starts recording video from the camera to the robot's SD card.

func (*Camera) StartVideo

func (c *Camera) StartVideo() (err error)

StartVideo starts the camera video stream.

func (*Camera) StopRecordingVideo

func (c *Camera) StopRecordingVideo() (err error)

StopRecordingVideo stops recording video from the camera to the robot's SD card.

func (*Camera) StopVideo

func (c *Camera) StopVideo() (err error)

StopVideo stops the camera video stream.

type Chassis

type Chassis struct {
	// contains filtered or unexported fields
}

Chassis allows controlling the robot chassis. It also works as the robot main controller interface.

func (*Chassis) Move

func (c *Chassis) Move(ls *StickPosition, rs *StickPosition) error

Move moves the robot using the given stick positions. The left stick controls the robot's gimbal and chassis rotation and the right stick controls the robot's chassis (up/down/left/right).

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the main entry point for the mobile SDK.

func NewClient

func NewClient(appID int64) (*Client, error)

NewClient creates a new Client instance. If appID is 0, the client will try to connect to the first available Robomaster robot. If it is non-zero, it will only connect to a robot that is broadcasting the given appID. The appID can be configured in the robot through a qrcode.

func NewWifiDirectClient

func NewWifiDirectClient() (*Client, error)

NewWifiDirectClient creates a new Client instance that will connect to a Robomaster robot using Wifi Direct.

func (*Client) Camera

func (c *Client) Camera() *Camera

Camera returns the Camera instance for the client.

func (*Client) Chassis

func (c *Client) Chassis() *Chassis

Controller returns the Controller instance for the client.

func (*Client) Connection

func (c *Client) Connection() *Connection

Connnection returns the Connection instance for the client.

func (*Client) GamePad

func (c *Client) GamePad() *GamePad

GamePad returns the GamePad instance for the client. The GamePad is optional and may be nil.

func (*Client) Robot

func (c *Client) Robot() *Robot

Robot returns the Robot instance for the client.

func (*Client) SDCard

func (c *Client) SDCard() *SDCard

func (*Client) Start

func (c *Client) Start() error

Start starts the client.

func (*Client) Stop

func (c *Client) Stop() error

Stop stops the client.

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Camera allows controlling the robot's connection.

func (*Connection) SignalQualityBars

func (c *Connection) SignalQualityBars() int8

SignalQualityBars returns the current signal quality bars (1 to 4).

func (*Connection) SignalQualityLevel

func (c *Connection) SignalQualityLevel() int8

SignalQualityLevel returns the current signal quality level (0 to 60).

type GLTextureData

type GLTextureData struct {
	ID     int64
	Width  int32
	Height int32
}

type GamePad

type GamePad struct {
	// contains filtered or unexported fields
}

GamePad allows controlling the DJI Robomaster gamepad accessory.

func (*GamePad) C1Pressed

func (g *GamePad) C1Pressed() bool

C1Pressed returns whether the C1 button is pressed.

func (*GamePad) C2Pressed

func (g *GamePad) C2Pressed() bool

C2Pressed returns whether the C2 button is pressed.

func (*GamePad) FirePressed

func (g *GamePad) FirePressed() bool

FirePressed returns whether the fire button is pressed.

func (*GamePad) FnPressed

func (g *GamePad) FnPressed() bool

FnPressed returns whether the Fn button is pressed.

type QRCode

type QRCode struct {
	// contains filtered or unexported fields
}

QRCode allows generating QRCodes that can be read by a Robomaster robot.

func NewQRCode

func NewQRCode(appID int64, countryCode, ssID, password,
	bssID string) (*QRCode, error)

NewQRCode creates a new QRCode instance. The bssID parameter is optional and may be an empty string.

func (*QRCode) Image

func (q *QRCode) Image(size int) ([]byte, error)

Image returns the QRCode image (with size as its width and height) as a byte slice with RGB24 image data.

type Robot

type Robot struct {
	// contains filtered or unexported fields
}

Robot allows reading the robot parameters.

func (*Robot) BatteryPowerPercent

func (r *Robot) BatteryPowerPercent() int8

BatteryPowerPercent returns the current battery power percent (0 to 100).

func (*Robot) ChassisSpeedLevel

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

ChassisSpeedLevel returns the current chassis speed level.

func (*Robot) SetChassisSpeedLevel

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

SetChassisSpeedLevel sets the chassis speed level. Valid values are 0 (Fast), 1 (Medium) and 2 (Slow).

type SDCard

type SDCard struct {
	// contains filtered or unexported fields
}

SDCard allows handling an SD card inserted into the robot.

func (*SDCard) AvailablePhotoCount

func (s *SDCard) AvailablePhotoCount() (int64, error)

AvailablePhotoCount returns the estimated available photo count in the SD card.

func (*SDCard) AvailableRecordingTimeInSeconds

func (s *SDCard) AvailableRecordingTimeInSeconds() (int64, error)

AvailableRecordingTimeInSeconds returns the estimated available recording time in seconds.

func (*SDCard) Format

func (s *SDCard) Format() error

Format formats the SD card.

func (*SDCard) HasError

func (s *SDCard) HasError() (bool, error)

HasError returns true if the SD card has an error.

func (*SDCard) IsFormatting

func (s *SDCard) IsFormatting() (bool, error)

IsFormatting returns true if the SD card is being formatted.

func (*SDCard) IsFull

func (s *SDCard) IsFull() (bool, error)

IsFull returns true if the SD card is full.

func (*SDCard) IsInserted

func (s *SDCard) IsInserted() (bool, error)

IsInserted returns true if an SD card is inserted into the robot.

func (*SDCard) RemainingSpaceInMB

func (s *SDCard) RemainingSpaceInMB() (int64, error)

RemainingSpaceInMB returns the remaining space in MB of the SD card.

func (*SDCard) TotalSpaceInMB

func (s *SDCard) TotalSpaceInMB() (int64, error)

TotalSpaceInMB returns the total space in MB of the SD card.

type StickPosition

type StickPosition struct {
	// contains filtered or unexported fields
}

StickPosition represents the position of a stick controller.

func NewStickPosition

func NewStickPosition(x, y float64) *StickPosition

NewStickPosition creates a new StickPosition with the given X and Y positions.

func (*StickPosition) InterpolatedX

func (s *StickPosition) InterpolatedX() int64

InterpolatedX returns the interpolated X position of the stick controller.

func (*StickPosition) InterpolatedY

func (s *StickPosition) InterpolatedY() int64

InterpolatedY returns the interpolated Y position of the stick controller.

func (*StickPosition) Set

func (s *StickPosition) Set(x, y float64)

Set sets the position of the stick controller. X and Y must be between 0.0 and 1.0.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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