Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(client mqtt.Client, steeringTopic, driveModeTopic, rcSteeringTopic, tfSteeringTopic, objectsTopic string, options ...Option) *Controller
func (*Controller) Objects ¶
func (c *Controller) Objects() []*events.Object
func (*Controller) Start ¶
func (c *Controller) Start() error
func (*Controller) Stop ¶
func (c *Controller) Stop()
type GridCorrector ¶
type GridCorrector struct {
// contains filtered or unexported fields
}
func NewGridCorrector ¶
func NewGridCorrector(options ...OptionCorrector) *GridCorrector
func (*GridCorrector) AdjustFromObjectPosition ¶
func (c *GridCorrector) AdjustFromObjectPosition(currentSteering float64, objs []*events.Object) float64
AdjustFromObjectPosition modify steering value according object positions
To compute steering correction, split in image in zones and define correction value for each zone
Steering computed : -1 -0.66 -0.33 0 0.33 0.66 1 0% |-----|-----|-----|-----|-----|-----| : | 0 | 0 | 0 | 0 | 0 | 0 | 20% |-----|-----|-----|-----|-----|-----| : | 0 | 0 | 0 | 0 | 0 | 0 | 40% |-----|-----|-----|-----|-----|-----| : | 0 | 0 | 0.25|-0.25| 0 | 0 | 60% |-----|-----|-----|-----|-----|-----| : | 0 | 0.25| 0.5 |-0.5 |-0.25| 0 | 80% |-----|-----|-----|-----|-----|-----| : | 0.25| 0.5 | 1 | -1 |-0.5 |-0.25| 100%|-----|-----|-----|-----|-----|-----|
For straight (current steering near of 0), search nearest object and if:
* left and right values < 0: use correction from right value according image splitting * left and right values > 0: use correction from left value according image splitting * left < 0 and right values > 0: use (right + (right - left) / 2) value
If current steering != 0 (turn on left or right), shift right and left values proportionnaly to current steering and apply 2.
: -1 -0.66 -0.33 0 0.33 0.66 1 0% |-----|-----|-----|-----|-----|-----| : | 0 | 0 | 0 | 0 | 0 | 0 | 20% |-----|-----|-----|-----|-----|-----| : | 0.2 | 0.1 | 0 | 0 |-0.1 |-0.2 | 40% |-----|-----|-----|-----|-----|-----| : | ... | ... | ... | ... | ... | ... |
type GridMap ¶
type GridMap struct { DistanceSteps []float64 `json:"distance_steps"` SteeringSteps []float64 `json:"steering_steps"` Data [][]float64 `json:"data"` }
func NewGridMapFromJson ¶
type Option ¶
type Option func(c *Controller)
func WithCorrector ¶
type OptionCorrector ¶
type OptionCorrector func(c *GridCorrector)
func WidthDeltaMiddle ¶
func WidthDeltaMiddle(d float64) OptionCorrector
func WithGridMap ¶
func WithGridMap(configPath string) OptionCorrector
func WithObjectMoveFactors ¶
func WithObjectMoveFactors(configPath string) OptionCorrector