Skip to content

Commit

Permalink
Remove includeRcmAsSensor from BerdyOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGrieco committed Jul 6, 2022
1 parent cd01ed7 commit 5811248
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
9 changes: 0 additions & 9 deletions src/estimation/include/iDynTree/Estimation/BerdyHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ struct BerdyOptions
includeAllJointAccelerationsAsSensors(true),
includeAllJointTorquesAsSensors(false),
includeAllNetExternalWrenchesAsSensors(true),
includeRcmAsSensor(false),
includeFixedBaseExternalWrench(false),
baseLink("")
{
Expand Down Expand Up @@ -216,14 +215,6 @@ struct BerdyOptions
*/
bool includeAllNetExternalWrenchesAsSensors;

/*
* If true, includes the Rate of Change of Momentum (RCM) in the task sensors vector.
* It is compatible only with BERDY_FLOATING_BASE and BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES
*
* Default value: false .
*/
bool includeRcmAsSensor;

/**
* Vector of link names that are considered for rate of change of momentum constraint using
* Rate of Change of Momentum (RCM) sensor
Expand Down
23 changes: 5 additions & 18 deletions src/estimation/src/BerdyHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,6 @@ bool BerdyOptions::checkConsistency()
}
}

if(this->includeRcmAsSensor &&
!(this->berdyVariant==BERDY_FLOATING_BASE || this->berdyVariant==BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES))
{
reportError("BerdyOptions","checkConsistency","Impossible to load berdy, as includeRcmAsSensor is supported only by BERDY_FLOATING_BASE or BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES variants");
return false;
}

if(this->includeRcmAsSensor && !this->includeAllNetExternalWrenchesAsDynamicVariables)
{
reportError("BerdyOptions","checkConsistency","Impossible to load berdy, as includeRcmAsSensor can be used only if includeAllNetExternalWrenchesAsDynamicVariables is enabled");
return false;
}

return true;
}

Expand Down Expand Up @@ -342,7 +329,7 @@ bool BerdyHelper::initSensorsMeasurements()
}

// Add Rate of Change of Momentum (RCM) sensor
if (m_options.includeRcmAsSensor)
if (m_options.berdyVariant==BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES)
{
berdySensorTypeOffsets.rcmOffset = m_nrOfSensorsMeasurements;
m_nrOfSensorsMeasurements += 6;
Expand Down Expand Up @@ -1483,7 +1470,7 @@ bool BerdyHelper::computeBerdySensorMatrices(SparseMatrix<iDynTree::ColumnMajor>
////////////////////////////////////////////////////////////////////////
///// Rate of Change of Momentum (RCM) SENSOR
////////////////////////////////////////////////////////////////////////
if (m_options.includeRcmAsSensor)
if (m_options.berdyVariant==BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES)
{
// Get the row index corresponding to the RCM sensor
IndexRange rcmRange = this->getRangeRCMSensorVariable(RCM_SENSOR);
Expand Down Expand Up @@ -1540,7 +1527,7 @@ bool BerdyHelper::initBerdyFloatingBase()
m_nrOfDynamicEquations = 6*m_model.getNrOfLinks() + 6*m_model.getNrOfJoints();
}

if (m_options.includeRcmAsSensor) {
if (m_options.berdyVariant!=BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES) {
if (m_options.rcmConstraintLinkNamesVector.size() == 0)
{
reportInfo("BerdyHelpers","initBerdyFloatingBase","rcmConstraintLinkNamesVector is not initialized using berdy helper options. Considering all the model links");
Expand Down Expand Up @@ -1859,7 +1846,7 @@ void BerdyHelper::cacheSensorsOrdering()
m_sensorsOrdering.push_back(jointSens);
}

if(m_options.includeRcmAsSensor) {
if(m_options.berdyVariant==BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES) {

IndexRange sensorRange = this->getRangeRCMSensorVariable(RCM_SENSOR);

Expand Down Expand Up @@ -2311,7 +2298,7 @@ bool BerdyHelper::serializeSensorVariables(SensorsMeasurements& sensMeas,
///// Rate of Change of Momentum (RCM)
////////////////////////////////////////////////////////////////////////
/// This method serializeSensorVariables is used in Testing for the Berdy estimator helper class
if (m_options.includeRcmAsSensor)
if (m_options.berdyVariant==BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES)
{
IndexRange sensorRange = this->getRangeRCMSensorVariable(RCM_SENSOR);

Expand Down
2 changes: 0 additions & 2 deletions src/estimation/tests/BerdyHelperUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ void testBerdyHelpers(std::string fileName)

// We test the floating base BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES
options.berdyVariant = iDynTree::BERDY_FLOATING_BASE_NON_COLLOCATED_EXT_WRENCHES;
// Include Rate Of Change of Momentum (RCM)
options.includeRcmAsSensor = true;
options.includeAllJointTorquesAsSensors = false;
options.includeAllJointAccelerationsAsSensors = false;
options.includeAllNetExternalWrenchesAsSensors = true;
Expand Down

0 comments on commit 5811248

Please sign in to comment.