-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated imu base estimation. #917
base: master
Are you sure you want to change the base?
Updated imu base estimation. #917
Conversation
@@ -12,7 +12,7 @@ | |||
#include <BipedalLocomotion/ParametersHandler/IParametersHandler.h> | |||
#include <BipedalLocomotion/System/Advanceable.h> | |||
#include <iDynTree/KinDynComputations.h> | |||
#include <iDynTree/Model.h> | |||
#include <iDynTree/Model/Model.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should revert this change, as this way of including iDynTree headers has been deprecated since version 10.0.0
bool isLeftStance; /**< true if the left foot is in contact with the ground */ | ||
bool isRightStance; /**< true if the right foot is in contact with the ground */ | ||
Eigen::VectorXd jointPositions; /**< vector of the robot joint positions */ | ||
Eigen::VectorXd jointVelocities; /**< vector of the robot joint velocities */ | ||
manif::SE3d desiredFootPose; /**< desired orientation and position of the foot | ||
as per footstep planner output */ | ||
manif::SO3d measuredRotation; /**< actual orientation of the foot measured by | ||
on-board IMU */ | ||
manif::SE3d offsetStanceFootPose; /**< Optional offset orientation and position of the foot. | ||
E.g. as per footstep planner output */ | ||
manif::SO3d measuredRotation_L; /**< actual orientation of the left foot measured by | ||
on-board IMU */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a single notation. Either:
isStance_L
andmeasuredRotation_L
or
isLeftStance
andmeasuredLeftRotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this:
isLeftStance and measuredLeftRotation
Eigen::Vector3d toXYZ(const Eigen::Matrix3d& r) | ||
{ | ||
Eigen::Vector3d output; | ||
double& thetaZ = output[0]; // Roll | ||
double& thetaX = output[0]; // Roll | ||
double& thetaY = output[1]; // Pitch | ||
double& thetaX = output[2]; // Yaw | ||
double& thetaZ = output[2]; // Yaw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How comes that you changed the order of the angles and the computations remain the same? Was it bugged before?
m_cornersInLocalFrame.emplace_back(-m_footWidth / 2, -m_footLength / 2, 0); | ||
m_cornersInLocalFrame.emplace_back(+m_footWidth / 2, -m_footLength / 2, 0); | ||
// Frame associated to the base of the robot (whose pose is estimated) | ||
bool ok = populateParameter(baseEstimatorPtr->getGroup("MODEL_INFO"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider storing the output of baseEstimatorPtr->getGroup("MODEL_INFO")
since you are using it multiple times below
// Eigen::Matrix3d stepRot = m_state.footPose_R.rotation().inverse() * m_state.footPose_L.rotation(); | ||
// Eigen::Vector3d stepRotRPY = toXYZ(stepRot); | ||
// manif::SO3d stepRotManif = manif::SO3d(stepRotRPY(0), stepRotRPY(1), stepRotRPY(2)); | ||
// manif::SE3d T_walkRot(m_noTras, stepRotManif); | ||
// manif::SE3d temp = T_walkTras * T_walkRot * m_T_walk * m_T_yawDrift; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover? There is also some other commented code below
} | ||
} | ||
|
||
m_stanceLinkIndex = m_model.getFrameLink(stanceFootFrameIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if both isLeftStance
and isRightStance
are false? Can it happen? Maybe it is worth printing an error in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other comments
manif::SE3d::Tangent baseVelocity; /**< velocity of the robot root link. */ | ||
manif::SE3d footPose_L; /**< pose of the left foot */ | ||
manif::SE3d footPose_R; /**< pose of the right foot */ | ||
Eigen::Vector3d centerOfMassPosition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid propagating the CoM position. In the end the base estimator should provide the base state
std::vector<Eigen::Vector3d> stanceFootShadowCorners; | ||
std::vector<Eigen::Vector3d> stanceFootCorners; | ||
int supportCornerIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add comments for this?
bool isLeftStance; /**< true if the left foot is in contact with the ground */ | ||
bool isRightStance; /**< true if the right foot is in contact with the ground */ | ||
Eigen::VectorXd jointPositions; /**< vector of the robot joint positions */ | ||
Eigen::VectorXd jointVelocities; /**< vector of the robot joint velocities */ | ||
manif::SE3d desiredFootPose; /**< desired orientation and position of the foot | ||
as per footstep planner output */ | ||
manif::SO3d measuredRotation; /**< actual orientation of the foot measured by | ||
on-board IMU */ | ||
manif::SE3d offsetStanceFootPose; /**< Optional offset orientation and position of the foot. | ||
E.g. as per footstep planner output */ | ||
manif::SO3d measuredRotation_L; /**< actual orientation of the left foot measured by | ||
on-board IMU */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this:
isLeftStance and measuredLeftRotation
@@ -120,6 +139,8 @@ class BaseEstimatorFromFootIMU | |||
*/ | |||
const BaseEstimatorFromFootIMUState& getOutput() const override; | |||
|
|||
void resetBaseEstimatorFromFootIMU(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add the documentation to this function?
manif::SE3d m_T_walk; | ||
manif::SE3d m_T_yawDrift; | ||
double m_yawOld; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please comment this quantities?
// MANUAL CORRECTION: measured Roll, Pitch and Yaw. | ||
// double temp_roll = -m_measuredRPY(1); | ||
// double temp_pitch = -m_measuredRPY(0); | ||
// double temp_yaw = -m_measuredRPY(2); | ||
// m_measuredRPY(0) = temp_roll; | ||
// m_measuredRPY(1) = temp_pitch; | ||
// m_measuredRPY(2) = temp_yaw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this code if not required
// desired position. | ||
switch (supportCornerIndex) | ||
// checking that the index of the lowest corner is within the range [0, 3]. | ||
if (!(0 <= m_state.supportCornerIndex <= 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simplify the if state as
if (!(0 <= m_state.supportCornerIndex <= 3)) | |
if (m_state.supportCornerIndex > 3 || m_state.supportCornerIndex < 0) |
// std::cerr << "L FOOT ROTATION IN: " << toXYZ(m_input.measuredRotation_L.rotation()).transpose() << std::endl; | ||
// std::cerr << "L FOOT ROTATION OUT: " << toXYZ(m_state.footPose_L.rotation()).transpose() << std::endl; | ||
// std::cerr << "R FOOT ROTATION IN: " << toXYZ(m_input.measuredRotation_R.rotation()).transpose() << std::endl; | ||
// std::cerr << "R FOOT ROTATION OUT: " << toXYZ(m_state.footPose_R.rotation()).transpose() << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// std::cerr << "L FOOT ROTATION IN: " << toXYZ(m_input.measuredRotation_L.rotation()).transpose() << std::endl; | |
// std::cerr << "L FOOT ROTATION OUT: " << toXYZ(m_state.footPose_L.rotation()).transpose() << std::endl; | |
// std::cerr << "R FOOT ROTATION IN: " << toXYZ(m_input.measuredRotation_R.rotation()).transpose() << std::endl; | |
// std::cerr << "R FOOT ROTATION OUT: " << toXYZ(m_state.footPose_R.rotation()).transpose() << std::endl; |
This PR involves the first stable release of the
BaseEstimatorFromFootIMU
.As agreed with @GiulioRomualdi this PR replaces #792 to solve its conflicts.