Skip to content
Open

H5 #2

Show file tree
Hide file tree
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
32 changes: 17 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,25 @@ set(CUDA_LIBS ${CUDA_LIBRARIES} ${CUDA_CUFFT_LIBRARIES})
include_directories(${PROJECT_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${OCTOMAP_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} ${HDF5_INCLUDE_DIRS} ${JSONCPP_INCLUDE_DIRS} ${JSONCPP_INCLUDE_DIRS}/json)

add_library(coloradar_lib SHARED
src/internal.cpp

src/utils/basic.cpp
src/internal_utils/h5_utils.cpp
src/internal_utils/internal_utils.cpp
src/utils/basic_utils.cpp
src/utils/octo_pointcloud.cpp

src/radar_configs.cpp
src/device.cpp
src/dataset_configs.cpp
src/coloradar_run.cpp

src/dataset/parent_init.cpp
src/dataset/parent_data.cpp
src/dataset/parent_export.cpp
src/dataset/child_init.cpp
src/dataset/child_data.cpp

src/visualizer.cpp
src/configs/radar_configs.cpp
src/configs/device.cpp
src/configs/dataset_configs.cpp

src/run/base_run.cpp
src/run/h5_run.cpp
src/run/coloradar_plus_run.cpp
src/run/coloradar_run.cpp

src/utils/visualizer.cpp

src/dataset/h5_dataset.cpp
src/dataset/coloradar_plus_dataset.cpp
src/dataset/coloradar_dataset.cpp
)
target_link_libraries(coloradar_lib Threads::Threads ${YAML_CPP_LIBRARIES} ${PCL_LIBRARIES} ${OCTOMAP_LIBRARIES} ${HDF5_LIBRARIES} ${JSONCPP_LIBRARIES})
install(TARGETS coloradar_lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down
2 changes: 1 addition & 1 deletion examples/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
x-base-image: &base_image ghcr.io/arpg/coloradar-lib:jazzy
x-dataset-volume: &dataset_volume ~/coloradar_plus:/data/coloradar
x-dataset-volume: &dataset_volume ~/data/coloradar_plus:/data/coloradar


services:
Expand Down
4 changes: 2 additions & 2 deletions examples/scripts/build_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@


if __name__ == "__main__":
dataset = tools.ColoradarDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))
dataset = tools.ColoradarPlusDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))

for run in dataset.get_runs():
print('Building octomap for run:', run.name)
print('Building octomap for run:', run.name())
run.create_lidar_octomap(
map_resolution=0.25, base_to_lidar_transform=dataset.lidar_transform(),
lidar_total_horizontal_fov=360, lidar_total_vertical_fov=33.2, lidar_max_range=40
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/export_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@


if __name__ == "__main__":
dataset = tools.ColoradarDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))
dataset = tools.ColoradarPlusDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))
dataset.export_to_file('/export/export-config.yaml')
4 changes: 2 additions & 2 deletions examples/scripts/sample_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


if __name__ == "__main__":
dataset = tools.ColoradarDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))
dataset = tools.ColoradarPlusDataset(os.getenv('DOCKER_DATASET_VOLUME_PATH'))
radar_config = dataset.cascade_config()

# azimuth_max_bin, elevation_max_bin, max_range = 63, 4, 7
Expand All @@ -12,7 +12,7 @@
horizontal_fov, vertical_fov, max_range = 156.6, 32.2, 7
print(f'Sampling lidar map in cascade FOV: {horizontal_fov} degrees azimuth, {vertical_fov} degrees elevation, {max_range} meters range.')
for run in dataset.get_runs():
print(f'Processing {run.name}...')
print(f'Processing {run.name()}...')
run.create_map_samples(
sensor_timestamps=run.cascade_timestamps(), base_to_sensor_transform=dataset.cascade_transform(),
horizontal_fov=horizontal_fov, vertical_fov=vertical_fov, range=max_range
Expand Down
12 changes: 7 additions & 5 deletions export-config-template.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
global:
runs: all
destination_file: dataset.h5
export_transforms: False
export_transforms: True


devices:
Expand Down Expand Up @@ -37,7 +37,7 @@ devices:

# - point clouds
export_clouds: False
# relative intensity per frame
# absolute intensity value per frame
intensity_threshold: 0
# False for ego-centric clouds
clouds_in_global_frame: True
Expand Down Expand Up @@ -80,7 +80,7 @@ devices:
force_resample: False
# True to save the samples on disk. Will overwrite any existing samples
save_samples: False
# sampling perspective options: base, lidar, cascade
# sampling perspective options: base, lidar, cascade_radar
center_sensor: cascade_radar
map_sample_fov:
horizontal_degrees_total: 360
Expand All @@ -94,12 +94,14 @@ devices:


imu:
export_data: False
export_poses: False
export_timestamps: False

# TBD
export_data: False


# WARNING: only present in dataset v1
# WARNING: TBD, only for dataset v1
single_chip_radar:
export_poses: False
export_timestamps: False
Expand Down
138 changes: 0 additions & 138 deletions include/coloradar_run.h

This file was deleted.

8 changes: 0 additions & 8 deletions include/coloradar_tools.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef DATASET_CONFIGS_H
#define DATASET_CONFIGS_H

#include "device.h"
#include "configs/device.h"


namespace coloradar {
Expand All @@ -10,7 +10,7 @@ class DatasetExportConfig {
protected:
std::filesystem::path destinationFilePath_ = "dataset.h5";
std::vector<std::string> runs_ = {};
bool exportTransforms_ = false;
bool exportTransforms_ = true;
std::span<const std::unique_ptr<BaseDevice>> devices_;

RadarExportConfig cascadeCfg_;
Expand All @@ -32,7 +32,7 @@ class DatasetExportConfig {
DatasetExportConfig(
const std::filesystem::path &destinationFilePath = "dataset.h5",
const std::vector<std::string> &runs = {},
bool exportTransforms = false,
bool exportTransforms = true,
const RadarExportConfig &cascadeCfg = RadarExportConfig(),
const LidarExportConfig &lidarCfg = LidarExportConfig(),
const BaseExportConfig &baseCfg = BaseExportConfig(),
Expand Down
2 changes: 1 addition & 1 deletion include/device.h → include/configs/device.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef DEVICE_H
#define DEVICE_H

#include "utils.h"
#include "utils/utils.h"


namespace coloradar {
Expand Down
20 changes: 12 additions & 8 deletions include/radar_configs.h → include/configs/radar_configs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RADAR_CONFIGS_H
#define RADAR_CONFIGS_H

#include "utils.h"
#include "utils/utils.h"


namespace coloradar {
Expand Down Expand Up @@ -75,8 +75,10 @@ class RadarConfig {

RadarConfig(const int& nAzimuthBeams = 1, const int& nElevationBeams = 1) : numAzimuthBeams(nAzimuthBeams), numElevationBeams(nElevationBeams) {};
RadarConfig(const RadarConfig& other) = default;
virtual ~RadarConfig() = default;

Json::Value toJson() const;
void fromJson(const Json::Value& root);
void fromJson(const std::string& jsonString);

const int& nRangeBins() const; // abstracted as a method because distinction between numRangeBins and numPosRangeBins may be unclear
Expand All @@ -94,20 +96,21 @@ class RadarConfig {
int verticalFovToElevationIdx(const float& verticalFov);
int rangeToRangeIdx(const float& range);

std::vector<float> clipHeatmap(const std::vector<float>& heatmap, int azimuthMaxBin, int elevationMaxBin, int rangeMaxBin, bool updateConfig = true);
std::vector<float> clipHeatmap(const std::vector<float>& heatmap, float horizontalFov, float verticalFov, float range, bool updateConfig = true);
std::vector<float> collapseHeatmapElevation(const std::vector<float>& image, const float& elevationMinMeters = -100.0, const float& elevationMaxMeters = 100.0, bool updateConfig = true);
std::vector<float> removeDoppler(const std::vector<float>& image, bool updateConfig = true);
std::vector<float> swapHeatmapDimensions(const std::vector<float>& heatmap);
pcl::PointCloud<RadarPoint>::Ptr heatmapToPointcloud(const std::vector<float>& heatmap, const double intensityThreshold = 0.0) const;
void precomputePointcloudTemplate(); // call for correct point cloud conversion if config parameters changed
std::shared_ptr<std::vector<float>> clipHeatmap(const std::shared_ptr<std::vector<float>>& heatmap, int azimuthMaxBin, int elevationMaxBin, int rangeMaxBin, bool updateConfig = true);
std::shared_ptr<std::vector<float>> clipHeatmap(const std::shared_ptr<std::vector<float>>& heatmap, float horizontalFov, float verticalFov, float range, bool updateConfig = true);
std::shared_ptr<std::vector<float>> collapseHeatmapElevation(const std::shared_ptr<std::vector<float>>& image, const float& elevationMinMeters = -100.0, const float& elevationMaxMeters = 100.0, bool updateConfig = true);
std::shared_ptr<std::vector<float>> removeDoppler(const std::shared_ptr<std::vector<float>>& image, bool updateConfig = true);
std::shared_ptr<std::vector<float>> swapHeatmapDimensions(const std::shared_ptr<std::vector<float>>& heatmap);
pcl::PointCloud<RadarPoint>::Ptr heatmapToPointcloud(const std::shared_ptr<std::vector<float>>& heatmap, const double intensityThreshold = 0.0) const;
void precomputePointcloudTemplate(); // call to ensure correct heatmap->pointcloud conversion if config parameters change
};


class SingleChipConfig : public RadarConfig {
public:
SingleChipConfig() = default;
SingleChipConfig(const std::filesystem::path& calibDir, const int& nAzimuthBeams = 64, const int& nElevationBeams = 8);
explicit SingleChipConfig(const Json::Value& root) { fromJson(root); }

protected:
void init(const std::filesystem::path& calibDir) override;
Expand All @@ -118,6 +121,7 @@ class CascadeConfig : public RadarConfig {
public:
CascadeConfig() = default;
CascadeConfig(const std::filesystem::path& calibDir, const int& nAzimuthBeams = 128, const int& nElevationBeams = 32);
explicit CascadeConfig(const Json::Value& root) { fromJson(root); }

protected:
void init(const std::filesystem::path& calibDir) override;
Expand Down
2 changes: 1 addition & 1 deletion include/cuda/coloradar_cuda.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COLORADAR_CUDA_H
#define COLORADAR_CUDA_H

#include "coloradar_tools.h"
#include "main.h"
#include "cuda/kernels.h"

#include <cuda_runtime.h>
Expand Down
Loading