Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
c4389a53
Commit
c4389a53
authored
8 years ago
by
Clemens Wallrath
Browse files
Options
Downloads
Patches
Plain Diff
Adapts PIDController to virtual time
parent
8feefb66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/libraries/core/PIDController.cpp
+7
-6
7 additions, 6 deletions
source/RobotAPI/libraries/core/PIDController.cpp
with
7 additions
and
6 deletions
source/RobotAPI/libraries/core/PIDController.cpp
+
7
−
6
View file @
c4389a53
...
...
@@ -23,6 +23,7 @@
*/
#include
"PIDController.h"
#include
<ArmarXCore/core/time/TimeUtil.h>
#include
<RobotAPI/libraries/core/math/MathUtils.h>
using
namespace
armarx
;
...
...
@@ -50,17 +51,17 @@ void PIDController::reset()
firstRun
=
true
;
previousError
=
0
;
integral
=
0
;
lastUpdateTime
=
Ic
eUtil
::
Time
::
now
();
lastUpdateTime
=
Tim
eUtil
::
Get
Time
();
}
void
PIDController
::
update
(
double
measuredValue
,
double
targetValue
)
{
ScopedRecursiveLock
lock
(
mutex
);
IceUtil
::
Time
now
=
Ic
eUtil
::
Time
::
now
();
IceUtil
::
Time
now
=
Tim
eUtil
::
Get
Time
();
if
(
firstRun
)
{
lastUpdateTime
=
Ic
eUtil
::
Time
::
now
();
lastUpdateTime
=
Tim
eUtil
::
Get
Time
();
}
double
dt
=
(
now
-
lastUpdateTime
).
toSecondsDouble
();
...
...
@@ -219,11 +220,11 @@ void MultiDimPIDController::update(const double deltaSec, const Eigen::VectorXf&
void
MultiDimPIDController
::
update
(
const
Eigen
::
VectorXf
&
measuredValue
,
const
Eigen
::
VectorXf
&
targetValue
)
{
ScopedRecursiveLock
lock
(
mutex
);
IceUtil
::
Time
now
=
Ic
eUtil
::
Time
::
now
();
IceUtil
::
Time
now
=
Tim
eUtil
::
Get
Time
();
if
(
firstRun
)
{
lastUpdateTime
=
Ic
eUtil
::
Time
::
now
();
lastUpdateTime
=
Tim
eUtil
::
Get
Time
();
}
double
dt
=
(
now
-
lastUpdateTime
).
toSecondsDouble
();
...
...
@@ -242,7 +243,7 @@ void MultiDimPIDController::reset()
firstRun
=
true
;
previousError
=
0
;
integral
=
0
;
lastUpdateTime
=
Ic
eUtil
::
Time
::
now
();
lastUpdateTime
=
Tim
eUtil
::
Get
Time
();
// controlValue.setZero();
// processValue.setZero();
// target.setZero();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment