本文整理汇总了C++中Sensor::get_feature方法的典型用法代码示例。如果您正苦于以下问题:C++ Sensor::get_feature方法的具体用法?C++ Sensor::get_feature怎么用?C++ Sensor::get_feature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor::get_feature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: random
simulator<ControlModel, ObservationModel, Controller, Sensor>
::simulator (boost::program_options::variables_map& options, unsigned int seed,
const typename ControlModel::builder& control_model_builder,
const typename ObservationModel::builder& observation_model_builder,
Controller& controller, const Sensor& sensor) {
const unsigned int sensor_skip = options["sensor-skip"].as<unsigned int>();
const double dt = options["dt"].as<double>();
random_source random (seed);
{
auto& map = this->get_feature_map();
for (size_t i = 0; i < sensor.num_features(); ++i) {
map.emplace_hint (map.end(), i, sensor.get_feature(i));
}
}
this->set_initial_state (controller.initial_state());
state_type state;
auto current_state = [&]() { return this->get_initial_state() + state; };
auto sense = [&]() {
using namespace std::placeholders;
sensor.template sense<ObservationModel> (observation_model_builder, random, current_state(),
std::bind (&simulator::add_observation_now, this, _1, _2));
};
sense();
while (!controller.finished()) {
const auto control = controller.template control<ControlModel> (current_state(), dt);
this->add_control (dt, control);
state += control_model_builder(control, dt).proposal()(random);
this->get_trajectory().push_back_accumulated (state);
if (this->current_timestep() % sensor_skip == 0) sense();
}
}