Program Listing for File stationary_model.hpp
↰ Return to documentation for file (include/beluga/motion/stationary_model.hpp
)
// Copyright 2022-2023 Ekumen, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef BELUGA_MOTION_STATIONARY_MODEL_HPP
#define BELUGA_MOTION_STATIONARY_MODEL_HPP
#include <optional>
#include <random>
#include <tuple>
#include <type_traits>
#include <beluga/type_traits/tuple_traits.hpp>
#include <sophus/se2.hpp>
#include <sophus/so2.hpp>
namespace beluga {
class StationaryModel {
public:
using control_type = std::tuple<Sophus::SE2d, Sophus::SE2d>;
using state_type = Sophus::SE2d;
template <class Control, typename = common_tuple_type_t<Control, control_type>>
[[nodiscard]] auto operator()([[maybe_unused]] Control&&) const {
return [](const state_type& state, auto& gen) {
static thread_local auto distribution = std::normal_distribution<>{0, 0.02};
return state *
Sophus::SE2d{Sophus::SO2d{distribution(gen)}, Eigen::Vector2d{distribution(gen), distribution(gen)}};
};
}
};
} // namespace beluga
#endif