Skip to content

Commit

Permalink
Merge pull request #602 from tongtybj/PR/feature/estimation/imu
Browse files Browse the repository at this point in the history
[Estimation][IMU] refactor the index designation of KF based estimation result
  • Loading branch information
tongtybj authored Apr 12, 2024
2 parents ce6754c + 4ad039d commit ec28c14
Showing 1 changed file with 14 additions and 23 deletions.
37 changes: 14 additions & 23 deletions aerial_robot_estimation/src/sensor/imu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,29 +389,20 @@ namespace sensor_plugin

/* publish state date */
state_.header.stamp = imu_stamp_;
tf::Vector3 pos = estimator_->getPos(Frame::BASELINK, aerial_robot_estimation::EGOMOTION_ESTIMATE);
tf::Vector3 vel = estimator_->getVel(Frame::BASELINK, aerial_robot_estimation::EGOMOTION_ESTIMATE);
state_.states[0].state[0].x = pos.x();
state_.states[1].state[0].x = pos.y();
state_.states[2].state[0].x = pos.z();
state_.states[0].state[0].y = vel.x();
state_.states[1].state[0].y = vel.y();
state_.states[2].state[0].y = vel.z();
state_.states[0].state[0].z = acc_w_.x();
state_.states[1].state[0].z = acc_w_.y();
state_.states[2].state[0].z = acc_w_.z();
pos = estimator_->getPos(Frame::BASELINK, aerial_robot_estimation::EXPERIMENT_ESTIMATE);
vel = estimator_->getVel(Frame::BASELINK, aerial_robot_estimation::EXPERIMENT_ESTIMATE);
state_.states[0].state[1].x = pos.x();
state_.states[1].state[1].x = pos.y();
state_.states[2].state[1].x = pos.z();
state_.states[0].state[1].y = vel.x();
state_.states[1].state[1].y = vel.y();
state_.states[2].state[1].y = vel.z();
state_.states[0].state[1].z = acc_w_.x();
state_.states[1].state[1].z = acc_w_.y();
state_.states[2].state[1].z = acc_w_.z();

for (int i = 0; i < 2; i++)
{
tf::Vector3 pos = estimator_->getPos(Frame::BASELINK, i);
tf::Vector3 vel = estimator_->getVel(Frame::BASELINK, i);
state_.states[0].state[i].x = pos.x();
state_.states[1].state[i].x = pos.y();
state_.states[2].state[i].x = pos.z();
state_.states[0].state[i].y = vel.x();
state_.states[1].state[i].y = vel.y();
state_.states[2].state[i].y = vel.z();
state_.states[0].state[i].z = acc_w_.x();
state_.states[1].state[i].z = acc_w_.y();
state_.states[2].state[i].z = acc_w_.z();
}
state_pub_.publish(state_);
}
prev_time = imu_stamp_;
Expand Down

0 comments on commit ec28c14

Please sign in to comment.