config

package
v0.0.0-...-2489e1b Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSettingsNotFound = errors.New("settings file not found, default configuration is being generated and used")

ErrSettingsNotFound is returned if settings file is not found.

Functions

This section is empty.

Types

type AngleOfView

type AngleOfView struct {
	Horizontal float64 `toml:"horizontal"`
	Vertical   float64 `toml:"vertical"`
}

AngleOfView stores the angle of view of the camera.

type Calibration

type Calibration struct {
	CalibrateOnStart bool        `toml:"calibrateOnStart"`
	Invert           Invert      `toml:"invert"`
	Coefficient      Coefficient `toml:"coefficient"`
	Tolerate         Tolerate    `toml:"tolerate"`
}

Calibration stores the settings of the coefficients for optimized and smooth movements.

type Camera

type Camera struct {
	Source      int         `toml:"source"`
	MaxFPS      int         `toml:"maxFPS"`
	Frame       Frame       `toml:"frame"`
	AngleOfView AngleOfView `toml:"angleOfView"`
}

Camera stores the camera's specification.

type Coefficient

type Coefficient struct {
	X float64 `toml:"x"`
	Y float64 `toml:"y"`
}

Coefficient defines the coefficient of the Servos movement.

type Color

type Color struct {
	Target  Target  `toml:"target"`
	Other   Other   `toml:"other"`
	MidRect MidRect `toml:"midRect"`
}

Color stores the customizable colors of rectangles.

type Config

type Config struct {
	General     General     `toml:"general"`
	Servos      Servos      `toml:"servos"`
	Camera      Camera      `toml:"camera"`
	Targeting   Targeting   `toml:"targeting"`
	Calibration Calibration `toml:"calibration"`
}

Config holds IoT specifications and customizable variables.

func GetConfig

func GetConfig(log *logrus.Entry, path, name, ext string) (*Config, error)

GetConfig gets the configuration file for the observer.

type Frame

type Frame struct {
	Width  int `toml:"width"`
	Height int `toml:"height"`
}

Frame stores the frame resolution.

type General

type General struct {
	Show         bool    `toml:"show"`
	Period       int     `toml:"period"`
	IdleDuration float64 `toml:"idleDuration"`
}

General is a configuration of the Observer's runtime.

type Invert

type Invert struct {
	X bool `toml:"x"`
	Y bool `toml:"y"`
}

Invert defines whether the movement of the Servos is inverted or not.

type MidRect

type MidRect struct {
	Red       int `toml:"red"`
	Green     int `toml:"green"`
	Blue      int `toml:"blue"`
	Thickness int `toml:"thickness"`
}

MidRect stores specification of the middle rectangle indicating the focus area.

type Other

type Other struct {
	Red       int `toml:"red"`
	Green     int `toml:"green"`
	Blue      int `toml:"blue"`
	Thickness int `toml:"thickness"`
}

Other stores specification of the rectangles of others.

type Servos

type Servos struct {
	PinX int `toml:"pinX"`
	PinY int `toml:"pinY"`
}

Servos stores Servo's GPIO pins.

type Target

type Target struct {
	Red       int `toml:"red"`
	Green     int `toml:"green"`
	Blue      int `toml:"blue"`
	Thickness int `toml:"thickness"`
}

Target stores specification of the target's rectangle.

type Targeting

type Targeting struct {
	AimArea  float64  `toml:"aimArea"`
	Cascades []string `toml:"cascades"`
	Color    Color    `toml:"color"`
}

Targeting specifies the targeting method, sensitivity and colors.

type Tolerate

type Tolerate struct {
	X float64 `toml:"x"`
	Y float64 `toml:"y"`
}

Tolerate modifies the focus area.

Jump to

Keyboard shortcuts

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