agentlogic

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ControllerAgent = 0
	ContextAgent    = 1
)

Variables

This section is empty.

Functions

func ReplanMission

func ReplanMission(m Mission, agentholders map[string]AgentHolder, zoom maptile.Zoom) (map[string]Mission, error)

ReplanMission will give you a new plan split betweena all agents

Types

type Agent

type Agent struct {
	UUID               string
	Nick               string
	URI                string
	Position           Vector
	Key                string
	Battery            int
	MovementDimensions int
	Hardware           []string
	Software           []string
}

An Agent is a thing - anything that can move

type AgentHolder

type AgentHolder struct {
	Agent     Agent
	State     State
	LastSeen  int64
	AgentType AgentType
}

type AgentType

type AgentType int

type Goal

type Goal struct {
	Do      string
	End     string
	Endgame string
	Reached bool
}

Goal is the beginning and end

type MetaNeeded

type MetaNeeded struct {
	MovementAxis   int
	SwarmSW        []string
	OnboardHW      []string
	DataCollection string
}

MetaNeeded is the needed metadata

type Mission

type Mission struct {
	Description   string
	MissionType   MissionType
	AreaLink      string
	MetaNeeded    MetaNeeded
	Goal          Goal
	Geometry      orb.Geometry
	SwarmGeometry orb.Geometry
}

Mission is the main datatype

func (*Mission) GenerateEnvelope

func (m *Mission) GenerateEnvelope(a Agent, zoom maptile.Zoom) (orb.Geometry, error)

GenerateEnvelope generates a new polygon based on Zoom is the granularity of the path TODO: Maybe use information in agent to automatically guess zoom, or something else

func (*Mission) GeneratePath

func (m *Mission) GeneratePath(ah AgentHolder, zoom maptile.Zoom) (orb.Geometry, error)

GeneratePath to follow based on mission Zoom is the granularity of the path TODO: Maybe use information in agent to automatically guess zoom, or something else

func (*Mission) LoadFeatures

func (m *Mission) LoadFeatures(path string)

LoadFeatures loads stuff from file

func (*Mission) MissionArea

func (m *Mission) MissionArea() (centre orb.Point, area float64)

MissionArea will say something intelligent about the mission

func (Mission) String

func (m Mission) String() string

func (*Mission) UnmarshalJSON

func (m *Mission) UnmarshalJSON(rawData []byte) error

UnmarshalJSON will unmarshal the correct geometry from the json structure. This is being done by hand so we can hide the Geometry Unmarshalling

type MissionType

type MissionType string

MissionType is a String

const (
	Find MissionType = "find"
)

The types of mission abailable

type State

type State struct {
	ID           string
	Mission      Mission
	Battery      int
	Position     Vector
	MissionIndex int
}

type Vector

type Vector struct {
	X, Y, Z float64
}

Point - struct holding X Y Z values

func (Vector) Add

func (a Vector) Add(b Vector) Vector

Add - adds two vectors together

func (Vector) Cross

func (a Vector) Cross(b Vector) Vector

Cross - calculates the cross product of two Vectors

func (Vector) Dot

func (a Vector) Dot(b Vector) float64

Dot - calculates the dot product of two Vectors

func (Vector) Length

func (a Vector) Length() float64

Length - calculates the length(magnitude) of the Vector

func (Vector) MultiplyByScalar

func (a Vector) MultiplyByScalar(s float64) Vector

MultiplyByScalar - multiplies a Vector by s float64

func (Vector) Normalize

func (a Vector) Normalize() Vector

Normalize - returns a versor created from the given vector

func (Vector) Sub

func (a Vector) Sub(b Vector) Vector

Sub - subtracts b Vector from a Vector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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