-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/cpp_api_yaml_support' into feature/depth_image_…
…renderer
- Loading branch information
Showing
35 changed files
with
584 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
example_map.wvmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Binaries | ||
add_executable(example_pipeline example_pipeline.cc) | ||
set_wavemap_target_properties(example_pipeline) | ||
target_link_libraries(example_pipeline PUBLIC | ||
wavemap::wavemap_core | ||
wavemap::wavemap_io | ||
wavemap::wavemap_pipeline) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# NOTE: More examples can be found in the `interfaces/ros1/wavemap_ros/config` | ||
# directory, and all available params are documented at: | ||
# https://ethz-asl.github.io/wavemap/pages/parameters | ||
|
||
map: | ||
type: hashed_chunked_wavelet_octree | ||
min_cell_width: { meters: 0.02 } | ||
|
||
map_operations: | ||
- type: threshold_map | ||
once_every: { seconds: 2.0 } | ||
- type: prune_map | ||
once_every: { seconds: 10.0 } | ||
|
||
measurement_integrators: | ||
your_camera: | ||
projection_model: | ||
type: pinhole_camera_projector | ||
width: 640 | ||
height: 480 | ||
fx: 320.0 | ||
fy: 320.0 | ||
cx: 320.0 | ||
cy: 240.0 | ||
measurement_model: | ||
type: continuous_ray | ||
range_sigma: { meters: 0.01 } | ||
scaling_free: 0.2 | ||
scaling_occupied: 0.4 | ||
integration_method: | ||
type: hashed_chunked_wavelet_integrator | ||
min_range: { meters: 0.1 } | ||
max_range: { meters: 5.0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include <wavemap/core/map/map_factory.h> | ||
#include <wavemap/io/config/file_conversions.h> | ||
#include <wavemap/io/map/file_conversions.h> | ||
#include <wavemap/pipeline/pipeline.h> | ||
|
||
using namespace wavemap; | ||
int main(int, char** argv) { | ||
// Settings | ||
const std::string config_name = "example_config.yaml"; | ||
const std::string output_map_name = "example_map.wvmp"; | ||
const std::filesystem::path current_dir = | ||
std::filesystem::canonical(__FILE__).parent_path(); | ||
const std::filesystem::path config_path = current_dir / config_name; | ||
const std::filesystem::path output_map_path = current_dir / output_map_name; | ||
|
||
// Load the config | ||
std::cout << "Loading config file: " << config_path << std::endl; | ||
const auto params = io::yamlFileToParams(config_path); | ||
CHECK(params.has_value()); | ||
|
||
// Create the map | ||
const auto map_config = params->getChild("map"); | ||
CHECK(map_config.has_value()); | ||
MapBase::Ptr map = MapFactory::create(map_config.value()); | ||
CHECK_NOTNULL(map); | ||
|
||
// Create measurement integration pipeline | ||
Pipeline pipeline{map}; | ||
|
||
// Add map operations to pipeline | ||
const auto map_operations = | ||
params->getChildAs<param::Array>("map_operations"); | ||
CHECK(map_operations); | ||
for (const auto& operation_params : map_operations.value()) { | ||
pipeline.addOperation(operation_params); | ||
} | ||
|
||
// Add measurement integrators to pipeline | ||
const auto measurement_integrators = | ||
params->getChildAs<param::Map>("measurement_integrators"); | ||
CHECK(measurement_integrators); | ||
for (const auto& [integrator_name, integrator_params] : | ||
measurement_integrators.value()) { | ||
pipeline.addIntegrator(integrator_name, integrator_params); | ||
} | ||
|
||
// Define a depth camera image for illustration | ||
const int width = 640; | ||
const int height = 480; | ||
Image<> depth_image{width, height}; | ||
depth_image.setToConstant(2.f); | ||
|
||
// Define a depth camera pose for illustration | ||
Transformation3D T_W_C{}; | ||
// Set the camera's [x, y, z] position | ||
T_W_C.getPosition() = {0.f, 0.f, 0.f}; | ||
// Set the camera's orientation | ||
// For example as a quaternion's [w, x, y, z] coefficients | ||
T_W_C.getRotation() = Rotation3D{0.5f, -0.5f, -0.5f, 0.5f}; | ||
// NOTE: Alternatively, the rotation can also be loaded from a rotation | ||
// matrix, or T_W_C can be initialized from a transformation matrix. | ||
|
||
// Integrate the measurement | ||
pipeline.runPipeline({"your_camera"}, PosedImage<>{T_W_C, depth_image}); | ||
|
||
// Measure the map's size | ||
const size_t map_size_KB = map->getMemoryUsage() / 1024; | ||
std::cout << "Created map of size: " << map_size_KB << " KB" << std::endl; | ||
|
||
// Save the map to disk | ||
std::cout << "Saving it to: " << output_map_path << std::endl; | ||
io::mapToFile(*map, output_map_path); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.