-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 1.14 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// package main is a module with correction-station component
package main
import (
"context"
stationi2c "rtksystem/correction-station-i2c"
serialstation "rtksystem/correction-station-serial"
gpsrtki2cnonetwork "rtksystem/gps-rtk-i2c-no-network"
gpsrtkserialnonetwork "rtksystem/gps-rtk-serial-no-network"
"github.com/edaniels/golog"
"go.viam.com/rdk/components/movementsensor"
"go.viam.com/rdk/components/sensor"
"go.viam.com/rdk/module"
"go.viam.com/utils"
)
func main() {
utils.ContextualMain(mainWithArgs, golog.NewDevelopmentLogger("rtk-system"))
}
func mainWithArgs(ctx context.Context, args []string, logger golog.Logger) error {
rtkSystem, err := module.NewModuleFromArgs(ctx, logger)
if err != nil {
return err
}
rtkSystem.AddModelFromRegistry(ctx, sensor.API, serialstation.Model)
rtkSystem.AddModelFromRegistry(ctx, sensor.API, stationi2c.Model)
rtkSystem.AddModelFromRegistry(ctx, movementsensor.API, gpsrtkserialnonetwork.Model)
rtkSystem.AddModelFromRegistry(ctx, movementsensor.API, gpsrtki2cnonetwork.Model)
err = rtkSystem.Start(ctx)
defer rtkSystem.Close(ctx)
if err != nil {
return err
}
<-ctx.Done()
return nil
}