本文整理汇总了C++中eigen::Matrix::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::fill方法的具体用法?C++ Matrix::fill怎么用?C++ Matrix::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::Matrix
的用法示例。
在下文中一共展示了Matrix::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: delta_change
void KalmanFilter::delta_change(){
float dt2_2 = (pow(delta_t_,2))/2;
//Recompute A, state transition
A_ = Eigen::Matrix<float, 9, 9>::Identity();
A_ << 1., 0., 0., delta_t_, 0., 0., dt2_2, 0., 0.,
0., 1., 0., 0., delta_t_, 0., 0., dt2_2, 0.,
0., 0., 1., 0., 0., delta_t_, 0., 0., dt2_2,
0., 0., 0., 1., 0., 0., delta_t_, 0., 0.,
0., 0., 0., 0., 1., 0., 0., delta_t_, 0.,
0., 0., 0., 0., 0., 1., 0., 0., delta_t_,
0., 0., 0., 0., 0., 0., 1., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 1., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 1.;
//Recompute Q, covariance process noise
Eigen::Matrix<float, 9, 3> G;
G.fill(0.);
//Process noise only in the highest order term
G(6,0) = delta_t_;
G(7,1) = delta_t_;
G(8,2) = delta_t_;
Q_ = G * sigma_jerk_ * G.transpose();
}
示例2: lstsq
void lstsq(const Eigen::Matrix<ScalarT, Eigen::Dynamic, Eigen::Dynamic> &A,
const Eigen::Matrix<ScalarT, Eigen::Dynamic, 1> &b,
Eigen::Matrix<ScalarT, Eigen::Dynamic, 1> &x)
{
if (A.rows() == A.cols()) {
// solve via pivoting
x = A.colPivHouseholderQr().solve(b);
} else if (A.rows() > A.cols()) {
// solving via SVD
x = A.jacobiSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(b);
} else {
x.fill(std::numeric_limits<ScalarT>::quiet_NaN());
std::cout << "Error solving linear system" << std::endl;
return;
}
}
示例3: fill
void fill(Eigen::Matrix<T,R,C>& x, const S& y) {
x.fill(y);
}
示例4: main
int main(int argc, char **argv) {
/* INS ins(Eigen::Quaterniond(0, 1, 0, 0),
Eigen::Vector3d(1, 2, 3),
Eigen::Vector3d(4, 5, 6),
Eigen::Vector3d(0, 0, -9.8));
INS::Measurement measurement_prev = {
Eigen::Vector3d(.1, .1, .1),
Eigen::Vector3d(-.2, -.2, -.2)
};
INS::Measurement measurement = {
Eigen::Vector3d(.11, .11, .11),
Eigen::Vector3d(-.21, -.21, -.21)
};
ins.update(measurement_prev, .01);
ins.update(measurement, .01);
const INS::State &state = ins.getState();
std::cout << state.p_nav << std::endl;*/
/* Kalman kalman;
kalman.x = Eigen::Matrix<double, 15, 1>::Ones();
kalman.P = Eigen::Matrix<double, 15, 15>::Ones() + 10*Eigen::Matrix<double, 15, 15>::Identity();
INS::State state;
state.q_imu2nav = Eigen::Quaterniond(1, 2, 3, 4).normalized();
state.w_imu = Eigen::Vector3d(1, 2, 3);
state.a_imu = Eigen::Vector3d(-1, -3, 5);
state.g_nav = Eigen::Vector3d(0, 0, -9.8);
Kalman::PredictConfig predict;
predict.R_g = Eigen::DiagonalMatrix<double, 3, 3>(
4.6254e-6, 4.6254e-6, 4.6254e-6);
predict.R_a = Eigen::DiagonalMatrix<double, 3, 3>(
1.1413e-6, 1.1413e-6, 1.1413e-6);
predict.Q_b_g = Eigen::DiagonalMatrix<double, 3, 3>(
1.2217e-8, 1.2217e-8, 1.2217e-8);
predict.Q_b_a = Eigen::DiagonalMatrix<double, 3, 3>(
1.9700e-7, 1.9700e-7, 1.9700e-7);
kalman.predict(state, predict, .01);
std::cout << kalman.x << std::endl;
std::cout << kalman.P << std::endl;*/
Kalman kalman;
kalman.x = Eigen::Matrix<double, 15, 1>::Ones();
kalman.P = 1e-6*Eigen::Matrix<double, 15, 15>::Ones() + 10*Eigen::Matrix<double, 15, 15>::Identity();
INS::State state;
state.q_imu2nav = Eigen::Quaterniond(1, 2, 3, 4).normalized();
state.w_imu = Eigen::Vector3d(1, 2, 3);
state.a_imu = Eigen::Vector3d(-1, -3, 5);
state.g_nav = Eigen::Vector3d(0, 0, -9.8);
state.v_nav = Eigen::Vector3d(2, 0, 0);
Kalman::UpdateConfig update;
update.R_g = Eigen::DiagonalMatrix<double, 3, 3>(
4.6254e-6, 4.6254e-6, 4.6254e-6);
update.R_a = Eigen::DiagonalMatrix<double, 3, 3>(
1.1413e-04, 1.1413e-04, 1.1413e-04);
update.R_m = Eigen::DiagonalMatrix<double, 3, 3>(
1e-6, 1e-6, 1e-6);
update.R_d.fill(0);
for (int i=0; i<4; i++)
update.R_d(i, i) = 4.9e-5;
update.R_z = 3e-3;
update.beam_mat <<
0.5, 0, 0.86603,
-0.5, 0, 0.86603,
0, -0.5, 0.86603,
0, 0.5, 0.86603;
update.r_imu2dvl <<
0, 0, -0.102-0.076;
update.q_imu2dvl = Eigen::Quaterniond(
0.000284, 0.394308, -0.918965, -0.005013);
update.r_imu2depth <<
0.445 - 0.431, 0.102, -0.051 - 0.076;
update.m_nav <<
-2244.2, 24151.0, -40572.8;
Eigen::Matrix<double, 11, 1> z;
z.fill(2);
kalman.update(z, true, true, {{true, true, true, true}}, true, state, update);
// std::cout << kalman.x << std::endl;
// std::cout << kalman.P << std::endl;
}