packet

package
v0.0.0-...-0583f8e Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcknowledgePacket

type AcknowledgePacket struct {
	Id     uint16
	Result AcknowledgeResult
}

type AcknowledgeResult

type AcknowledgeResult uint8
const (
	AckSuccess AcknowledgeResult = 0x01
	AckFailure AcknowledgeResult = 0xFF
)

type Actuator

type Actuator uint8
const (
	ActValveA Actuator = 0b0000_0001 << iota
	ActValveB
	ActValveC
	ActValveD
	ActValveE
	ActPiston
	ActNone Actuator = 0b0000_0000
)

type CmdFunction

type CmdFunction uint8
const (
	FncStartSequence CmdFunction = 0b0000_0001 << iota
	FncSetActuator
	FncResetActuator
	FncSetActuators
	FncResetActuators
	FncSetActuatorsState
)

type CommandPacket

type CommandPacket struct {
	Id       uint16
	Function CmdFunction
	Argument Actuator
}

type Milliseconds

type Milliseconds uint64

func (Milliseconds) Duration

func (ms Milliseconds) Duration() time.Duration

type RocketPacket

type RocketPacket struct {

	// Time is the number of milliseconds since start
	Time Milliseconds `csv:"time"`

	State state.State `csv:"state"`

	// Temperature is in Celsius (°C). // [-30; 45]
	Temperature float32 `csv:"temperature"`

	// Humidity is a percentage. // [0; 100]
	Humidity float32 `csv:"humidity"`

	// AtmosPressure is in Pascal (Pa). // [0-101325]
	AtmosPressure int32 `csv:"atmos_pressure"`

	// Altitude is in meters (m)
	Altitude float32 `csv:"altitude"`

	// Latitude is the GPS latitude in degree. // [-90;90]
	Latitude float32 `csv:"latitude"`

	// Longitude is the GPS longitude in degree. // [-180;180]
	Longitude float32 `csv:"longitude"`

	// Satellites is the number of GPS satellites the rocket is connected to.
	Satellites uint8 `csv:"nb_sat"`

	// Acceleration is the gravitationnal force experienced by the rocket in g (or m/s²).
	Acceleration Vector `csv:"accel_,inline"`

	// AngularVelocity is the angular speed of the rocket in radian per seconds.
	AngularVelocity Vector `csv:"angular_speed_,inline"`

	// Orientation is the pitch, roll and yaw of the rocket
	Orientation Vector `csv:"orient_,inline"`

	// Magnetism is in millitesla (mT)
	Magnetism Vector `csv:"magnet_,inline"`

	Voltages `csv:"v_,inline"`

	TestBench `csv:"test_,inline"`
}

RocketPacket represents a packet of data received from the rocket.

NOTE: The fields/properties of the struct must be in the same order as the binary data received.

type TestBench

type TestBench struct {
	LoadCell float32 `csv:"load"`

	// Temperature1 in Celsius (°C) // [0;600]
	Temperature1 float32 `csv:"temp1"`

	// Temperature2 in Celsius (°C) // [0;600]
	Temperature2 float32 `csv:"temp2"`

	// Temperature3 in Celsius (°C) // [0;600]
	Temperature3 float32 `csv:"temp3"`
}

type Vector

type Vector struct {
	X float32 `csv:"x"`
	Y float32 `csv:"y"`
	Z float32 `csv:"z"`
}

Vector represents a 3D vector or coordinates on a 3D plan.

type VoltagePSI

type VoltagePSI float32

func (VoltagePSI) PSI

func (v VoltagePSI) PSI() float32

PSI transforms the voltage to PSI. // [0;5] => [0;1000]

type Voltages

type Voltages struct {
	Rocket      float32    `csv:"rocket"`       // [0;15]
	Tower       float32    `csv:"tower"`        // [0;15]
	IgnitionBox float32    `csv:"ignition_box"` // [0;15]
	Item3       VoltagePSI `csv:"item3"`        // [0;5]
	Item17      VoltagePSI `csv:"item17"`       // [0;5]
	Item18      VoltagePSI `csv:"item18"`       // [0;5]
	Item19      VoltagePSI `csv:"item19"`       // [0;5]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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