Skip to content

Commit

Permalink
Avoid to use magic numbers in SE3Task class
Browse files Browse the repository at this point in the history
  • Loading branch information
GiulioRomualdi committed Jan 12, 2021
1 parent 72041a7 commit bfa5eaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/TSID/include/BipedalLocomotion/TSID/SE3Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class SE3Task : public Task

iDynTree::FrameIndex m_frameIndex; /**< Frame controlled by the OptimalControlElement */

static constexpr std::size_t m_spatialVelocitySize{6}; /**< Size of the spatial velocity vector. */

public:
/**
* Initialize the planner.
Expand Down
7 changes: 4 additions & 3 deletions src/TSID/src/SE3Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ bool SE3Task::initialize(std::weak_ptr<ParametersHandler::IParametersHandler> pa
return false;
}

if (m_robotAccelerationVariable.size != m_kinDyn->getNrOfDegreesOfFreedom() + 6)
if (m_robotAccelerationVariable.size
!= m_kinDyn->getNrOfDegreesOfFreedom() + m_spatialVelocitySize)
{
std::cerr << errorPrefix << descriptionPrefix << frameName
<< " - Error while retrieving the robot acceleration variable." << std::endl;
Expand Down Expand Up @@ -101,9 +102,9 @@ bool SE3Task::initialize(std::weak_ptr<ParametersHandler::IParametersHandler> pa
m_description = std::string(descriptionPrefix) + frameName + ".";

// resize the matrices
m_A.resize(6, variablesHandler.getNumberOfVariables());
m_A.resize(m_spatialVelocitySize, variablesHandler.getNumberOfVariables());
m_A.setZero();
m_b.resize(6);
m_b.resize(m_spatialVelocitySize);

return true;
}
Expand Down

0 comments on commit bfa5eaa

Please sign in to comment.