Documentation ¶
Index ¶
- Constants
- type Camera
- func (c *Camera) AddVideoCallback(vc VideoCallback) (token.Token, error)
- func (c *Camera) DigitalZoomFactor() (uint64, error)
- func (c *Camera) IsRecordingVideo() (bool, error)
- func (c *Camera) Mode() (Mode, error)
- func (c *Camera) RecordingTime() time.Duration
- func (c *Camera) RemoveVideoCallback(t token.Token) error
- func (c *Camera) SetDigitalZoomFactor(factor uint64) error
- func (c *Camera) SetMode(mode Mode) error
- func (c *Camera) SetVideoFormat(format VideoFormat) error
- func (c *Camera) SetVideoQuality(quality VideoQuality) error
- func (c *Camera) Start() error
- func (c *Camera) StartRecordingVideo() error
- func (c *Camera) Stop() error
- func (c *Camera) StopRecordingVideo() error
- func (c *Camera) VideoFormat() (VideoFormat, error)
- type Mode
- 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 Camera ¶
type Camera struct { *internal.BaseModule // contains filtered or unexported fields }
Camera provides support for managing the camera attached to the robot.
func New ¶
func New(ub unitybridge.UnityBridge, l *logger.Logger, cm *connection.Connection) (*Camera, error)
New creates a new Camera instance with the given UnityBridge instance and logger.
func (*Camera) AddVideoCallback ¶
func (c *Camera) 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 (*Camera) DigitalZoomFactor ¶
ExposureMode returns the current digital zoom factor.
func (*Camera) IsRecordingVideo ¶
IsRecordingVideo returns whether the robot is currently recording video to its internal storage.
func (*Camera) RecordingTime ¶
RecordingTime returns the current recording time in seconds.
func (*Camera) RemoveVideoCallback ¶
RemoveVideoCallback removes the callback function associated with the given token.
func (*Camera) SetDigitalZoomFactor ¶
SetDigitalZoomFactor sets the digital zoom factor.
func (*Camera) SetVideoFormat ¶
func (c *Camera) 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 (*Camera) SetVideoQuality ¶
func (c *Camera) SetVideoQuality(quality VideoQuality) error
SetVideoQuality sets the video quality.
func (*Camera) StartRecordingVideo ¶
StartRecordingVideo starts recording video to the robot's internal storage.
func (*Camera) StopRecordingVideo ¶
StopRecordingVideo stops recording video to the robot's internal storage.
func (*Camera) VideoFormat ¶
func (c *Camera) 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.