-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5687d7
commit ac8593c
Showing
18 changed files
with
967 additions
and
216 deletions.
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
112 changes: 112 additions & 0 deletions
112
src/Estimators/include/BipedalLocomotion/RobotDynamicsEstimator/JointVelocityDynamics.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,112 @@ | ||
/** | ||
* @file JointVelocityDynamics.h | ||
* @authors Ines Sorrentino | ||
* @copyright 2023 Istituto Italiano di Tecnologia (IIT). This software may be modified and | ||
* distributed under the terms of the BSD-3-Clause license. | ||
*/ | ||
|
||
#ifndef BIPEDAL_LOCOMOTION_ESTIMATORS_JOINT_VELOCITY_DYNAMICS_H | ||
#define BIPEDAL_LOCOMOTION_ESTIMATORS_JOINT_VELOCITY_DYNAMICS_H | ||
|
||
#include <memory> | ||
#include <map> | ||
|
||
#include <BipedalLocomotion/Math/Wrench.h> | ||
#include <BipedalLocomotion/RobotDynamicsEstimator/StateDynamics.h> | ||
#include <BipedalLocomotion/RobotDynamicsEstimator/SubModel.h> | ||
#include <BipedalLocomotion/RobotDynamicsEstimator/SubModelKinDynWrapper.h> | ||
|
||
namespace BipedalLocomotion | ||
{ | ||
namespace Estimators | ||
{ | ||
namespace RobotDynamicsEstimator | ||
{ | ||
|
||
/** | ||
* The JointVelocityDynamics class is a concrete implementation of the StateDynamics. | ||
* Please use this element if you want to use the robot dynaic model to update the joint dynamics. | ||
* The JointVelocityDynamics represents the following equation in the continuous time: | ||
* \f[ | ||
* \ddot{s} = H^{-1} [\tau_{m} - \tau_{F} + (\sum J^T_{FT} f_{FT}) + | ||
* + (\sum J^T_{ext} f_{ext}) - F^T {}^B \dot v - h ] | ||
* \f] | ||
*/ | ||
|
||
class JointVelocityDynamics : public StateDynamics | ||
{ | ||
std::shared_ptr<SubModelKinDynWrapper> m_kinDynWrapper; /**< object containing the kinematics and dynamics properties of a sub-model. */ | ||
SubModel m_subModel; /**< Sub-model object storing information about the model (joints, sensors, applied wrenches) */ | ||
std::map<std::string, Math::Wrenchd> m_FTMap; /**< The map containes names of the ft sensors and values of the wrench */ | ||
std::map<std::string, Math::Wrenchd> m_ExtContactMap; /**< The map containes names of the ft sensors and values of the wrench */ | ||
Eigen::VectorXd m_baseVelocity; /**< Velocity of the base of the sub-model. */ | ||
Eigen::VectorXd m_motorTorqueFullModel; /**< Motor torque vector of full-model. */ | ||
Eigen::VectorXd m_frictionTorqueFullModel; /**< Friction torque vector of full-model. */ | ||
Eigen::VectorXd m_jointVelocityFullModel; /**< Joint velocities of full-model. */ | ||
Eigen::VectorXd m_motorTorque; /**< Motor torque vector of sub-model. */ | ||
Eigen::VectorXd m_frictionTorque; /**< Friction torque vector of sub-model. */ | ||
Eigen::VectorXd m_jointVelocity; /**< Joint velocities of sub-model. */ | ||
Eigen::VectorXd m_jointAcceleration; /**< Joint accelerations of sub-model. */ | ||
Eigen::VectorXd m_totalTorqueFromContacts; /**< Joint torques due to known and unknown contacts on the sub-model. */ | ||
Math::Wrenchd m_wrench; /**< Joint torques due to a specific contact. */ | ||
Eigen::VectorXd m_torqueFromContact; /**< Joint torques due to a specific contact. */ | ||
double m_dT; /**< Sampling time. */ | ||
|
||
void computeTotalTorqueFromContacts(); | ||
|
||
public: | ||
/** | ||
* Set the SubModelKinDynWrapper object. | ||
* @param kinDynWrapper pointer to a SubModelKinDynWrapper object. | ||
* @return True in case of success, false otherwise. | ||
*/ | ||
bool setKinDynWrapper(std::shared_ptr<SubModelKinDynWrapper> kinDynWrapper); | ||
|
||
/** | ||
* Set the SubModel object. | ||
* @param subModel pointer to a SubModel object. | ||
*/ | ||
void setSubModel(SubModel& subModel); | ||
|
||
/** | ||
* Initialize the state dynamics. | ||
* @param paramHandler pointer to the parameters handler. | ||
* @note the following parameters are required by the class | ||
* | Parameter Name | Type | Description | Mandatory | | ||
* |:----------------------------------:|:--------:|:-------------------------------------------------------------------------------------------------------:|:---------:| | ||
* | `name` | `string` | Name of the state contained in the `VariablesHandler` describing the state associated to this dynamics| Yes | | ||
* | `covariance` | `vector` | Process covariances | Yes | | ||
* | `dynamic_model` | `string` | Type of dynamic model describing the state dynamics. | Yes | | ||
* | `elements` | `vector` | Vector of strings describing the list of sub variables composing the state associated to this dynamics.| No | | ||
* | `dT` | `double` | Sampling time. | Yes | | ||
* @return True in case of success, false otherwise. | ||
*/ | ||
bool initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> paramHandler) override; | ||
|
||
/** | ||
* Set Variablehandler object. | ||
* @param variableHandler object. | ||
* @return True in case of success, false otherwise. | ||
*/ | ||
bool setVariableHandler(System::VariablesHandler variableHandler) override; | ||
|
||
/** | ||
* Update the state. | ||
* @return True in case of success, false otherwise. | ||
*/ | ||
bool update() override; | ||
|
||
/** | ||
* Set the state of the ukf needed to update the dynamics. | ||
* @param ukfState reference to the ukf state. | ||
* @return true if the current state has been updated correctly. | ||
*/ | ||
void setState(const Eigen::Ref<const Eigen::VectorXd> ukfState) override; | ||
|
||
}; | ||
|
||
} // namespace RobotDynamicsEstimator | ||
} // namespace Estimators | ||
} // namespace BipedalLocomotion | ||
|
||
#endif // BIPEDAL_LOCOMOTION_ESTIMATORS_JOINT_VELOCITY_DYNAMICS_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
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
Oops, something went wrong.