parts

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DriverPartFile

type DriverPartFile struct {
	PartID string `yaml:"part_id"`
	Type   string `yaml:"type"`
	Name   string `yaml:"name"`
	MPN    string `yaml:"mpn"`

	MotorDriver struct {
		Channels         int     `yaml:"channels"`
		MotorSupplyMinV  float64 `yaml:"motor_supply_min_v"`
		MotorSupplyMaxV  float64 `yaml:"motor_supply_max_v"`
		LogicVoltageMinV float64 `yaml:"logic_voltage_min_v"`
		LogicVoltageMaxV float64 `yaml:"logic_voltage_max_v"`
		ContinuousPerChA float64 `yaml:"continuous_per_channel_a"`
		PeakPerChA       float64 `yaml:"peak_per_channel_a"`
	} `yaml:"motor_driver"`
}

DriverPartFile represents the YAML structure for a motor driver part. Example: parts/drivers/tb6612fng.yaml

type I2CSensorPartFile

type I2CSensorPartFile struct {
	PartID string `yaml:"part_id"`
	Type   string `yaml:"type"`
	Name   string `yaml:"name"`
	MPN    string `yaml:"mpn"`

	I2CDevice struct {
		AddressHex model.I2CAddress `yaml:"address_hex"`
	} `yaml:"i2c_device"`
}

I2CSensorPartFile represents the YAML structure for an I2C sensor device. Example: parts/sensors/mpu6050.yaml

type MCUPartFile

type MCUPartFile struct {
	PartID string `yaml:"part_id"`
	Type   string `yaml:"type"`
	Name   string `yaml:"name"`

	MCU struct {
		LogicVoltageV float64 `yaml:"logic_voltage_v"`
	} `yaml:"mcu"`
}

MCUPartFile represents the YAML structure for an MCU. Example: parts/mcus/esp32s3.yaml

type MotorPartFile

type MotorPartFile struct {
	PartID string `yaml:"part_id"`
	Type   string `yaml:"type"`
	Name   string `yaml:"name"`

	Motor struct {
		VoltageMinV     float64 `yaml:"voltage_min_v"`
		VoltageMaxV     float64 `yaml:"voltage_max_v"`
		NominalCurrentA float64 `yaml:"nominal_current_a"`
		StallCurrentA   float64 `yaml:"stall_current_a"`
	} `yaml:"motor"`
}

MotorPartFile represents the YAML structure for a motor. Example: parts/motors/generic_dc_12v_gearmotor.yaml

type PartNotFoundError

type PartNotFoundError struct {
	PartID     string
	SearchDirs []string
}

PartNotFoundError reports a missing part along with search paths.

func (PartNotFoundError) Error

func (e PartNotFoundError) Error() string

type Store

type Store struct{ Dirs []string }

Store knows how to load part files from one or more search directories. Earlier directories take precedence over later ones.

func NewStore

func NewStore(baseDir string) *Store

NewStore creates a new part store rooted at baseDir (e.g. "parts").

func NewStoreWithDirs

func NewStoreWithDirs(dirs []string) *Store

NewStoreWithDirs creates a new part store rooted at the provided directories. Earlier directories take precedence over later ones.

func (*Store) LoadDriver

func (s *Store) LoadDriver(partID string) (DriverPartFile, error)

LoadDriver loads a motor driver part by ID, e.g. "drivers/tb6612fng".

func (*Store) LoadI2CSensor

func (s *Store) LoadI2CSensor(partID string) (I2CSensorPartFile, error)

LoadI2CSensor loads an I2C sensor part by ID, e.g. "sensors/mpu6050".

func (*Store) LoadMCU

func (s *Store) LoadMCU(partID string) (MCUPartFile, error)

LoadMCU loads an MCU part by ID, e.g. "mcus/esp32s3".

func (*Store) LoadMotor

func (s *Store) LoadMotor(partID string) (MotorPartFile, error)

LoadMotor loads a motor part by ID, e.g. "motors/generic_dc_12v_gearmotor".

Jump to

Keyboard shortcuts

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