Skip to content

Commit

Permalink
integrating acc to get velocity, then setting y and z direction equal…
Browse files Browse the repository at this point in the history
… to 0
  • Loading branch information
JEFFCHANG0501 committed May 24, 2022
1 parent dfdc96d commit a927b9a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/imu_integrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ void ImuIntegrator::calcPosition(const geometry_msgs::Vector3& msg)
Eigen::Vector3d acc_g = pose.orientation * acc_1;

// calculate velocity from imu linear acceleration, then get imu position
// velocity = velocity + dt * (acc_g - gravity);
// pose.pos = pose.pos + dt * velocity;
velocity = velocity + dt * (acc_g - gravity);
Eigen::Vector3d vel(velocity[0], 0, 0);
pose.pos = pose.pos + dt * pose.orientation * vel;
// std::cout << vel << std::endl << std::endl;

// get speed from /lgsvl/vehicle_odom, then calculate imu position
Eigen::Vector3d speed(v_speed, 0, 0);
pose.pos = pose.pos + dt * pose.orientation * speed;
// Eigen::Vector3d speed(v_speed, 0, 0);
// pose.pos = pose.pos + dt * pose.orientation * speed;
}

void ImuIntegrator::publishMessage()
Expand Down

0 comments on commit a927b9a

Please sign in to comment.