Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
sot-core
Commits
f5745224
Commit
f5745224
authored
12 years ago
by
Florent Lamiraux
Browse files
Options
Downloads
Patches
Plain Diff
Optimize code to avoid dynamic allocation in control loop.
parent
55293737
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/sot/core/device.hh
+3
-0
3 additions, 0 deletions
include/sot/core/device.hh
src/tools/device.cpp
+16
-21
16 additions, 21 deletions
src/tools/device.cpp
with
19 additions
and
21 deletions
include/sot/core/device.hh
+
3
−
0
View file @
f5745224
...
...
@@ -117,6 +117,9 @@ namespace dynamicgraph {
public
:
void
setRoot
(
const
ml
::
Matrix
&
root
);
void
setRoot
(
const
MatrixHomogeneous
&
worldMwaist
);
private
:
// Intermediate variable to avoid dynamic allocation
ml
::
Vector
forceZero6
;
};
}
// namespace sot
}
// namespace dynamicgraph
...
...
This diff is collapsed.
Click to expand it.
src/tools/device.cpp
+
16
−
21
View file @
f5745224
...
...
@@ -55,26 +55,20 @@ void Device::integrateRollPitchYaw(ml::Vector& state, const ml::Vector& control,
double
roll
=
state
(
3
);
double
pitch
=
state
(
4
);
double
yaw
=
state
(
5
);
std
::
vector
<
jrlMathTools
::
Vector3D
<
double
>
>
column
;
jrlMathTools
::
Vector3D
<
double
>
column
[
3
]
;
// Build rotation matrix as a vector of colums
jrlMathTools
::
Vector3D
<
double
>
e1
;
e1
(
0
)
=
cos
(
pitch
)
*
cos
(
yaw
);
e1
(
1
)
=
cos
(
pitch
)
*
sin
(
yaw
);
e1
(
2
)
=
-
sin
(
pitch
);
column
.
push_back
(
e1
);
jrlMathTools
::
Vector3D
<
double
>
e2
;
e2
(
0
)
=
sin
(
roll
)
*
sin
(
pitch
)
*
cos
(
yaw
)
-
cos
(
roll
)
*
sin
(
yaw
);
e2
(
1
)
=
sin
(
roll
)
*
sin
(
pitch
)
*
sin
(
yaw
)
+
cos
(
roll
)
*
cos
(
yaw
);
e2
(
2
)
=
sin
(
roll
)
*
cos
(
pitch
);
column
.
push_back
(
e2
);
jrlMathTools
::
Vector3D
<
double
>
e3
;
e3
(
0
)
=
cos
(
roll
)
*
sin
(
pitch
)
*
cos
(
yaw
)
+
sin
(
roll
)
*
sin
(
yaw
);
e3
(
1
)
=
cos
(
roll
)
*
sin
(
pitch
)
*
sin
(
yaw
)
-
sin
(
roll
)
*
cos
(
yaw
);
e3
(
2
)
=
cos
(
roll
)
*
cos
(
pitch
);
column
.
push_back
(
e3
);
column
[
0
](
0
)
=
cos
(
pitch
)
*
cos
(
yaw
);
column
[
0
](
1
)
=
cos
(
pitch
)
*
sin
(
yaw
);
column
[
0
](
2
)
=
-
sin
(
pitch
);
column
[
1
](
0
)
=
sin
(
roll
)
*
sin
(
pitch
)
*
cos
(
yaw
)
-
cos
(
roll
)
*
sin
(
yaw
);
column
[
1
](
1
)
=
sin
(
roll
)
*
sin
(
pitch
)
*
sin
(
yaw
)
+
cos
(
roll
)
*
cos
(
yaw
);
column
[
1
](
2
)
=
sin
(
roll
)
*
cos
(
pitch
);
column
[
2
](
0
)
=
cos
(
roll
)
*
sin
(
pitch
)
*
cos
(
yaw
)
+
sin
(
roll
)
*
sin
(
yaw
);
column
[
2
](
1
)
=
cos
(
roll
)
*
sin
(
pitch
)
*
sin
(
yaw
)
-
sin
(
roll
)
*
cos
(
yaw
);
column
[
2
](
2
)
=
cos
(
roll
)
*
cos
(
pitch
);
// Apply Rodrigues (1795–1851) formula for rotation about omega vector
double
angle
=
dt
*
omega
.
norm
();
...
...
@@ -129,8 +123,10 @@ Device( const std::string& n )
,
pseudoTorqueSOUT
(
"Device::output(vector)::ptorque"
)
,
previousControlSOUT
(
"Device("
+
n
+
")::output(vector)::previousControl"
)
,
motorcontrolSOUT
(
"Device("
+
n
+
")::output(vector)::motorcontrol"
)
,
ZMPPreviousControllerSOUT
(
"Device("
+
n
+
")::output(vector)::zmppreviouscontroller"
),
ffPose_
()
,
ZMPPreviousControllerSOUT
(
"Device("
+
n
+
")::output(vector)::zmppreviouscontroller"
),
ffPose_
(),
forceZero6
(
6
)
{
forceZero6
.
fill
(
0
);
/* --- SIGNALS --- */
for
(
int
i
=
0
;
i
<
4
;
++
i
){
withForceSignals
[
i
]
=
false
;
}
forcesSOUT
[
0
]
=
...
...
@@ -227,9 +223,8 @@ increment( const double & dt )
/* Position the signals corresponding to sensors. */
stateSOUT
.
setConstant
(
state_
);
stateSOUT
.
setTime
(
time
+
1
);
ml
::
Vector
forceNull
(
6
);
forceNull
.
fill
(
0
);
for
(
int
i
=
0
;
i
<
4
;
++
i
){
if
(
!
withForceSignals
[
i
]
)
forcesSOUT
[
i
]
->
setConstant
(
force
Null
);
if
(
!
withForceSignals
[
i
]
)
forcesSOUT
[
i
]
->
setConstant
(
force
Zero6
);
}
ml
::
Vector
zmp
(
3
);
zmp
.
fill
(
.0
);
ZMPPreviousControllerSOUT
.
setConstant
(
zmp
);
...
...
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