Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Add Perlin ground profile generators. #799

Merged
merged 9 commits into from
Jul 13, 2024
8 changes: 7 additions & 1 deletion core/include/jiminy/core/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ namespace jiminy
using std::logic_error::logic_error::what;
};

// Ground profile functors
template<typename ResultType,
ResultType min_ = std::numeric_limits<ResultType>::min(),
ResultType max_ = std::numeric_limits<ResultType>::max()>
class uniform_random_bit_generator_ref;

// Ground profile functors.
// FIXME: use `std::move_only_function` instead of `std::function` when moving to C++23
using HeightmapFunction = std::function<void(const Eigen::Vector2d & /* xy */,
double & /* height */,
Eigen::Ref<Eigen::Vector3d> /* normal */)>;
Expand Down
3 changes: 2 additions & 1 deletion core/include/jiminy/core/robot/model.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#ifndef JIMINY_MODEL_H
#define JIMINY_MODEL_H

#include <optional>

#include "pinocchio/spatial/fwd.hpp" // `pinocchio::SE3`
#include "pinocchio/multibody/model.hpp" // `pinocchio::Model`
#include "pinocchio/multibody/data.hpp" // `pinocchio::Data`
#include "pinocchio/multibody/geometry.hpp" // `pinocchio::GeometryModel`, `pinocchio::GeometryData`
#include "pinocchio/multibody/frame.hpp" // `pinocchio::FrameType` (C-style enum cannot be forward declared)

#include "jiminy/core/fwd.h"
#include "jiminy/core/utilities/random.h" // `uniform_random_bit_generator_ref`


namespace jiminy
Expand Down
10 changes: 5 additions & 5 deletions core/include/jiminy/core/stepper/lie_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ namespace Eigen

#define StateDerivative_SHARED_ADDON \
template<typename Derived, \
typename = typename std::enable_if_t< \
typename = std::enable_if_t< \
is_base_of_template_v<StateDerivativeBase, \
typename internal::traits<Derived>::ValueType>::value, \
void>> \
Expand Down Expand Up @@ -1268,7 +1268,7 @@ namespace Eigen
template< \
typename Derived, \
typename OtherDerived, \
typename = typename std::enable_if_t< \
typename = std::enable_if_t< \
is_base_of_template_v<StateDerivativeBase, \
typename internal::traits<Derived>::ValueType>::value && \
is_base_of_template_v<StateBase, \
Expand All @@ -1290,7 +1290,7 @@ namespace Eigen
} \
\
template<typename Derived, \
typename = typename std::enable_if_t< \
typename = std::enable_if_t< \
is_base_of_template_v<StateDerivativeBase, \
typename internal::traits<Derived>::ValueType>::value, \
void>> \
Expand All @@ -1301,7 +1301,7 @@ namespace Eigen
} \
\
template<typename Derived, \
typename = typename std::enable_if_t< \
typename = std::enable_if_t< \
is_base_of_template_v<StateDerivativeBase, \
typename internal::traits<Derived>::ValueType>::value, \
void>> \
Expand All @@ -1320,7 +1320,7 @@ namespace Eigen
template< \
typename Derived, \
typename OtherDerived, \
typename = typename std::enable_if_t< \
typename = std::enable_if_t< \
is_base_of_template_v<StateBase, \
typename internal::traits<Derived>::ValueType>::value && \
is_base_of_template_v<StateDerivativeBase, \
Expand Down
17 changes: 16 additions & 1 deletion core/include/jiminy/core/utilities/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,23 @@ namespace jiminy
/// \param[in] stepHeight Heigh of the steps.
/// \param[in] stepNumber Number of steps in the ascending or descending direction.
/// \param[in] orientation Orientation of the staircases in the XY plane.
HeightmapFunction JIMINY_DLLAPI stairs(
HeightmapFunction JIMINY_DLLAPI periodicStairs(
double stepWidth, double stepHeight, uint32_t stepNumber, double orientation);

HeightmapFunction JIMINY_DLLAPI unidirectionalRandomPerlinGround(
double wavelength, std::size_t numOctaves, double orientation, uint32_t seed);

HeightmapFunction JIMINY_DLLAPI unidirectionalPeriodicPerlinGround(double wavelength,
double period,
std::size_t numOctaves,
double orientation,
uint32_t seed);

HeightmapFunction JIMINY_DLLAPI randomPerlinGround(
double wavelength, std::size_t numOctaves, uint32_t seed);

HeightmapFunction JIMINY_DLLAPI periodicPerlinGround(
double wavelength, double period, std::size_t numOctaves, uint32_t seed);
}

#endif // JIMINY_GEOMETRY_H
Loading
Loading