NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _DS3D_DATARENDER_LIDAR_FILE_RENDER_CONFIG__H
19 #define _DS3D_DATARENDER_LIDAR_FILE_RENDER_CONFIG__H
20 
21 #include <ds3d/common/common.h>
22 #include <ds3d/common/func_utils.h>
23 
24 #include "ds3d/common/hpp/yaml_config.hpp"
25 
26 #define _PATH_MAX 4096
27 
28 namespace ds3d { namespace impl { namespace lidarrender {
29 
30 struct Config {
31  config::ComponentConfig compConfig;
32  std::string lidarFrameSavePath = "";
33  std::string inputDatamapKey = "";
34 };
35 
36 
37 inline ErrCode
38 parseBaseConfig(const std::string& content, const std::string& path, Config& config)
39 {
41  config::parseComponentConfig(content, path, config.compConfig),
42  "parse dataloader component content failed");
43  YAML::Node node = YAML::Load(config.compConfig.configBody);
44  char absRealFilePath[_PATH_MAX + 1];
45  if (node["frames_save_path"]) {
46  config.lidarFrameSavePath = node["frames_save_path"].as<std::string>();
47  if(config.lidarFrameSavePath[0] != '/') {
48  if (!realpath(path.c_str(), absRealFilePath)) {
49  if (errno != ENOENT) {
50  LOG_WARNING("Your config file path is not right!");
51  return ErrCode::kNotFound;
52  }
53  }
54  std::string tmpPath = absRealFilePath;
55  int pos = tmpPath.find_last_of("/");
56  config.lidarFrameSavePath = tmpPath.substr(0, pos+1) + config.lidarFrameSavePath;
57  if(config.lidarFrameSavePath.back() != '/')
58  config.lidarFrameSavePath += '/';
59  }
60  LOG_DEBUG("config path %s",config.lidarFrameSavePath.c_str());
61  }
62 
63  if(node["input_datamap_key"]) {
64  config.inputDatamapKey = node["input_datamap_key"].as<std::string>();
65  } else {
66  config.inputDatamapKey = kLidar3DBboxRawData;
67  }
68 
69  return ErrCode::kGood;
70 }
71 
72 }}} // namespace ds3d::impl::lidarrender
73 
74 #endif // _DS3D_DATARENDER_LIDAR_FILE_RENDER_CONFIG__H
ds3d::ErrCode::kNotFound
@ kNotFound
ds3d::impl::lidarrender::Config::compConfig
config::ComponentConfig compConfig
Definition: sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h:31
ds3d::kLidar3DBboxRawData
static constexpr const char * kLidar3DBboxRawData
get array of Lidar3DBbox from FrameGuard [N, sizeof(Lidar3DBbox)]
Definition: includes/ds3d/common/common.h:119
LOG_DEBUG
#define LOG_DEBUG(fmt,...)
Definition: includes/ds3d/common/defines.h:59
_PATH_MAX
#define _PATH_MAX
Definition: 9.2/sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h:26
ds3d::ErrCode::kGood
@ kGood
LOG_WARNING
#define LOG_WARNING(fmt,...)
Definition: includes/ds3d/common/defines.h:65
ds3d::config::parseComponentConfig
ErrCode parseComponentConfig(const std::string &yamlComp, const std::string &path, ComponentConfig &config)
Definition: includes/ds3d/common/hpp/yaml_config.hpp:57
ds3d::ErrCode
ErrCode
Definition: includes/ds3d/common/common.h:47
DS3D_ERROR_RETURN
#define DS3D_ERROR_RETURN(code, fmt,...)
Definition: includes/ds3d/common/defines.h:77
ds3d::impl::lidarrender::parseBaseConfig
ErrCode parseBaseConfig(const std::string &content, const std::string &path, Config &config)
Definition: sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h:38
ds3d::impl::lidarrender::Config::inputDatamapKey
std::string inputDatamapKey
Definition: sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h:33
ds3d::impl::lidarrender::Config::lidarFrameSavePath
std::string lidarFrameSavePath
Definition: sources/libs/ds3d/datarender/lidarsink/lidar_file_render_config.h:32
ds3d
Definition: includes/ds3d/common/abi_dataprocess.h:25