Documentation ¶
Index ¶
- Constants
- type App
- type Camera
- func (c *Camera) AddVideoHandler(handler VideoHandler) (int64, error)
- func (c *Camera) IsRecordingVideo() (bool, error)
- func (c *Camera) RecordingTimeInSeconds() int64
- func (c *Camera) RemoveVideoHandler(t int64) error
- func (c *Camera) StartRecordingVideo() error
- func (c *Camera) StopRecordingVideo() error
- type Chassis
- type Client
- type Connection
- type GamePad
- type QRCode
- type Robot
- type StickPosition
- type VideoHandler
Constants ¶
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.
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera allows controlling the robot camera.
func (*Camera) AddVideoHandler ¶
func (c *Camera) AddVideoHandler(handler VideoHandler) (int64, error)
AddVideoHandler adds a new video handler to the camera. If this is the first video handler added, the camera will start sending video frames.
func (*Camera) IsRecordingVideo ¶
IsRecordingVideo returns true if the camera is currently recording video.
func (*Camera) RecordingTimeInSeconds ¶
RecordingTimeInSeconds returns the current recording time in seconds.
func (*Camera) RemoveVideoHandler ¶
RemoveVideoHandler removes a video handler from the camera. If this is the last video handler removed, the camera will stop sending video frames.
func (*Camera) StartRecordingVideo ¶
StartRecordingVideo starts recording video from the camera to the robot's SD card.
func (*Camera) StopRecordingVideo ¶
StopRecordingVideo stops recording video from the camera to the robot's SD card.
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 ¶
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 ¶
NewWifiDirectClient creates a new Client instance that will connect to a Robomaster robot using Wifi Direct.
func (*Client) Connection ¶
func (c *Client) Connection() *Connection
Connnection returns the Connection instance for the client.
func (*Client) GamePad ¶
GamePad returns the GamePad instance for the client. The GamePad is optional and may be nil.
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 GamePad ¶
type GamePad struct {
// contains filtered or unexported fields
}
GamePad allows controlling the DJI Robomaster gamepad accessory.
func (*GamePad) FirePressed ¶
FirePressed returns whether the fire 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.
type Robot ¶
type Robot struct {
// contains filtered or unexported fields
}
Robot allows reading the robot parameters.
func (*Robot) BatteryPowerPercent ¶
BatteryPowerPercent returns the current battery power percent (0 to 100).
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.
type VideoHandler ¶
type VideoHandler interface { // HandleVideo is called when a new video frame is received from the camera. // rgb24Data, as the name name implies, is the raw data for a RGB24 image and // its dimensions are 1280x720. HandleVideo(rgb24Data []byte) }
VideoHandler is the interface that must be implemented by types that want to handle video frames from the camera.