drone

package
v0.0.0-...-6b1210f Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COMMAND_TURN_ON  byte = 1
	COMMAND_TURN_OFF byte = 16

	COMMAND_TURN_LEFT  byte = 1
	COMMAND_TURN_RIGHT byte = 2

	COMMAND_CALIB_INC_P byte = 2
	COMMAND_CALIB_INC_I byte = 4
	COMMAND_CALIB_INC_D byte = 8

	COMMAND_CALIB_DEC_P byte = 32
	COMMAND_CALIB_DEC_I byte = 64
	COMMAND_CALIB_DEC_D byte = 128
)
View Source
const (
	MOTORS_OFF         = false
	MOTORS_ONN         = true
	THROTTLE_HYSTERSYS = 0.5
)

Variables

This section is empty.

Functions

func NewDrone

func NewDrone(settings DroneSettings) *droneApp

Types

type DroneConfigs

type DroneConfigs struct {
	PID struct {
		ARM_0_2 pid.PIDConfigs `json:"arm_0_2"`
		ARM_1_3 pid.PIDConfigs `json:"arm_1_3"`
		Yaw     pid.PIDConfigs `json:"yaw"`
	} `json:"pid"`
	IMU imu.Configs `json:"imu"`
	ESC struct {
		DataPerSecond     int     `json:"data-per-second"`
		MaxOutputThrottle float64 `json:"max-output-throttle"`
	} `json:"esc"`
	Commands struct {
		RollMidValue   int     `json:"roll-mid-value"`
		PitchMidValue  int     `json:"pitch-mid-value"`
		YawMidValue    int     `json:"yaw-mid-value"`
		RotationRange  float64 `json:"rotation-range-deg"`
		MaxThrottle    float64 `json:"max-throttle"`
		RollDirection  float64 `json:"roll-direction"`
		PitchDirection float64 `json:"pitch-direction"`
	} `json:"commands"`
	RemoteControl struct {
		CommandsPerSecond int `json:"commands-per-second"`
		Radio             struct {
			RxTxAddress string                  `json:"rx-tx-address"`
			SPI         hardware.SPIConnConfigs `json:"spi"`
		} `json:"radio"`
	} `json:"remote-control"`
	Plotter struct {
		Active bool `json:"active"`
	} `json:"plotter"`
}

func ReadConfigs

func ReadConfigs(configPath string) DroneConfigs

type DroneSettings

type DroneSettings struct {
	ImuMems           imuMems
	Receiver          radioReceiver
	Escs              escs
	ImuDataPerSecond  int
	ESCsDataPerSecond int
	CommandsPerSecond int
	PlotterActive     bool
	RollMidValue      int
	PitchMidValue     int
	YawMidValue       int
	RotationRange     float64
	MaxThrottle       float64
	MaxOutputThrottle float64
	Arm_0_2_Pid       *pid.PIDControl
	Arm_1_3_Pid       *pid.PIDControl
	Yaw_Pid           *pid.PIDControl
	RollDirection     float64
	PitchDirection    float64
}

type FlightControl

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

func NewFlightControl

func NewFlightControl(
	escs escs,
	maxThrottle float64,
	maxOutputThrottle float64,
	arm_0_2_pid *pid.PIDControl,
	arm_1_3_pid *pid.PIDControl,
	yaw_pid *pid.PIDControl,
	rollDirection float64,
	pitchDirection float64,
	headingInc float64,
) *FlightControl

type InertialDeviceConfigs

type InertialDeviceConfigs struct {
	FullScale string `json:"full_scale"`
	Offsets   struct {
		X uint16 `json:"x"`
		Y uint16 `json:"y"`
		Z uint16 `json:"z"`
	} `json:"offsets"`
}

type KalmanFilter

type KalmanFilter interface {
	Value(value float64) float64
}

Jump to

Keyboard shortcuts

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