13 theta_(theta * (M_PI/180.0)),
14 cone_angle_(cone_angle * (M_PI/180.0)),
15 cone_dir_(Vector4f(0.0, 0.0, 1.0, 0.0)),
16 generator_(std::mt19937_64(seed)),
17 distribution_pos_xy_(std::normal_distribution<float>(0.0, q_xy)),
18 distribution_pos_z_(std::normal_distribution<float>(0.0, q_z)),
19 distribution_theta_(std::normal_distribution<float>(0.0, theta_)),
20 distribution_cone_(std::uniform_real_distribution<float>(0.0, 1.0)),
21 gaussian_random_pos_xy_([&] {
return (distribution_pos_xy_)(generator_); }),
22 gaussian_random_pos_z_([&] {
return (distribution_pos_z_)(generator_); }),
23 gaussian_random_theta_([&] {
return (distribution_theta_)(generator_); }),
24 gaussian_random_cone_([&] {
return (distribution_cone_)(generator_); }) { }
39 cone_angle_(brown.cone_angle_),
40 cone_dir_(brown.cone_dir_),
41 generator_(brown.generator_),
42 distribution_pos_xy_(brown.distribution_pos_xy_),
43 distribution_pos_z_(brown.distribution_pos_z_),
44 distribution_theta_(brown.distribution_theta_),
45 distribution_cone_(brown.distribution_cone_),
46 gaussian_random_pos_xy_(brown.gaussian_random_pos_xy_),
47 gaussian_random_pos_z_(brown.gaussian_random_pos_z_),
48 gaussian_random_theta_(brown.gaussian_random_theta_),
49 gaussian_random_cone_(brown.gaussian_random_cone_) { }
70 brown.cone_angle_ = 0.0;
80 *
this = std::move(tmp);
107 brown.cone_angle_ = 0.0;
115 prop_state = cur_state;
123 MatrixXf sample(7, mot_state.cols());
126 mot_state.topRows<3>() += sample.topRows<3>();
133 MatrixXf sample(7, num);
136 for (
unsigned int i = 0; i < num; ++i)
146 for(
unsigned int i = 0; i < num; ++i)
150 float x = sqrt(1 - (z * z)) * cos(phi);
151 float y = sqrt(1 - (z * z)) * sin(phi);
165 for (
unsigned int i = 0; i < current_vec.cols(); ++i)
167 float ang = current_vec(3, i) + disturbance_vec(3, i);
169 if (ang > M_PI) ang -= 2.0 * M_PI;
170 else if (ang <= -M_PI) ang += 2.0 * M_PI;
174 Vector3f def_dir(0.0, 0.0, 1.0);
176 Vector3f u = def_dir.cross(current_vec.col(i).head<3>()).normalized();
178 float rot =
static_cast<float>(std::acos(current_vec.col(i).head<3>().dot(def_dir)));
183 Matrix3f cross_matrix;
184 cross_matrix << 0, -u(2), u(1),
188 Matrix3f R = std::cos(rot) * Matrix3f::Identity() + std::sin(rot) * cross_matrix + (1 - std::cos(rot)) * (u * u.transpose());
191 current_vec.col(i).head<3>() = (R * disturbance_vec.col(i).head<3>()).normalized();
192 current_vec(3, i) = ang;
std::function< float()> gaussian_random_pos_xy_
std::normal_distribution< float > distribution_pos_xy_
BrownianMotionPose & operator=(const BrownianMotionPose &bm)
void propagate(const Eigen::Ref< const Eigen::MatrixXf > &cur_state, Eigen::Ref< Eigen::MatrixXf > prop_state) override
std::normal_distribution< float > distribution_pos_z_
Eigen::Vector4f cone_dir_
~BrownianMotionPose() noexcept
void addAxisangleDisturbance(const Eigen::Ref< const Eigen::MatrixXf > &disturbance_vec, Eigen::Ref< Eigen::MatrixXf > current_vec)
void motion(const Eigen::Ref< const Eigen::MatrixXf > &cur_state, Eigen::Ref< Eigen::MatrixXf > mot_state) override
std::function< float()> gaussian_random_pos_z_
std::uniform_real_distribution< float > distribution_cone_
std::normal_distribution< float > distribution_theta_
BrownianMotionPose() noexcept
Eigen::MatrixXf getNoiseSample(const int num) override
std::function< float()> gaussian_random_cone_
std::mt19937_64 generator_
std::function< float()> gaussian_random_theta_