-
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
Implementation of Fixed Base Task Space Inverse Dynamics #251
Merged
+1,077
−1
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
daeed80
Implementation of QPFixedBaseTSID
isorrentino fc984ec
Implementation of QPFixedBaseTSIDTest
isorrentino c888062
Documentation of TaskSpaceInverseDynamics interface and QPFixedBaseTS…
isorrentino c39b520
Update the CHANGELOG.md
isorrentino c90f46d
Update QPFixedBaseTSID class after advanceable refactoring
GiulioRomualdi 47ed6ac
Update QPFixedBaseTSIDTest after advanceable refactoring
GiulioRomualdi e886e35
Changes after review.
isorrentino b4bdf17
Priority of SE3Task on the end-effector changed in QPFixedBaseTSIDTest
isorrentino bbd448f
Fix bug in QPFixedBaseTSIDTest
isorrentino 001755f
Modify QPFixedBaseTSIDTest.cpp after rebasing on master
isorrentino 0ff6472
Changes after review of QPFixedBaseTSID
isorrentino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
src/TSID/include/BipedalLocomotion/TSID/QPFixedBaseTSID.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,139 @@ | ||||||||
/** | ||||||||
* @file QPFixedBaseTSID.h | ||||||||
* @authors Ines Sorrentino | ||||||||
* @copyright 2021 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||||||||
* distributed under the terms of the GNU Lesser General Public License v2.1 or any later version. | ||||||||
*/ | ||||||||
|
||||||||
#ifndef BIPEDAL_LOCOMOTION_QP_FIXED_BASE_TSID_H | ||||||||
#define BIPEDAL_LOCOMOTION_QP_FIXED_BASE_TSID_H | ||||||||
|
||||||||
#include <memory> | ||||||||
#include <optional> | ||||||||
#include <functional> | ||||||||
|
||||||||
#include <BipedalLocomotion/ParametersHandler/IParametersHandler.h> | ||||||||
#include <BipedalLocomotion/TSID/TaskSpaceInverseDynamics.h> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Remember to include what you use 😸 |
||||||||
#include <BipedalLocomotion/System/VariablesHandler.h> | ||||||||
|
||||||||
namespace BipedalLocomotion | ||||||||
{ | ||||||||
|
||||||||
namespace TSID | ||||||||
{ | ||||||||
|
||||||||
/** | ||||||||
* QPFixedBaseTSID is a concrete class and implements a task space inverse dynamics. | ||||||||
* The TSID is here implemented as Quadratic Programming (QP) problem. The user should | ||||||||
* set the desired task with the method QPFixedBaseTSID::addTask. Each task has a given | ||||||||
* priority. Currently we support only priority equal to 0 or 1. If the task priority is set to 0 | ||||||||
* the task will be considered as a hard task, thus treated as a constraint. If the priority | ||||||||
* is equal to 1 the task will be embedded in the cost function. The class is also able to treat | ||||||||
* inequality constraints. Note that this class considers just one contact wrench as we assume the | ||||||||
* external wrench acting on only the base link. | ||||||||
*/ | ||||||||
class QPFixedBaseTSID : public TaskSpaceInverseDynamics | ||||||||
{ | ||||||||
/** | ||||||||
* Private implementation | ||||||||
*/ | ||||||||
struct Impl; | ||||||||
std::unique_ptr<Impl> m_pimpl; | ||||||||
|
||||||||
public: | ||||||||
|
||||||||
/** | ||||||||
* Constructor. | ||||||||
*/ | ||||||||
QPFixedBaseTSID(); | ||||||||
|
||||||||
/** | ||||||||
* Destructor. | ||||||||
*/ | ||||||||
~QPFixedBaseTSID(); | ||||||||
|
||||||||
/** | ||||||||
* Add a linear task in the fixed base TSID | ||||||||
* @param task pointer to a given linear task | ||||||||
* @param priority Priority associated to the task. The lower the number the higher the | ||||||||
* priority. | ||||||||
* @param weight weight associated to the task. This parameter is optional. The default value is | ||||||||
* an object that does not contain any value. So is an invalid weight. | ||||||||
* @note currently we support only task with priority 0 or 1. If the priority is set to 0 the | ||||||||
* task will be considered as a constraint. In this case the weight is not required. | ||||||||
* @warning The QPFixedBaseTSID cannot handle inequality tasks (please check | ||||||||
* Task::Type) with priority equal to 1. | ||||||||
* @return true if the task has been added to the TSID. | ||||||||
*/ | ||||||||
bool addTask(std::shared_ptr<System::LinearTask> task, | ||||||||
const std::string& taskName, | ||||||||
std::size_t priority, | ||||||||
std::optional<Eigen::Ref<const Eigen::VectorXd>> weight = {}) override; | ||||||||
|
||||||||
/** | ||||||||
* Get a vector containing the name of the tasks. | ||||||||
* @return an std::vector containing all the names associated to the tasks | ||||||||
*/ | ||||||||
std::vector<std::string> getTaskNames() const override; | ||||||||
|
||||||||
/** | ||||||||
* Get a specific task | ||||||||
* @param name name associated to the task. | ||||||||
* @return a weak ptr associated to an existing task in the TSID. If the task does not exist a | ||||||||
* nullptr is returned. | ||||||||
*/ | ||||||||
std::weak_ptr<System::LinearTask> getTask(const std::string& name) const override; | ||||||||
|
||||||||
/** | ||||||||
* Initialize the TSID algorithm. | ||||||||
* @param handler pointer to the IParametersHandler interface.h | ||||||||
* @note the following parameters are required by the class | ||||||||
* | Parameter Name | Type | Description | Mandatory | | ||||||||
* |:------------------------------------:|:--------:|:--------------------------------------------------------------------------------------------------:|:---------:| | ||||||||
* | `robot_acceleration_variable_name` | `string` | Name of the variable contained in `VariablesHandler` describing the generalized robot acceleration | Yes | | ||||||||
* | `robot_torque_variable_name` | `string` | Name of the variable contained in `VariablesHandler` describing the robot torque | Yes | | ||||||||
* | `verbosity` | `bool` | Verbosity of the solver. Default value `false` | No | | ||||||||
* Where the generalized robot acceleration is a vector containing the base acceleration | ||||||||
(expressed in mixed representation) and the joint accelerations, | ||||||||
* the generalized robot torques is a vector containing the joint torques and the | ||||||||
* @return True in case of success, false otherwise. | ||||||||
*/ | ||||||||
bool initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) override; | ||||||||
|
||||||||
/** | ||||||||
* Finalize the TSID. | ||||||||
* @param handler parameter handler. | ||||||||
* @note You should call this method after you add ALL the tasks. | ||||||||
* @return true in case of success, false otherwise. | ||||||||
*/ | ||||||||
bool finalize(const System::VariablesHandler& handler) override; | ||||||||
|
||||||||
/** | ||||||||
* Solve the fixed base TSID. | ||||||||
* @return true in case of success and false otherwise. | ||||||||
*/ | ||||||||
bool advance() override; | ||||||||
|
||||||||
/** | ||||||||
* Get the outcome of the optimization problem | ||||||||
* @return the state of the TSID. | ||||||||
*/ | ||||||||
const TSIDState& getOutput() const override; | ||||||||
|
||||||||
/** | ||||||||
* Return true if the content of get is valid. | ||||||||
*/ | ||||||||
bool isOutputValid() const override; | ||||||||
|
||||||||
/** | ||||||||
* Set the kinDynComputations object. | ||||||||
* @param kinDyn pointer to a kinDynComputations object. | ||||||||
* @return True in case of success, false otherwise. | ||||||||
*/ | ||||||||
bool setKinDyn(std::shared_ptr<iDynTree::KinDynComputations> kinDyn) override; | ||||||||
}; | ||||||||
|
||||||||
} // namespace TSID | ||||||||
} // namespace BipedalLocomotion | ||||||||
|
||||||||
#endif // BIPEDAL_LOCOMOTION_FIXED_BASE_TSID_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is the reason why the compilation fails in windows
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.
#include <optional>
was missingThere 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
#include <functional>