Skip to content

Commit

Permalink
Corrected code in README. Added some comments to missing cmake proper…
Browse files Browse the repository at this point in the history
…ties. no good solution yet
  • Loading branch information
amock committed Aug 26, 2024
1 parent 3ffb37a commit 79665d6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)

endif()

set(CUDA_STANDARD 17)
# set(CUDA_STANDARD 14)

include(CheckLanguage)

Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ This examples shows how to simulate ranges of 100 Velodyne VLP-16 sensor using E
```c++
// Map
#include <rmagine/map/EmbreeMap.hpp>
// Sensor Models
// Sensor models
#include <rmagine/types/sensor_models.h>
// Predefined sensor models: e.g. VLP-16
#include <rmagine/types/sensors.h>
// Simulators
#include <rmagine/simulation/SphereSimulatorEmbree.hpp>

Expand All @@ -59,19 +61,20 @@ The following code loads a map "my_mesh.ply" and simulates 100 Velodyne VLP-16 s
```c++
// loading a map from disk
std::string path_to_mesh = "my_mesh.ply";
rm::EmbreeMapPtr map = rm::load_embree_map(path_to_mesh);
rm::EmbreeMapPtr map = rm::import_embree_map(path_to_mesh);
// defining a model
rm::SphericalModel velo_model = rm::vlp16_900();
// defining a sensor model
// We use a predefined VLP-16 sensor model here
rm::SphericalModel sensor_model = rm::vlp16_900();
// construct a simulator
// construct a simulator. set sensor model and
// map to operate on
rm::SphereSimulatorEmbree sim;
sim.setModel(sensor_model);
sim.setMap(map);
sim.setModel(velo_model);
// 100 Transformations between base and map. e.g. poses of the robot
rm::Memory<rm::Transform, rm::RAM> Tbm(100);
for(size_t i=0; i < Tbm.size(); i++)
{
rm::Transform T = rm::Transform::Identity();
Expand All @@ -95,18 +98,19 @@ using ResultT = rm::Bundle<
rm::Hits<rm::RAM>,
rm::Ranges<rm::RAM>
>;
// querying every attribute with 'rm::IntAttrAll' instead of 'ResultT'
// for querying all attributes at once we provide the 'rm::IntAttrAll'-type
// instead of 'ResultT' for convenience
ResultT result = sim.simulate<ResultT>(poses);
ResultT result = sim.simulate<ResultT>(Tbm);
// result.hits, result.ranges contain the resulting attribute buffers
std::cout << "printing the first ray's range: " << result.ranges[0] << std::endl;
// or slice the results for the scan of pose 5
auto ranges5 = result.ranges(5 * model.size(), 6 * model.size());
auto ranges5 = result.ranges(5 * sensor_model.size(), 6 * sensor_model.size());
std::cout << "printing the first ray's range of the fifth scan: " << ranges5[0] << std::endl;
```

More detailed examples explaining each step and how to customize it to your needs are explained in the [Wiki](https://github.com/uos/rmagine/wiki). More examples can be found here: https://github.com/aock/rmagine_examples.
More detailed examples explaining each step and how to customize it to your needs are explained in the [Wiki](https://github.com/uos/rmagine/wiki). More examples can be found here: https://github.com/amock/rmagine_examples.

## Citation

Expand Down
3 changes: 1 addition & 2 deletions src/rmagine_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ target_link_libraries(rmagine-core
${OpenMP_CXX_LIBRARIES}
)

target_compile_features(rmagine-core PRIVATE cxx_std_17)

set_target_properties(rmagine-core
PROPERTIES
EXPORT_NAME core
SOVERSION ${rmagine_VERSION_MAJOR}
VERSION ${rmagine_VERSION}
COMPONENT core
CXX_STANDARD 17
)

# TODO: do this:
Expand Down
17 changes: 14 additions & 3 deletions src/rmagine_cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,22 @@ add_dependencies(rmagine-cuda
rmagine-core
)

# enable_language(CUDA)
# target_compile_features(rmagine-cuda PUBLIC cxx_std_17 cuda_std_17)

# Problem: We need CUDA C++17 support, since some template functions
# have constexpr etc. Ubuntu 20s standard cmake (version 3.16) does not support
# to set the cuda standard higher than 14. This is not a clean solution.
# Clean solution:
# 1. Make a warning for Ubuntu 20 / cmake 3.16 solution to compile at own risk.
# 2. Compile for newer Ubtunu/cmake versions with a proper target property
set_target_properties(rmagine-cuda
PROPERTIES
EXPORT_NAME cuda
SOVERSION ${rmagine_VERSION_MAJOR}
VERSION ${rmagine_VERSION}
EXPORT_NAME cuda
SOVERSION ${rmagine_VERSION_MAJOR}
VERSION ${rmagine_VERSION}
# CUDA_STANDARD 17 -> only works for
# CXX_STANDARD 17
)

add_library(rmagine::cuda ALIAS rmagine-cuda)
Expand Down
9 changes: 5 additions & 4 deletions src/rmagine_embree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ add_dependencies(rmagine-embree
rmagine-core
)

target_compile_features(rmagine-embree PRIVATE cxx_std_17)
# target_compile_features(rmagine-embree PUBLIC cxx_std_17)

set_target_properties(rmagine-embree
PROPERTIES
EXPORT_NAME embree
SOVERSION ${rmagine_VERSION_MAJOR}
VERSION ${rmagine_VERSION}
EXPORT_NAME embree
SOVERSION ${rmagine_VERSION_MAJOR}
VERSION ${rmagine_VERSION}
# CXX_STANDARD 17
)

add_library(rmagine::embree ALIAS rmagine-embree)
Expand Down
3 changes: 3 additions & 0 deletions src/rmagine_optix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ target_include_directories(rmagine-optix PUBLIC
# ${OptiX_INCLUDE_DIRS}
# )

# Must be public, since headers contain optionals
# target_compile_features(rmagine-optix PUBLIC cxx_std_17)

target_link_libraries(rmagine-optix
${OptiX_LIBRARIES}
rmagine-cuda
Expand Down

0 comments on commit 79665d6

Please sign in to comment.