Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jobs done file #191

Merged
merged 4 commits into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion viam-cartographer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -226,6 +227,7 @@ func New(
cartoFacadeTimeout: cartoFacadeTimeout,
localizationMode: mapRateSec == 0,
mapTimestamp: time.Now().UTC(),
jobDone: false,
}
defer func() {
if err != nil {
Expand Down Expand Up @@ -493,6 +495,7 @@ type cartographerService struct {
sensorValidationIntervalSec int
// deprecated
dialMaxTimeoutSec int
jobDone bool
}

// GetPosition forwards the request for positional data to the slam library's gRPC service. Once a response is received,
Expand Down Expand Up @@ -660,7 +663,18 @@ func (cartoSvc *cartographerService) readDataOnInterval(ctx context.Context, lid

func (cartoSvc *cartographerService) getNextDataPoint(ctx context.Context, lidar lidar.Lidar, c chan int) {
if _, err := dim2d.GetAndSaveData(ctx, cartoSvc.dataDirectory, lidar, cartoSvc.logger); err != nil {
cartoSvc.logger.Warn(err)
if strings.Contains(err.Error(), "reached end of dataset") {
if !cartoSvc.jobDone {
cartoSvc.logger.Warn(err)
_, err = os.Create(filepath.Join(cartoSvc.dataDirectory, "job_done.txt"))
if err != nil {
cartoSvc.logger.Warn(err)
}
cartoSvc.jobDone = true
}
} else {
cartoSvc.logger.Warn(err)
}
}
if c != nil {
c <- 1
Expand Down
Loading