-
Notifications
You must be signed in to change notification settings - Fork 14
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
This PR fixes issue 59 of the Python version of the DQ Robotics #67
Conversation
…tlab implementation
…ClassicQPController.m class
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.
Thanks, @juanjqo. My major concern is the re-initialization of things already being initialized in the constructor.
… of variables that are initialized in the constructor
…attribute in the constructor. In addition, I fixed the initialization order of the attributes last control and last error signal.
I'm quoting the reply by @juanjqo here because if we resolve that conversation all the discussion will be lost (AFAIK).
If I may add to this discussion, given that I wasn't part of those meetings. A bazillion years ago (more accurately 12 years or so), the C++ library had a C++98-ish style, hence in-class initialization was not possible. Please put into context that it inherited from even earlier code and C++11 compilers were still not widespread. For instance, Line 17 in ba29d76
In-class initialization has been added to compilers for C++11 and beyond. In-class initialization is preferred in C++11 as well, no doubt. It leads to less repetition and could be less error-prone (if users are observant of the style). However, because constructor initialization isn't wrong, the original style was followed to keep the files consistent across the library (if we do in-class initialization somewhere, I'm sure it's rare). My initial point when flagging the in-class initialization of the damping factor was simply that the initialization must happen all in the same place. It's fine to move it out of the constructor and have all initialization done in class. It is also reasonable to move the new one to the constructor. What is confusing is to have part of it in class and part of it in the constructor. |
…h the Matlab implementation" This reverts commit 378c3f4.
Thanks for the additional context, @mmmarinho. Since I'm stuck with C++98, having the context of the functionalities that came after is always a mix of delight (learning cool things) and despair (feeling like a dinosaur). @juanjqo, since both are correct, let's stick with what we decided in person. I don't remember the reason for our decision anymore, but I'm quite sure we had a good reason (we probably concluded that changing MATLAB would be easier). Kind regards, |
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.
Hi @juanjqo,
From what I can see, the current implementation is following the MATLAB format while keeping to the C++ requirements. This seems good to go.
system_reached_stable_region_(false), | ||
last_error_signal_(VectorXd::Zero(1)),//Todo: change this inialization to use empty vector | ||
last_control_signal_(VectorXd::Zero(1)),//Todo: change this inialization to use empty vector | ||
damping_(0),//Todo: change this inialization to use empty vector |
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 seems to be properly matching MATLAB.
@@ -28,14 +35,14 @@ namespace DQ_robotics | |||
DQ_ClassicQPController::DQ_ClassicQPController(DQ_Kinematics* robot, DQ_QuadraticProgrammingSolver* solver): | |||
DQ_QuadraticProgrammingController (robot,solver) | |||
{ | |||
|
|||
set_damping(1e-3); // Default damping. |
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 seems to be properly following MATLAB.
@dqrobotics/developers
Hi @mmmarinho,
This PR initializes some variables to match the Matlab implementation. Specifically, I initialized the attributesdamping
,gain
,system_reached_stable_region_
,stability_threshold
,stability_counter
, andstability_counter_max
of the classDQ_KinematicController
.This PR fixes the issue 59 in Python by setting the
damping
to 1e-3 in the classDQ_ClassicQPController
(as in the Matlab version).Furthermore, I added a default damping in the constructor of the classDQ_ClassicQPController
to match the implementation of the classDQ_ClassicQPController.m
.Minimal Example
Output
Output of the current version of DQ Robotics (MacOS)
Please let me know if additional modifications are required.
Best regards,
Juancho