renderer

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalibrationCoords

type CalibrationCoords struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type CalibrationPoint

type CalibrationPoint struct {
	Vacuum *CalibrationCoords `json:"vacuum"`
	Map    *CalibrationCoords `json:"map"`
}

type Dimension

type Dimension struct {
	Min int `json:"min"`
	Max int `json:"max"`
	Mid int `json:"mid"`
	Avg int `json:"avg"`
}

type Dimensions

type Dimensions struct {
	X          Dimension `json:"x"`
	Y          Dimension `json:"y"`
	PixelCount int       `json:"pixelCount"`
}

type Entity

type Entity struct {
	Class    string         `json:"__class"`
	MetaData MetaDataEntity `json:"metaData"`
	Points   []int          `json:"points"`
	Type     string         `json:"type"`
}

type ImgSize

type ImgSize struct {
	Width  int
	Height int
}

type Layer

type Layer struct {
	Class            string     `json:"__class"`
	MetaData         MetaData   `json:"metaData"`
	Type             string     `json:"type"`
	Pixels           []int      `json:"pixels"`
	Dimensions       Dimensions `json:"dimensions"`
	CompressedPixels []int      `json:"compressedPixels"`
}

type MetaData

type MetaData struct {
	VendorMapId    int    `json:"vendorMapId"`
	Version        int    `json:"version"`
	Nonce          string `json:"nonce"`
	TotalLayerArea int    `json:"totalLayerArea"`
	Area           int    `json:"area,omitempty"`
	SegmentId      string `json:"segmentId,omitempty"`
	Active         bool   `json:"active,omitempty"`
	Name           string `json:"name,omitempty"`
}

type MetaDataEntity

type MetaDataEntity struct {
	Angle float64 `json:"angle,omitempty"`
}

type RbtCoords

type RbtCoords struct {
	MinX int
	MinY int
	MaxX int
	MaxY int
}

type Renderer

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

func New

func New(s *Settings) *Renderer

func (*Renderer) Render

func (r *Renderer) Render(data []byte, mc *config.MapConfig) (*Result, error)

type Result

type Result struct {
	Image       *image.Image
	ImageSize   *ImgSize
	RobotCoords *RbtCoords
	Settings    *Settings
	Calibration []byte
	PixelSize   int // taken from JSON, for traslating image coords to robot's coords system coordinates
}

func (*Result) RenderPNG

func (r *Result) RenderPNG() ([]byte, error)

type Settings

type Settings struct {
	Scale          float64
	PNGCompression int
	RotationTimes  int

	// Hardcoded limits for a map within robot's coordinates system
	StaticStartX, StaticStartY int
	StaticEndX, StaticEndY     int

	FloorColor       color.RGBA
	ObstacleColor    color.RGBA
	PathColor        color.RGBA
	NoGoAreaColor    color.RGBA
	VirtualWallColor color.RGBA
	SegmentColors    []color.RGBA
}

type Size

type Size struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type ValetudoJSON

type ValetudoJSON struct {
	Class     string    `json:"__class"`
	MetaData  *MetaData `json:"metaData"`
	Size      *Size     `json:"size"`
	PixelSize int       `json:"pixelSize"`
	Layers    []*Layer  `json:"layers"`
	Entities  []*Entity `json:"entities"`
}

Jump to

Keyboard shortcuts

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