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
Show more breadcrumbs
Guilhem Saurel
sot-dyninv
Commits
6b2eade5
Commit
6b2eade5
authored
12 years ago
by
Nicolas Mansard
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes.
parent
10f3e443
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/viewer_helper.py
+23
-7
23 additions, 7 deletions
python/viewer_helper.py
with
23 additions
and
7 deletions
python/viewer_helper.py
+
23
−
7
View file @
6b2eade5
...
...
@@ -6,7 +6,12 @@ def stateFullSize(robot,additionalData = () ):
return
[
float
(
val
)
for
val
in
robot
.
state
.
value
+
additionalData
]
def
refreshView
(
robot
):
robot
.
viewer
.
updateElementConfig
(
'
hrp
'
,
robot
.
stateFullSize
())
if
robot
.
name
==
'
robot
'
:
name
=
'
hrp
'
else
:
name
=
robot
.
name
robot
.
viewer
.
updateElementConfig
(
name
,
robot
.
stateFullSize
())
for
f
in
robot
.
displayList
:
f
()
def
incrementView
(
robot
,
dt
):
'''
Increment then refresh.
'''
...
...
@@ -16,6 +21,7 @@ def incrementView(robot,dt):
def
setView
(
robot
,
*
args
):
'''
Set robot config then refresh.
'''
robot
.
setNoView
(
*
args
)
#print('view')
robot
.
refresh
()
def
addRobotViewer
(
robot
,
**
args
):
...
...
@@ -27,6 +33,7 @@ def addRobotViewer(robot,**args):
'''
verbose
=
args
.
get
(
'
verbose
'
,
True
)
small
=
args
.
get
(
'
small
'
,
False
)
small_extra
=
args
.
get
(
'
small_extra
'
,
10
)
server
=
args
.
get
(
'
server
'
,
'
XML-RPC
'
)
try
:
...
...
@@ -35,21 +42,22 @@ def addRobotViewer(robot,**args):
if
small
:
if
verbose
:
print
'
using a small robot
'
RobotClass
.
stateFullSize
=
lambda
x
:
stateFullSize
(
x
,
10
*
(
0.0
,))
RobotClass
.
stateFullSize
=
lambda
x
:
stateFullSize
(
x
,
small_extra
*
(
0.0
,))
else
:
RobotClass
.
stateFullSize
=
stateFullSize
robot
.
viewer
=
robotviewer
.
client
(
server
)
# Check the connection
robot
.
viewer
.
updateElementConfig
(
'
hrp
'
,
robot
.
stateFullSize
())
RobotClass
.
refresh
=
refreshView
RobotClass
.
incrementNoView
=
RobotClass
.
increment
RobotClass
.
increment
=
incrementView
RobotClass
.
setNoView
=
RobotClass
.
set
RobotClass
.
set
=
setView
robot
.
refresh
()
robot
.
displayList
=
[]
# Check the connection
if
args
.
get
(
'
dorefresh
'
,
True
):
robot
.
refresh
()
except
:
if
verbose
:
print
"
No robot viewer, sorry.
"
...
...
@@ -57,7 +65,9 @@ def addRobotViewer(robot,**args):
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Add a visual output when an event is called.
class
VisualPinger
:
def
__init__
(
self
,
viewer
):
...
...
@@ -69,3 +79,9 @@ class VisualPinger:
def
__call__
(
self
):
self
.
pos
+=
1
self
.
refresh
()
def
updateComDisplay
(
robot
,
comsig
,
objname
=
'
com
'
):
if
comsig
.
time
>
0
:
robot
.
viewer
.
updateElementConfig
(
objname
,[
comsig
.
value
[
0
],
comsig
.
value
[
1
],
0
,
0
,
0
,
0
])
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