Skip to content

Commit 262ea69

Browse files
authored
[DQ_ClassicQPController] Set the default damping to 1e-3 to match the the Matlab. (See #67 and dqrobotics/python#59)
* [DQ_KinematicController.h] Initialized some variables to match the Matlab implementation * [DQ_ClassicQPController.cpp] Added a default damping to match the DQ_ClassicQPController.m class * [DQ_KinematicController.h] Removed from the header the initialization of variables that are initialized in the constructor * [DQ_KinematicController.cpp] Added the initialization of the damping attribute in the constructor. In addition, I fixed the initialization order of the attributes last control and last error signal. * Revert "[DQ_KinematicController.h] Initialized some variables to match the Matlab implementation" This reverts commit 378c3f4.
1 parent 2751d38 commit 262ea69

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/robot_control/DQ_ClassicQPController.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
(C) Copyright 2019 DQ Robotics Developers
2+
(C) Copyright 2019-2024 DQ Robotics Developers
33
44
This file is part of DQ Robotics.
55
@@ -17,7 +17,14 @@ This file is part of DQ Robotics.
1717
along with DQ Robotics. If not, see <http://www.gnu.org/licenses/>.
1818
1919
Contributors:
20-
- Murilo M. Marinho ([email protected])
20+
21+
1. Murilo M. Marinho ([email protected])
22+
Responsible for the original implementation
23+
24+
2. Juan Jose Quiroz Omana
25+
Fixed bug 59 (https://github.com/dqrobotics/python/issues/59)
26+
- Initialized a default damping to match the Matlab implementation
27+
of the class DQ_ClassicQPController.m
2128
*/
2229

2330
#include <dqrobotics/robot_control/DQ_ClassicQPController.h>
@@ -28,14 +35,14 @@ namespace DQ_robotics
2835
DQ_ClassicQPController::DQ_ClassicQPController(DQ_Kinematics* robot, DQ_QuadraticProgrammingSolver* solver):
2936
DQ_QuadraticProgrammingController (robot,solver)
3037
{
31-
38+
set_damping(1e-3); // Default damping.
3239
}
3340

3441
DQ_ClassicQPController::DQ_ClassicQPController(const std::shared_ptr<DQ_Kinematics> &robot,
3542
const std::shared_ptr<DQ_QuadraticProgrammingSolver> &solver):
3643
DQ_QuadraticProgrammingController(robot,solver)
3744
{
38-
45+
set_damping(1e-3); // Default damping.
3946
}
4047

4148
MatrixXd DQ_ClassicQPController::compute_objective_function_symmetric_matrix(const MatrixXd &J, const VectorXd&)

src/robot_control/DQ_KinematicController.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ DQ_KinematicController::DQ_KinematicController(const std::shared_ptr<DQ_Kinemati
5454
DQ_KinematicController::DQ_KinematicController():
5555
robot_(nullptr),
5656
control_objective_(ControlObjective::None),
57+
attached_primitive_(0.0),
58+
target_primitive_(0.0),
5759
gain_(0.0),
58-
system_reached_stable_region_(false),
59-
last_error_signal_(VectorXd::Zero(1)),//Todo: change this inialization to use empty vector
60-
last_control_signal_(VectorXd::Zero(1)),//Todo: change this inialization to use empty vector
60+
damping_(0),//Todo: change this inialization to use empty vector
61+
system_reached_stable_region_(false),//Todo: change this inialization to use empty vector
62+
last_control_signal_(VectorXd::Zero(1)),
63+
last_error_signal_(VectorXd::Zero(1)),
6164
stability_threshold_(0.0),
6265
stability_counter_(0.0),
63-
stability_counter_max_(10.0),
64-
attached_primitive_(0.0),
65-
target_primitive_(0.0)
66+
stability_counter_max_(10.0)
6667
{
6768

6869
}

0 commit comments

Comments
 (0)