Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
sot-hrp2
Commits
860a2491
Commit
860a2491
authored
Sep 21, 2012
by
Florent Lamiraux
Committed by
Florent Lamiraux florent@laas.fr
Sep 21, 2012
Browse files
Optimize code to avoid dynamic allocation in control loop.
parent
f3a58f9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sot-hrp2-device.cpp
View file @
860a2491
...
...
@@ -34,7 +34,8 @@ SoTHRP2Device::SoTHRP2Device(std::string RobotName):
dgsot
::
Device
(
RobotName
),
timestep_
(
TIMESTEP_DEFAULT
),
previousState_
(),
robotState_
(
"StackOfTasks("
+
RobotName
+
")::output(vector)::robotState"
)
robotState_
(
"StackOfTasks("
+
RobotName
+
")::output(vector)::robotState"
),
mlforces
(
6
)
{
sotDEBUGIN
(
25
)
;
signalRegistration
(
robotState_
);
...
...
@@ -75,7 +76,6 @@ void SoTHRP2Device::setupSetSensors(map<string,dgsot::SensorValues> &SensorsIn)
stateSOUT
.
setConstant
(
state
);
// Implements force recollection.
ml
::
Vector
mlforces
(
6
);
vector
<
double
>
forcesIn
=
SensorsIn
[
"forces"
].
getValues
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
...
...
@@ -98,7 +98,6 @@ void SoTHRP2Device::nominalSetSensors(map<string,dgsot::SensorValues> &SensorsIn
// Read force values.
vector
<
double
>
forcesIn
=
SensorsIn
[
"forces"
].
getValues
();
ml
::
Vector
mlforces
(
6
);
int
t
=
controlSIN
.
getTime
();
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
...
...
@@ -117,7 +116,6 @@ void SoTHRP2Device::cleanupSetSensors(map<string, dgsot::SensorValues> &SensorsI
updateRobotState
(
anglesIn
);
ml
::
Vector
mlforces
(
6
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
j
=
0
;
j
<
6
;
++
j
)
...
...
src/sot-hrp2-device.hh
View file @
860a2491
...
...
@@ -70,6 +70,9 @@ protected:
///
dynamicgraph
::
Signal
<
ml
::
Vector
,
int
>
robotState_
;
/// Intermediate variables to avoid allocation during control
ml
::
Vector
mlforces
;
ml
::
Vector
mlRobotState
;
};
#endif
/* _SOT_HRP2Device_H_*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment