Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
RSDK-2252 - Unable to run cartogropher through RDK (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkufieta authored Mar 9, 2023
1 parent d2d113b commit 989bc54
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,37 @@ func (config *AttrConfig) SetOptionalParameters(defaultPort string, defaultDataR

return nil
}

// SetOptionalParametersReplacement updates any unset optional config parameters to the values passed to this function.
func SetOptionalParametersReplacement(config *AttrConfig, defaultPort string,
defaultDataRateMsec, defaultMapRateSec int, logger golog.Logger,
) (string, int, int, bool, bool, error) {
port := config.Port
if config.Port == "" {
port = defaultPort
}

dataRateMsec := config.DataRateMsec
if config.DataRateMsec == 0 {
dataRateMsec = defaultDataRateMsec
logger.Debugf("no data_rate_msec given, setting to default value of %d", defaultDataRateMsec)
}

mapRateSec := *config.MapRateSec
if config.MapRateSec == nil {
logger.Debugf("no map_rate_sec given, setting to default value of %d", defaultMapRateSec)
mapRateSec = defaultMapRateSec
}
if mapRateSec == 0 {
logger.Info("setting slam system to localization mode")
}

useLiveData, err := DetermineUseLiveData(logger, config.UseLiveData, config.Sensors)
if err != nil {
return "", 0, 0, false, false, err
}

deleteProcessedData := DetermineDeleteProcessedData(logger, config.DeleteProcessedData, useLiveData)

return port, dataRateMsec, mapRateSec, useLiveData, deleteProcessedData, nil
}

0 comments on commit 989bc54

Please sign in to comment.