Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sot-dyninv
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Stack Of Tasks
sot-dyninv
Commits
af29c8ef
Commit
af29c8ef
authored
12 years ago
by
Nicolas Mansard
Browse files
Options
Downloads
Patches
Plain Diff
Working version for Romeo, thanks Francois.
parent
ae44f407
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
python/unittests/walkromeo.py
+17
-37
17 additions, 37 deletions
python/unittests/walkromeo.py
with
17 additions
and
37 deletions
python/unittests/walkromeo.py
+
17
−
37
View file @
af29c8ef
# ______________________________________________________________________________
# ******************************************************************************
#
The
simple
st robot task: just go and reach a point with the right hand
.
#
A
simple
Herdt walking pattern generator for Romeo
.
# ______________________________________________________________________________
# ******************************************************************************
from
dynamic_graph
import
plug
from
dynamic_graph.sot.core
import
*
from
dynamic_graph.sot.dynamics
import
*
import
dynamic_graph.script_shortcuts
from
dynamic_graph.script_shortcuts
import
optionalparentheses
from
dynamic_graph.sot.core.matrix_util
import
matrixToTuple
,
vectorToTuple
,
rotate
,
matrixToRPY
from
dynamic_graph.sot.core.meta_tasks_kine
import
*
from
dynamic_graph.sot.core.meta_task_posture
import
MetaTaskKinePosture
from
dynamic_graph.sot.core.utils.viewer_helper
import
addRobotViewer
,
VisualPinger
,
updateComDisplay
from
numpy
import
*
from
dynamic_graph.sot.core.utils.thread_interruptible_loop
import
loopInThread
,
loopShortcuts
from
dynamic_graph.sot.dyninv
import
SolverKine
from
dynamic_graph.sot.dyninv.robot_specific
import
pkgDataRootDir
,
modelName
,
robotDimension
,
initialConfig
,
gearRatio
,
inertiaRotor
,
specificitiesName
,
jointRankName
...
...
@@ -24,17 +22,12 @@ robot = RobotSimu("romeo")
robot
.
resize
(
robotDim
)
dt
=
5e-3
#q0=list(initialConfig[robotName])
#q0[0]=-0.027827
#initialConfig[robotName]=tuple(q0)
robot
.
set
(
initialConfig
[
robotName
]
)
addRobotViewer
(
robot
,
small
=
True
,
small_extra
=
24
,
verbose
=
False
)
#-------------------------------------------------------------------------------
#----- MAIN LOOP ---------------------------------------------------------------
#-------------------------------------------------------------------------------
from
dynamic_graph.sot.core.utils.thread_interruptible_loop
import
loopInThread
,
loopShortcuts
@loopInThread
def
inc
():
robot
.
increment
(
dt
)
...
...
@@ -43,9 +36,7 @@ def inc():
runner
=
inc
()
[
go
,
stop
,
next
,
n
]
=
loopShortcuts
(
runner
)
#-----------------------------------------------------------------------------
#---- DYN --------------------------------------------------------------------
#-----------------------------------------------------------------------------
modelDir
=
pkgDataRootDir
[
robotName
]
xmlDir
=
pkgDataRootDir
[
robotName
]
specificitiesPath
=
xmlDir
+
'
/
'
+
specificitiesName
[
robotName
]
...
...
@@ -62,53 +53,41 @@ plug(robot.state,dyn.position)
dyn
.
velocity
.
value
=
robotDim
*
(
0.
,)
dyn
.
acceleration
.
value
=
robotDim
*
(
0.
,)
# --- PG ---------------------------------------------------------
# --- PG ---------------------------------------------------------
# --- PG ---------------------------------------------------------
from
dynamic_graph.sot.pattern_generator.meta_pg
import
MetaPG
pg
=
MetaPG
(
dyn
)
pg
.
plugZmp
(
robot
)
# ---- SOT ---------------------------------------------------------------------
# ---- SOT ---------------------------------------------------------------------
# ---- SOT ---------------------------------------------------------------------
sot
=
SOT
(
'
sot
'
)
sot
.
setNumberDofs
(
robotDim
)
# The basic SOT solver would work too.
sot
=
SolverKine
(
'
sot
'
)
sot
.
setSize
(
robotDim
)
plug
(
sot
.
control
,
robot
.
control
)
# ---- TASKS -------------------------------------------------------------------
# ---- TASKS -------------------------------------------------------------------
# ---- TASKS -------------------------------------------------------------------
# ---- WAIST TASK ---
taskWaist
=
MetaTask6d
(
'
waist
'
,
dyn
,
'
waist
'
,
'
waist
'
)
pg
.
plugWaistTask
(
taskWaist
)
taskWaist
.
task
.
controlGain
.
value
=
5
taskWaist
.
feature
.
selec
.
value
=
'
011100
'
# --- TASK COM ---
taskCom
=
MetaTaskKineCom
(
dyn
,
"
compd
"
)
plug
(
pg
.
comRef
.
ref
,
taskCom
.
featureDes
.
errorIN
)
plug
(
pg
.
pg
.
dcomref
,
taskCom
.
featureDes
.
errordotIN
)
taskCom
.
task
=
TaskPD
(
'
taskComPD
'
)
taskCom
.
task
.
add
(
taskCom
.
feature
.
name
)
plug
(
taskCom
.
feature
.
errordot
,
taskCom
.
task
.
errorDot
)
plug
(
taskCom
.
task
.
error
,
taskCom
.
gain
.
error
)
plug
(
taskCom
.
gain
.
gain
,
taskCom
.
task
.
controlGain
)
taskCom
.
gain
.
setConstant
(
40
)
taskCom
.
task
.
setBeta
(
-
1
)
pg
.
plugComTask
(
taskCom
)
taskCom
.
feature
.
selec
.
value
=
'
011
'
# --- TASK FEET
taskRF
=
MetaTask6d
(
'
rf
'
,
dyn
,
'
rf
'
,
'
right-ankle
'
)
plug
(
pg
.
pg
.
rightfootref
,
taskRF
.
featureDes
.
position
)
taskRF
.
task
.
controlGain
.
value
=
5
taskRF
.
task
.
controlGain
.
value
=
40
taskLF
=
MetaTask6d
(
'
lf
'
,
dyn
,
'
lf
'
,
'
left-ankle
'
)
plug
(
pg
.
pg
.
leftfootref
,
taskLF
.
featureDes
.
position
)
taskLF
.
task
.
controlGain
.
value
=
5
taskLF
.
task
.
controlGain
.
value
=
40
# --- RUN ----------------------------------------------------------------------
# --- RUN ----------------------------------------------------------------------
# --- RUN ----------------------------------------------------------------------
sot
.
push
(
taskWaist
.
task
.
name
)
sot
.
push
(
taskRF
.
task
.
name
)
sot
.
push
(
taskLF
.
task
.
name
)
...
...
@@ -116,9 +95,10 @@ sot.push(taskCom.task.name)
# --- HERDT PG AND START -------------------------------------------------------
# Set the algorithm generating the ZMP reference trajectory to Herdt's one.
pg
.
startHerdt
()
pg
.
startHerdt
(
False
)
# You can now modifiy the speed of the robot using set pg.pg.velocitydes [3]( x, y, yaw)
pg
.
pg
.
velocitydes
.
value
=
(
0.1
,
0.0
,
0.0
)
#go()
next
()
go
()
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