16 #ifndef OPENKALMAN_UNSCENTED_HPP 17 #define OPENKALMAN_UNSCENTED_HPP 24 template<
typename Parameters>
32 static constexpr
double alpha = 0.001;
34 static constexpr
double beta = 2.0;
37 template<std::
size_t dim>
38 static constexpr
double kappa = 0.0;
46 static constexpr
double alpha = 0.001;
48 static constexpr
double beta = 2.0;
51 template<std::
size_t dim>
52 static constexpr
double kappa = 3. - double(dim);
71 #if __cpp_nontype_template_args >= 201911L 72 template<
typename Parameters = UnscentedParametersStateEstimation>
74 template<
typename Parameters = UnscentedParametersStateEstimation>
84 template<std::
size_t dim>
85 static constexpr std::size_t sigma_point_count = dim * 2 + 1;
92 static constexpr
auto alpha = Parameters::alpha;
99 static constexpr
auto beta = Parameters::beta;
107 template<std::
size_t dim>
110 return Parameters::template kappa<dim> / (dim + Parameters::template kappa<dim>);
119 template<std::
size_t dim>
122 return 0.5 / (dim + Parameters::template kappa<dim>);
142 sigma_points_impl(
const D& d,
const Ds&...ds)
144 using Scalar =
typename DistributionTraits<D>::Scalar;
145 using Coeffs =
typename DistributionTraits<D>::StaticDescriptor;
147 constexpr
auto points_count = sigma_point_count<dim>;
148 constexpr
auto dim_i = index_dimension_of_v<D, 0>;
149 constexpr
auto frame_size = dim_i * 2;
150 constexpr Scalar gamma_L = alpha * alpha * (Parameters::template kappa<dim> + dim);
153 if constexpr(1 + frame_size == points_count)
156 static_assert(
sizeof...(ds) == 0);
158 const auto m0 = make_zero<M0>(Dimensions<dim_i>{}, Dimensions<1>{});
160 static_assert(index_dimension_of_v<decltype(ret), 1> == points_count);
161 return std::tuple {std::move(ret)};
163 else if constexpr (pos == 0)
167 const auto m0 = make_zero<M0>(Dimensions<dim_i>{}, Dimensions<1>{});
168 constexpr
auto width = points_count - (1 + frame_size);
170 const auto mright = make_zero<Mright>(Dimensions<dim_i>{}, Dimensions<width>{});
172 static_assert(index_dimension_of_v<decltype(ret), 1> == points_count);
173 return std::tuple_cat(std::tuple {std::move(ret)}, sigma_points_impl<dim, 1 + frame_size>(ds...));
175 else if constexpr (pos + frame_size < points_count)
179 const auto mleft = make_zero<Mleft>(Dimensions<dim_i>{}, Dimensions<pos>{});
180 constexpr
auto width = points_count - (pos + frame_size);
182 const auto mright = make_zero<Mright>(Dimensions<dim_i>{}, Dimensions<width>{});
183 auto ret {make_self_contained(
concatenate_horizontal(std::move(mleft), delta, -delta, std::move(mright)))};
184 static_assert(index_dimension_of_v<decltype(ret), 1> == points_count);
185 return std::tuple_cat(std::tuple {std::move(ret)}, sigma_points_impl<dim, pos + frame_size>(ds...));
190 static_assert(
sizeof...(ds) == 0);
192 const auto mleft = make_zero<Mleft>(Dimensions<dim_i>{}, Dimensions<pos>{});
194 static_assert(index_dimension_of_v<decltype(ret), 1> == points_count);
195 return std::tuple {std::move(ret)};
208 #ifdef __cpp_concepts 211 template<
typename...Dist, std::enable_if_t<
212 (gaussian_distribution<Dist> and ...) and (
sizeof...(Dist) > 0),
int> = 0>
217 constexpr
auto dim = (index_dimension_of_v<Dist, 0> + ...);
218 return sigma_points_impl<dim>(ds...);
225 #endif //OPENKALMAN_UNSCENTED_HPP Definition: ScaledSigmaPointsBase.hpp:37
auto make_vector_space_adapter(Arg &&arg, Descriptors &&descriptors)
If necessary, wrap an object in a wrapper that adds vector space descriptors for each index...
Definition: make_vector_space_adapter.hpp:37
Unscented parameters for use in parameter estimation.
Definition: Unscented.hpp:43
decltype(auto) constexpr concatenate_horizontal(V &&v, Vs &&... vs)
Concatenate one or more matrix objects vertically.
Definition: typed-matrix-overloads.hpp:308
decltype(auto) constexpr to_dense_object(Arg &&arg)
Convert the argument to a dense, writable matrix of a particular scalar type.
Definition: to_dense_object.hpp:37
The root namespace for OpenKalman.
Definition: basics.hpp:34
Scaled symmetric sigma points.
Definition: Unscented.hpp:25
static auto sample_points(const Dist &...ds)
Calculate the scaled and translated sigma points, given a prior distribution and noise terms...
Definition: Unscented.hpp:215
std::decay_t< decltype(make_dense_object< T, layout, S >(std::declval< D >()))> dense_writable_matrix_t
An alias for a dense, writable matrix, patterned on parameter T.
Definition: dense_writable_matrix_t.hpp:38
constexpr bool gaussian_distribution
T is a Gaussian distribution.
Definition: object-types.hpp:182
static constexpr auto unscaled_W()
The unscaled W parameter.
Definition: Unscented.hpp:120
Mean(V &&) -> Mean< Dimensions< index_dimension_of_v< V, 0 >>, passable_t< V >>
Deduce template parameters from a typed_matrix_nestable, assuming untyped coordinates::pattern.
static constexpr auto unscaled_W0()
The unscaled W0 parameter.
Definition: Unscented.hpp:108
Definition: basics.hpp:48