Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-talos-balance
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
Guilhem Saurel
sot-talos-balance
Commits
b878bf85
Commit
b878bf85
authored
6 years ago
by
Gabriele Buondonno
Browse files
Options
Downloads
Patches
Plain Diff
Modified AdmittanceController
parent
3bb6ef85
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/talos_balance/admittance-controller.hh
+2
-1
2 additions, 1 deletion
include/sot/talos_balance/admittance-controller.hh
src/admittance-controller.cpp
+21
-5
21 additions, 5 deletions
src/admittance-controller.cpp
with
23 additions
and
6 deletions
include/sot/talos_balance/admittance-controller.hh
+
2
−
1
View file @
b878bf85
...
...
@@ -62,7 +62,7 @@ namespace dynamicgraph {
void
init
(
const
double
&
dt
,
const
unsigned
&
n
);
void
setPosition
(
const
dynamicgraph
::
Vector
&
);
void
setPosition
(
const
dynamicgraph
::
Vector
&
position
);
/* --- SIGNALS --- */
DECLARE_SIGNAL_IN
(
Kp
,
dynamicgraph
::
Vector
);
...
...
@@ -82,6 +82,7 @@ namespace dynamicgraph {
getLogger
().
sendMsg
(
"[AdmittanceController-"
+
name
+
"] "
+
msg
,
t
,
file
,
line
);
}
bool
m_useState
;
protected
:
int
m_n
;
bool
m_initSucceeded
;
/// true if the entity has been successfully initialized
...
...
This diff is collapsed.
Click to expand it.
src/admittance-controller.cpp
+
21
−
5
View file @
b878bf85
...
...
@@ -34,6 +34,7 @@ namespace dynamicgraph
using
namespace
dg
::
command
;
//Size to be aligned "-------------------------------------------------------"
#define PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION "AdmittanceController: qRef computation "
#define PROFILE_ADMITTANCECONTROLLER_DQREF_COMPUTATION "AdmittanceController: dqRef computation "
#define INPUT_SIGNALS m_KpSIN << m_stateSIN << m_tauSIN << m_tauDesSIN
...
...
@@ -66,6 +67,8 @@ namespace dynamicgraph
/* Commands. */
addCommand
(
"init"
,
makeCommandVoid2
(
*
this
,
&
AdmittanceController
::
init
,
docCommandVoid2
(
"Initialize the entity."
,
"time step"
,
"Number of elements"
)));
addCommand
(
"setPosition"
,
makeCommandVoid1
(
*
this
,
&
AdmittanceController
::
setPosition
,
docCommandVoid1
(
"Set initial reference position."
,
"Initial position"
)));
addCommand
(
"useExternalState"
,
makeDirectSetter
(
*
this
,
&
m_useState
,
docDirectGetter
(
"use external state"
,
"bool"
)));
addCommand
(
"isUsingExternalState"
,
makeDirectGetter
(
*
this
,
&
m_useState
,
docDirectGetter
(
"use external state"
,
"bool"
)));
}
void
AdmittanceController
::
init
(
const
double
&
dt
,
const
unsigned
&
n
)
...
...
@@ -74,8 +77,6 @@ namespace dynamicgraph
return
SEND_MSG
(
"n must be at least 1"
,
MSG_TYPE_ERROR
);
if
(
!
m_KpSIN
.
isPlugged
())
return
SEND_MSG
(
"Init failed: signal Kp is not plugged"
,
MSG_TYPE_ERROR
);
if
(
!
m_stateSIN
.
isPlugged
())
return
SEND_MSG
(
"Init failed: signal state is not plugged"
,
MSG_TYPE_ERROR
);
if
(
!
m_tauSIN
.
isPlugged
())
return
SEND_MSG
(
"Init failed: signal tau is not plugged"
,
MSG_TYPE_ERROR
);
if
(
!
m_tauDesSIN
.
isPlugged
())
...
...
@@ -87,9 +88,9 @@ namespace dynamicgraph
m_initSucceeded
=
true
;
}
void
AdmittanceController
::
setPosition
(
const
dynamicgraph
::
Vector
&
state
)
void
AdmittanceController
::
setPosition
(
const
dynamicgraph
::
Vector
&
position
)
{
m_q
=
state
;
m_q
=
position
;
}
/* ------------------------------------------------------------------- */
...
...
@@ -110,7 +111,6 @@ namespace dynamicgraph
const
Vector
&
tau
=
m_tauSIN
(
iter
);
const
Vector
&
Kp
=
m_KpSIN
(
iter
);
assert
(
state
.
size
()
==
m_n
&&
"Unexpected size of signal state"
);
assert
(
tau
.
size
()
==
m_n
&&
"Unexpected size of signal tau"
);
assert
(
tauDes
.
size
()
==
m_n
&&
"Unexpected size of signal tauDes"
);
assert
(
Kp
.
size
()
==
m_n
&&
"Unexpected size of signal Kp"
);
...
...
@@ -132,14 +132,30 @@ namespace dynamicgraph
return
s
;
}
getProfiler
().
start
(
PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION
);
const
Vector
&
dqRef
=
m_dqRefSOUT
(
iter
);
assert
(
dqRef
.
size
()
==
m_n
&&
"Unexpected size of signal dqRef"
);
if
(
m_useState
)
{
if
(
!
m_stateSIN
.
isPlugged
())
{
SEND_MSG
(
"Signal state is requested, but is not plugged"
,
MSG_TYPE_ERROR
);
return
s
;
}
const
Vector
&
state
=
m_stateSIN
(
iter
);
assert
(
state
.
size
()
==
m_n
&&
"Unexpected size of signal state"
);
m_q
=
state
;
}
m_q
+=
dqRef
*
m_dt
;
s
=
m_q
;
getProfiler
().
stop
(
PROFILE_ADMITTANCECONTROLLER_QREF_COMPUTATION
);
return
s
;
}
...
...
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