mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
the
This commit is contained in:
@@ -11,6 +11,7 @@ type helloMessage struct {
|
||||
Audio AudioConfig `json:"audio"`
|
||||
Horn HornConfig `json:"horn"`
|
||||
NightVision NightVisionConfig `json:"nightVision"`
|
||||
Private PrivateConfig `json:"private"`
|
||||
}
|
||||
|
||||
type sensorMessage struct {
|
||||
|
||||
@@ -123,6 +123,25 @@ type AutoSideBrushConfig struct {
|
||||
Speed int `yaml:"speed"`
|
||||
}
|
||||
|
||||
type PrivateConfig struct {
|
||||
Enabled bool `yaml:"enabled" json:"enabled"`
|
||||
Safety PrivateSafetyConfig `yaml:"safety" json:"safety"`
|
||||
}
|
||||
|
||||
type PrivateSafetyConfig struct {
|
||||
SpeedLimitEnabled bool `yaml:"speedLimitEnabled" json:"speedLimitEnabled"`
|
||||
SpeedLimitMaxWheelMMs int `yaml:"speedLimitMaxWheelSpeed" json:"speedLimitMaxWheelSpeed"`
|
||||
HardOvercurrentEnabled bool `yaml:"hardOvercurrentEnabled" json:"hardOvercurrentEnabled"`
|
||||
OvercurrentStopMs int `yaml:"overcurrentStopMs" json:"overcurrentStopMs"`
|
||||
HardBumpEnabled bool `yaml:"hardBumpEnabled" json:"hardBumpEnabled"`
|
||||
BumpBackoffSpeed int `yaml:"bumpBackoffSpeed" json:"bumpBackoffSpeed"`
|
||||
BumpBackoffMs int `yaml:"bumpBackoffMs" json:"bumpBackoffMs"`
|
||||
CliffEnabled bool `yaml:"cliffEnabled" json:"cliffEnabled"`
|
||||
CliffBackoffSpeed int `yaml:"cliffBackoffSpeed" json:"cliffBackoffSpeed"`
|
||||
CliffBackoffMs int `yaml:"cliffBackoffMs" json:"cliffBackoffMs"`
|
||||
TriggerCooldownMs int `yaml:"triggerCooldownMs" json:"triggerCooldownMs"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Name string `yaml:"name"`
|
||||
Color string `yaml:"color" json:"color,omitempty"`
|
||||
@@ -137,6 +156,7 @@ type Config struct {
|
||||
Horn HornConfig `yaml:"horn"`
|
||||
NightVision NightVisionConfig `yaml:"nightVision" json:"nightVision"`
|
||||
AutoSideBrush AutoSideBrushConfig `yaml:"autoSideBrush"`
|
||||
Private PrivateConfig `yaml:"private" json:"private"`
|
||||
}
|
||||
|
||||
func LoadConfig(path string) (*Config, error) {
|
||||
@@ -203,6 +223,22 @@ func LoadConfig(path string) (*Config, error) {
|
||||
Enabled: true,
|
||||
Speed: 20,
|
||||
},
|
||||
Private: PrivateConfig{
|
||||
Enabled: false,
|
||||
Safety: PrivateSafetyConfig{
|
||||
SpeedLimitEnabled: false,
|
||||
SpeedLimitMaxWheelMMs: 250,
|
||||
HardOvercurrentEnabled: false,
|
||||
OvercurrentStopMs: 300,
|
||||
HardBumpEnabled: false,
|
||||
BumpBackoffSpeed: 250,
|
||||
BumpBackoffMs: 350,
|
||||
CliffEnabled: false,
|
||||
CliffBackoffSpeed: 250,
|
||||
CliffBackoffMs: 500,
|
||||
TriggerCooldownMs: 800,
|
||||
},
|
||||
},
|
||||
}
|
||||
if err := yaml.Unmarshal(data, &cfg); err != nil {
|
||||
return nil, err
|
||||
|
||||
Binary file not shown.
@@ -64,3 +64,17 @@ nightVision:
|
||||
autoSideBrush:
|
||||
enabled: true
|
||||
speed: 20
|
||||
private:
|
||||
enabled: false
|
||||
safety:
|
||||
speedLimitEnabled: false
|
||||
speedLimitMaxWheelSpeed: 250
|
||||
hardOvercurrentEnabled: false
|
||||
overcurrentStopMs: 300
|
||||
hardBumpEnabled: false
|
||||
bumpBackoffSpeed: 250
|
||||
bumpBackoffMs: 350
|
||||
cliffEnabled: false
|
||||
cliffBackoffSpeed: 250
|
||||
cliffBackoffMs: 500
|
||||
triggerCooldownMs: 800
|
||||
|
||||
@@ -34,3 +34,17 @@ cameraServo:
|
||||
autoSideBrush:
|
||||
enabled: true
|
||||
speed: 20
|
||||
private:
|
||||
enabled: false
|
||||
safety:
|
||||
speedLimitEnabled: false
|
||||
speedLimitMaxWheelSpeed: 250
|
||||
hardOvercurrentEnabled: false
|
||||
overcurrentStopMs: 300
|
||||
hardBumpEnabled: false
|
||||
bumpBackoffSpeed: 250
|
||||
bumpBackoffMs: 350
|
||||
cliffEnabled: false
|
||||
cliffBackoffSpeed: 250
|
||||
cliffBackoffMs: 500
|
||||
triggerCooldownMs: 800
|
||||
|
||||
@@ -121,6 +121,7 @@ func (c *WSClient) sendHello(ctx context.Context, conn *websocket.Conn) error {
|
||||
Audio: c.cfg.Audio,
|
||||
Horn: c.cfg.Horn,
|
||||
NightVision: c.cfg.NightVision,
|
||||
Private: c.cfg.Private,
|
||||
}
|
||||
c.log.Printf("sending hello (camera servo enabled=%v pin=%d)", msg.CameraServo.Enabled, msg.CameraServo.Pin)
|
||||
return writeJSON(ctx, conn, msg)
|
||||
|
||||
Reference in New Issue
Block a user