本文整理汇总了C++中KalmanFilter::estimate方法的典型用法代码示例。如果您正苦于以下问题:C++ KalmanFilter::estimate方法的具体用法?C++ KalmanFilter::estimate怎么用?C++ KalmanFilter::estimate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KalmanFilter
的用法示例。
在下文中一共展示了KalmanFilter::estimate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: A
TEST(KalmanFilterTest, validationEffect)
{
KalmanFilter kf;
MatrixXd A(1,1); A << 1;
kf.setStateTransitionModel(A);
MatrixXd H(1,1); H << 1;
kf.setObservationModel(H);
MatrixXd Q(1,1); Q << 0.1;
kf.setProcessNoiseCovariance(Q);
MatrixXd R(1,1); R << 10;
kf.setMeasurementNoiseCovariance(R);
// validate has an effect?
InputValue measurement(1);
Input in(measurement);
Output out;
EXPECT_THROW(out = kf.estimate(in), IEstimator::estimator_error); // "not yet validated"
EXPECT_NO_THROW(kf.validate());
// changing a parameter -> KF must be re-validated
kf.setProcessNoiseCovariance(Q);
EXPECT_THROW(out = kf.estimate(in), IEstimator::estimator_error); // "not yet validated"
EXPECT_NO_THROW(kf.validate());
// KF should now be released and return an estimate (should not be
// the default)
EXPECT_NO_THROW(out = kf.estimate(in));
EXPECT_GT(out.size(), 0);
EXPECT_EQ(kf.getState().size(), out.size());
}
示例2: tracking
void TargetTracker::tracking(std::vector<TargetState> states)
{
std::vector<TargetState>::const_iterator iter;
TargetState tState;
KalmanFilter *filter;
SingleTarget *target;
qDebug() << "测量值:";
for (iter = states.begin(); iter != states.end(); ++iter)
{
tState = *iter;
tState.state.print();
filter = findFilter(tState.groupId, tState.targetId);
target = findTarget(tState.groupId, tState.targetId);
if (target == NULL) continue;
if (filter == NULL) continue;
if (target->getStateCount() == 0) {
// 第一次获取目标的状态,直接保存,不做任何计算。
target->addState(tState.state);
filter->setState(tState.state.getData());
continue;
}
//计算一步预测值
Matrix matrix = filter->estimate();
// 根据测量值更新预测数据
filter->updateByMeasure(tState.state.getData());
State s;
s.setData(matrix);
s.setTime(tState.time);
target->addState(s);
}
//项目验收后去掉
initMessage();
printTargetGroups();
}