Documentation ¶
Index ¶
- Constants
- type Mode
- type Module
- func (m *Module) AddVideoCallback(vc VideoCallback) (token.Token, error)
- func (m *Module) DigitalZoomFactor() (uint64, error)
- func (c *Module) GLTextureData() (value.GLTextureData, error)
- func (m *Module) IsRecordingVideo() (bool, error)
- func (m *Module) Mode() (Mode, error)
- func (m *Module) RecordingTime() time.Duration
- func (m *Module) RemoveVideoCallback(t token.Token) error
- func (m *Module) RenderNextFrame()
- func (m *Module) SetDigitalZoomFactor(factor uint64) error
- func (m *Module) SetMode(mode Mode) error
- func (m *Module) SetVideoFormat(format VideoFormat) error
- func (m *Module) SetVideoQuality(quality VideoQuality) error
- func (m *Module) Start() error
- func (m *Module) StartRecordingVideo() error
- func (m *Module) Stop() error
- func (m *Module) StopRecordingVideo() error
- func (m *Module) VideoFormat() (VideoFormat, error)
- type RGB
- type VideoCallback
- type VideoFormat
- type VideoQuality
Constants ¶
const ( HorizontalResolutionPoints = 1280 VerticalResolutionPoints = 720 HorizontalFOVDegrees = 96 VerticalFOVDegrees = 54 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶ added in v0.0.10
type Module struct { *internal.BaseModule // contains filtered or unexported fields }
Module provides support for managing the camera attached to the robot.
func New ¶
func New(ub unitybridge.UnityBridge, l *logger.Logger, cm *connection.Connection) (*Module, error)
New creates a new Camera instance with the given UnityBridge instance and logger.
func (*Module) AddVideoCallback ¶ added in v0.0.10
func (m *Module) AddVideoCallback(vc VideoCallback) (token.Token, error)
AddVideoCallback adds a callback function to be called when a new video frame is received from the robot. The callback function will be called in a separate goroutine. Returns a token that can be used to remove the callback later.
func (*Module) DigitalZoomFactor ¶ added in v0.0.10
ExposureMode returns the current digital zoom factor.
func (*Module) GLTextureData ¶ added in v0.0.10
func (c *Module) GLTextureData() (value.GLTextureData, error)
GLTextureData returns information about the current texture used for rendering frames. See RenderNextFrame() above.
func (*Module) IsRecordingVideo ¶ added in v0.0.10
IsRecordingVideo returns whether the robot is currently recording video to its internal storage.
func (*Module) RecordingTime ¶ added in v0.0.10
RecordingTime returns the current recording time in seconds.
func (*Module) RemoveVideoCallback ¶ added in v0.0.10
RemoveVideoCallback removes the callback function associated with the given token.
func (*Module) RenderNextFrame ¶ added in v0.0.10
func (m *Module) 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 (*Module) SetDigitalZoomFactor ¶ added in v0.0.10
SetDigitalZoomFactor sets the digital zoom factor.
func (*Module) SetVideoFormat ¶ added in v0.0.10
func (m *Module) SetVideoFormat(format VideoFormat) error
SetVideoFormat sets the video resolution.
TODO(bga): Other then actually limiting the available resolutions, it looks like changing resolutions is not working. Need to investigate further as there might be some setup that is needed and is not being done. It might be that this is only for the video recorded in the robot and not for the video being streamed from it.
func (*Module) SetVideoQuality ¶ added in v0.0.10
func (m *Module) SetVideoQuality(quality VideoQuality) error
SetVideoQuality sets the video quality.
func (*Module) StartRecordingVideo ¶ added in v0.0.10
StartRecordingVideo starts recording video to the robot's internal storage.
func (*Module) StopRecordingVideo ¶ added in v0.0.10
StopRecordingVideo stops recording video to the robot's internal storage.
func (*Module) VideoFormat ¶ added in v0.0.10
func (m *Module) VideoFormat() (VideoFormat, error)
VideoFormat returns the currently set video format.
type RGB ¶
func (*RGB) ColorModel ¶
type VideoCallback ¶
type VideoCallback func(frame *RGB)
VideoCallback is the type of the callback function used to receive video frames.
type VideoFormat ¶
type VideoFormat uint8
const ( VideoFormat720p_30 VideoFormat = iota VideoFormat1080p_30 VideoFormat720p_60 // this might not be actually supported VideoFormat1080p_60 // this might not be actually supported VideoFormatCount )
func (VideoFormat) String ¶
func (vf VideoFormat) String() string
String returns the video format as a string.
func (VideoFormat) Valid ¶
func (vf VideoFormat) Valid() bool
Valid returns true if the video format is valid.
type VideoQuality ¶
type VideoQuality uint8
const ( VideoQualityNormal VideoQuality = iota VideoQualityGood VideoQualityBest VideoQualityCount )
func VideoQualityFromRate ¶
func VideoQualityFromRate(rate float32) VideoQuality
VideoQualityFromRate returns the video quality from a rate (in megabits per second).
func (VideoQuality) String ¶
func (vq VideoQuality) String() string
String returns the video quality as a string.
func (VideoQuality) ToRate ¶
func (vq VideoQuality) ToRate() float32
ToRate returns the video quality as a rate (in megabits per second).
func (VideoQuality) Valid ¶
func (vq VideoQuality) Valid() bool
Valid returns true if the video quality is valid.