-
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
Add accelerometer and gyroscope dynamic models #666
Add accelerometer and gyroscope dynamic models #666
Conversation
7e6d846
to
f721f26
Compare
m_JvdotBase = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerJacobian(m_name).block(0, 0, 6, 6) * | ||
m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getBaseAcceleration().coeffs(); | ||
|
||
m_accRg = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerRotation(m_name).rotation() * m_gravity; |
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.
m_accRg = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerRotation(m_name).rotation() * m_gravity; | |
m_accRg = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerRotation(m_name).act(m_gravity); |
m_linVel = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerVelocity(m_name).coeffs().segment(0, 3); | ||
m_angVel = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerVelocity(m_name).coeffs().segment(3, 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.
you can use manif function instead of segment
{ | ||
m_JdotNu = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerBiasAcceleration(m_name); | ||
|
||
m_JvdotBase = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerJacobian(m_name).block(0, 0, 6, 6) * |
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.
m_JvdotBase = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerJacobian(m_name).block(0, 0, 6, 6) * | |
m_JvdotBase = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerJacobian(m_name).leftCols<6>() * |
m_Jsdotdot = m_kinDynWrapperList[m_subModelsWithAccelerometer[index]]->getAccelerometerJacobian(m_name). | ||
block(0, 6, 6, m_subModelJointAcc[m_subModelsWithAccelerometer[index]].size()) * |
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.
Also here you may use a smarter block operation: https://eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html
m_covariances.resize(m_covSingleVar.size() * m_subModelWithGyro.size()); | ||
for (int index = 0; index < m_subModelWithGyro.size(); index++) | ||
{ | ||
m_covariances.segment(index*m_covSingleVar.size(), m_covSingleVar.size()) = m_covSingleVar; |
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.
m_covariances.segment(index*m_covSingleVar.size(), m_covSingleVar.size()) = m_covSingleVar; | |
m_covariances.segment(index * m_covSingleVar.size(), m_covSingleVar.size()) = m_covSingleVar; |
bool m_useBias{false}; /**< If true the dynamics depends on a bias additively. */ | ||
Eigen::VectorXd m_bias; /**< The bias is initialized and used only if m_useBias is true. False if not specified. */ | ||
std::string m_biasVariableName; /**< Name of the variable containing the bias in the variable handler. */ | ||
bool m_isSubModelListSet{false}; /**< Boolean flag saying if the sub-model list has been set. */ | ||
int m_nrOfSubDynamics; /**< Number of sub-dynamics which corresponds to the number of sub-models. */ | ||
std::vector<std::shared_ptr<SubModelKinDynWrapper>> m_subModelKinDynList; /**< Vector of SubModelKinDynWrapper objects. */ | ||
std::vector<SubModel> m_subModelList; /**< Vector of SubModel objects. */ | ||
std::vector<Eigen::VectorXd> m_subModelJointVel; /**< Updated joint velocities of each sub-model. */ | ||
std::vector<std::size_t> m_subModelWithGyro; /**< List of indeces saying which sub-model in the m_subDynamics list containa the gyroscope. */ | ||
Eigen::VectorXd m_jointVelocityFullModel; /**< Vector of joint velocities. */ | ||
UKFInput m_ukfInput; /**< Input of the UKF used to update the dynamics. */ | ||
std::string m_name; /**< Name of dynamics. */ | ||
std::vector<std::string> m_elements = {}; /**< Elements composing the variable vector. */ | ||
System::VariablesHandler m_stateVariableHandler; /**< Variable handler describing the variables and the sizes in the ukf state vector. */ | ||
|
||
Eigen::VectorXd m_covSingleVar; /**< Covariance of the gyroscope measurement from configuration. */ | ||
manif::SE3d::Tangent m_subModelBaseVel; /**< Submodel base velocity. */ | ||
Eigen::VectorXd m_JvBase; /**< Jacobian times base velocity. */ | ||
Eigen::VectorXd m_Jsdot; /**< Jacobian times joint velocity. */ |
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 yu please call clang-format in this part?
|
||
std::vector<std::string> jointsAndFTs; | ||
jointsAndFTs.insert(jointsAndFTs.begin(), jointList.begin(), jointList.end()); | ||
// jointsAndFTs.insert(jointsAndFTs.end(), ftFramesList.begin(), ftFramesList.end()); |
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.
// jointsAndFTs.insert(jointsAndFTs.end(), ftFramesList.begin(), ftFramesList.end()); |
@@ -52,6 +52,28 @@ if(FRAMEWORK_USE_icub-models AND FRAMEWORK_COMPILE_YarpImplementation) | |||
MANIF::manif | |||
BipedalLocomotion::ManifConversions) | |||
|
|||
add_bipedal_test(NAME AccelerometerMeasurementDynamics |
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.
add_bipedal_test(NAME AccelerometerMeasurementDynamics | |
add_bipedal_test(NAME AccelerometerMeasurementDynamics |
@@ -0,0 +1,236 @@ | |||
/** |
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.
clang format ;)
@@ -0,0 +1,235 @@ | |||
/** |
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.
clang format ;)
f721f26
to
af0923f
Compare
The PR implements two classes
AccelerometerMeasurementDynamics
andGyroscopeMeasurementDynamics
describing the measurement models for the accelerometer and the gyroscope sensors.