-
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
Implement contact models library #7
Implement contact models library #7
Conversation
- Implement the first version ContactModel class
…ontinuousContactModel
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.
Minor comments.
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContactModel.tpp
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
*/ | ||
class ContinuousContactModel final : public ContactModel | ||
{ | ||
iDynTree::Transform m_frameTransform; /**< Homogeneous transformation of the frame placed in the |
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.
Of the frame "place in the center of the contact surface", w.r.t. to which other frame?
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContactModel.h
Outdated
Show resolved
Hide resolved
Ah, a minor comment: it may be possible the |
Is it? Search, insertion, and removal have average constant-time complexity (https://en.cppreference.com/w/cpp/container/unordered_map). As far as I understood |
Constant is not negligible, especially if any of those operation uses dynamic memory allocation. To use an hyperbole, If the constant time complexity is |
As long as you don't add or remove elements, I don't think it does. There could be a difference when you need to scan all the elements given that they may be stored in non-contiguous portions of memory. In that case, vectors are always the best pick. Once I had to find all the equal strings in a very large set of strings. A simple iterative algorithm was taking minutes. I then decided to use the strings as keys in an |
* @return true/false in case of success/failure | ||
*/ | ||
template <class T> | ||
bool getVariable(const std::unordered_map<std::string, std::any>& variables, |
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.
I would detach VariablesHandler
from the OptimalControlUtilities
and use it also here.
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.
I would do it later with another PR
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
src/ContactModels/include/BipedalLocomotionControllers/ContactModels/ContinuousContactModel.h
Outdated
Show resolved
Hide resolved
// the parameters has been update the previous quantities has to be evaluated again | ||
m_isContactWrenchComputed = false; | ||
m_isControlMatrixComputed = false; | ||
m_isAutonomusDynamicsComputed = false; |
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.
To be honest I don't like too much that child classes have to set a parameter that is used in the implementation of the base class. IMHO, the setting of these parameters to false should be handled by the base class or through a method in the base class, like invalidateBuffers()
or similar.
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.
I agree!
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.
I implemented the solution you suggested in #33 (comment)
Code: f4092bf
// compute the torque | ||
auto skewRe1 = iDynTree::skew(rotation.col(0)); | ||
auto skewRe2 = iDynTree::skew(rotation.col(1)); | ||
torque = std::abs(rotation(2, 2)) * area / 12 * (m_length * m_length |
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.
Maybe it would be better to have a link to reference how this formula is obtained.
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.
I can update the doxygen
documentation adding the explanation of the model
* as a continuum of springs and dampers. | ||
* The contact surface is supposed to be <b>rectangular</b> and the frame placed on the contact | ||
* surfaced is centered in the middle of the surface, with the \a z-axis pointing upwards and the \a | ||
* x-axis pointing forward (parallel to one edge of the rectangle). |
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.
Maybe you can define here what do you mean by length and width. In addition, I would mention that this model assumes infinite friction.
Co-Authored-By: Stefano Dafarra <stefano.dafarra@gmail.com>
I updated the code accordingly to #28 I notice that we are implementing the This is an example of the class class Block
{
protected:
enum class State
{
NotInitialized, Initialized, ...
};
State m_state;
public:
virtual bool initialize(std::weak_ptr<IParameterHandler> handler) = 0;
}; We can discuss this on another issue @S-Dafarra you can review again the code |
…tModels/include/BipedalLocomotion/* and improve the documentation
50227ea
to
7043c20
Compare
I updated the code to be compliant with the latest version of Let me know if we can merge this PR since it is blocking #46 😄 |
Go for me! |
This PR introduces the contact models library.
In details:
abstract
interface namedContactModel
has been implemented. This class will be useful to implement different contact modelsContinuousContactModel
implements the a continuous contact model.C++17
is now required. (i.e. the library widly usesstd::any
)