racing

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

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

func NewAction

func NewAction(steering, throttle float64) Action

func (Action) Vector

func (a Action) Vector() []float64

type CarParams

type CarParams struct {
	MaxSpeed float64
	Accel    float64
	TurnRate float64
	Drag     float64
	Dt       float64
}

func DefaultCarParams

func DefaultCarParams() CarParams

type Config

type Config struct {
	Track   TrackParams
	Car     CarParams
	Sensors SensorParams

	CheckpointReward float64
	SpeedBonus       float64
	TimeBonus        float64
	WallPenalty      float64
}

func DefaultConfig

func DefaultConfig() Config

type Env

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

func New

func New(cfg Config) *Env

func (*Env) ActionSpec

func (e *Env) ActionSpec() core.Spec

func (*Env) Alive

func (e *Env) Alive() int

func (*Env) Bounds

func (e *Env) Bounds() (minX, minY, maxX, maxY float64)

func (*Env) CarPosition

func (e *Env) CarPosition(i int) core.Vec2

func (*Env) ObservationSpec

func (e *Env) ObservationSpec() core.Spec

func (*Env) Passed

func (e *Env) Passed(i int) int

func (*Env) Render

func (e *Env) Render(r core.Renderer)

func (*Env) ResetAll

func (e *Env) ResetAll(n int, rng *rand.Rand) []core.State

func (*Env) SensorEndpoints

func (e *Env) SensorEndpoints(i int) (origin core.Vec2, ends []core.Vec2)

func (*Env) SetBest

func (e *Env) SetBest(i int)

func (*Env) StepAll

func (e *Env) StepAll(actions []core.Action) (states []core.State, rewards []core.Reward, dones []bool)

func (*Env) Track

func (e *Env) Track() *Track

type SensorParams

type SensorParams struct {
	Count    int
	FOV      float64
	MaxRange float64
}

func DefaultSensorParams

func DefaultSensorParams() SensorParams

type State

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

func (State) Observation

func (s State) Observation() []float64

type Track

type Track struct {
	Center      []vec
	Inner       []vec
	Outer       []vec
	Checkpoints []gate
	Width       float64
	StartPos    vec
	StartDir    vec
}

func GenerateTrack

func GenerateTrack(rng *rand.Rand, p TrackParams) *Track

func (*Track) Bounds

func (t *Track) Bounds() (minX, minY, maxX, maxY float64)

type TrackParams

type TrackParams struct {
	Points      int
	Radius      float64
	Width       float64
	Displace    float64
	SplineSteps int
	Checkpoints int
}

func DefaultTrackParams

func DefaultTrackParams() TrackParams

Jump to

Keyboard shortcuts

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