pi_launch_control

package module
v0.0.0-...-1f851c5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

README

pi-launch-control

Model Rocketry Embedded Launch Control

Documentation

Overview

Implements an SSE broker for HTML5 Clients

Index

Constants

View Source
const FORMAT_MJPG = webcam.PixelFormat((uint32(byte('M'))) | (uint32(byte('J')) << 8) | (uint32(byte('P')) << 16) | (uint32(byte('G')) << 24))

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker struct {

	// Channel into which message are pushed to be broadcast out to attached clients.
	Outgoing chan string
	// contains filtered or unexported fields
}

func NewBroker

func NewBroker() *Broker

func (*Broker) ServeHTTP

func (b *Broker) ServeHTTP(w http.ResponseWriter, r *http.Request)

This is the method that handles HTTP requests / client communication.

func (*Broker) Start

func (b *Broker) Start()

type Camera

type Camera struct {
	Emitter    `json:"-"`
	sync.Mutex `json:"-"`
	Recordable `json:"-"`
	DeviceName string

	Initialized bool
	Recording   bool
	// contains filtered or unexported fields
}

Representation of Camera state.

swagger:model

func NewCamera

func NewCamera(dev string, trigger <-chan time.Time) (*Camera, error)

func (*Camera) Close

func (c *Camera) Close()

func (*Camera) GetRecordedData

func (c *Camera) GetRecordedData() map[*zip.FileHeader][]byte

func (*Camera) ResetRecording

func (c *Camera) ResetRecording()

func (*Camera) ServeHTTP

func (c *Camera) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Camera) StartRecording

func (c *Camera) StartRecording()

func (*Camera) StopRecording

func (c *Camera) StopRecording()

type Emitter

type Emitter struct {
	EmitterID
	// contains filtered or unexported fields
}

func (*Emitter) AddListener

func (e *Emitter) AddListener(ch chan string)

func (*Emitter) Emit

func (e *Emitter) Emit(v interface{})

func (*Emitter) RemoveListener

func (e *Emitter) RemoveListener(event string, ch chan string)

type EmitterID

type EmitterID interface {
	// contains filtered or unexported methods
}

type Igniter

type Igniter struct {
	TestPin gpio.PinIO `json:"-"`
	FirePin gpio.PinIO `json:"-"`

	Recording bool

	Emitter    `json:"-"`
	Recordable `json:"-"`
	sync.Mutex `json:"-"`
	// contains filtered or unexported fields
}

How we communicate with the Igniter

func NewIgniter

func NewIgniter(testPinName string, firePinName string) (*Igniter, error)

func (*Igniter) Emit

func (i *Igniter) Emit(v interface{})

func (*Igniter) Fire

func (i *Igniter) Fire() error

func (*Igniter) GetFirstRecorded

func (i *Igniter) GetFirstRecorded() *IgniterState

func (*Igniter) GetRecordedData

func (i *Igniter) GetRecordedData() map[*zip.FileHeader][]byte

func (*Igniter) GetState

func (i *Igniter) GetState() IgniterState

func (*Igniter) IsFiring

func (i *Igniter) IsFiring() bool

func (*Igniter) IsReady

func (i *Igniter) IsReady() bool

func (*Igniter) ResetRecording

func (i *Igniter) ResetRecording()

func (*Igniter) StartRecording

func (i *Igniter) StartRecording()

func (*Igniter) StopRecording

func (i *Igniter) StopRecording()

type IgniterState

type IgniterState struct {
	Ready     bool
	Firing    bool
	Recording bool
	Timestamp int64
}

Representation of Igniter state.

swagger:model

type Mission

type Mission struct {
	Timestamp int64
	Clock     int
	Aborted   bool
	Complete  bool
	// contains filtered or unexported fields
}

func NewMission

func NewMission(igniter *Igniter, scale *Scale, camera *Camera) *Mission

func (*Mission) Abort

func (m *Mission) Abort()

func (*Mission) Start

func (m *Mission) Start(broker *Broker)

type Recordable

type Recordable interface {
	StartRecording()
	StopRecording()
	ResetRecording()

	GetRecordedData() map[*zip.FileHeader][]byte
}

type Sample

type Sample struct {
	Initialized bool
	Calibrated  bool
	Recording   bool
	ZeroOffset  int
	Adjust      float64
	Timestamp   int64
	Volt0       uint32
	Volt0Mass   *float64
	Volt1       uint32
	Volt1Mass   *float64
}

Representation of a Scale Measurement

swagger:model

func (*Sample) CalculateMass

func (s *Sample) CalculateMass()

type Scale

type Scale struct {
	TriggerC <-chan time.Time `json:"-"'`

	Emitter    `json:"-"`
	sync.Mutex `json:"-"`
	Recordable `json:"-"`

	Device  string
	Trigger string

	Initialized bool
	Calibrated  bool
	Recording   bool
	// Zero Offset (tare) threshold
	ZeroOffset int
	// Known measured values.
	Measured map[int]int
	// The adjustment scale value.
	Adjust float64
	// contains filtered or unexported fields
}

Representation of Scale state.

swagger:model

func NewScale

func NewScale(dev string, trig <-chan time.Time, triggerDev string) (*Scale, error)

func (*Scale) Calibrate

func (s *Scale) Calibrate(mass int) error

func (*Scale) Close

func (s *Scale) Close()

func (*Scale) GetRecordedData

func (s *Scale) GetRecordedData() map[*zip.FileHeader][]byte

func (*Scale) Read

func (s *Scale) Read() Sample

func (*Scale) ResetRecording

func (s *Scale) ResetRecording()

func (*Scale) RollingAverage

func (s *Scale) RollingAverage(duration time.Duration) Sample

func (*Scale) StartRecording

func (s *Scale) StartRecording()

func (*Scale) StopRecording

func (s *Scale) StopRecording()

func (*Scale) Tare

func (s *Scale) Tare()

Directories

Path Synopsis
pi-launch-control API.
pi-launch-control API.

Jump to

Keyboard shortcuts

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