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
Stack Of Tasks
sot-talos
Commits
27952ff3
Commit
27952ff3
authored
May 16, 2018
by
Olivier Stasse
Browse files
Merge branch 'topic/pyrene'
parents
b3f95ff5
5ed94a6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/appli_basic.py
0 → 100644
View file @
27952ff3
from
dynamic_graph.ros
import
RosPublish
ros_publish_state
=
RosPublish
(
"ros_publish_state"
)
ros_publish_state
.
add
(
"vector"
,
"state"
,
"/sot_hpp/state"
)
from
dynamic_graph
import
plug
plug
(
robot
.
device
.
state
,
ros_publish_state
.
state
)
robot
.
device
.
after
.
addDownsampledSignal
(
"ros_publish_state.trigger"
,
100
)
v
=
(
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.00
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
,
0.0
)
robot
.
device
.
control
.
value
=
v
tests/test_basic.py
0 → 100755
View file @
27952ff3
#!/usr/bin/python
import
sys
import
rospy
from
std_srvs.srv
import
*
from
dynamic_graph_bridge.srv
import
*
from
dynamic_graph_bridge_msgs.srv
import
*
def
launchScript
(
code
,
title
,
description
=
""
):
raw_input
(
title
+
': '
+
description
)
rospy
.
loginfo
(
title
)
rospy
.
loginfo
(
code
)
for
line
in
code
:
if
line
!=
''
and
line
[
0
]
!=
'#'
:
print
line
answer
=
runCommandClient
(
str
(
line
))
rospy
.
logdebug
(
answer
)
print
answer
rospy
.
loginfo
(
"...done with "
+
title
)
# Waiting for services
try
:
rospy
.
loginfo
(
"Waiting for run_command"
)
rospy
.
wait_for_service
(
'/run_command'
)
rospy
.
loginfo
(
"...ok"
)
rospy
.
loginfo
(
"Waiting for start_dynamic_graph"
)
rospy
.
wait_for_service
(
'/start_dynamic_graph'
)
rospy
.
loginfo
(
"...ok"
)
runCommandClient
=
rospy
.
ServiceProxy
(
'run_command'
,
RunCommand
)
runCommandStartDynamicGraph
=
rospy
.
ServiceProxy
(
'start_dynamic_graph'
,
Empty
)
initCode
=
open
(
"appli_basic.py"
,
"r"
).
read
().
split
(
"
\n
"
)
rospy
.
loginfo
(
"Stack of Tasks launched"
)
# runCommandClient("from dynamic_graph import plug")
# runCommandClient("from dynamic_graph.sot.core import SOT")
# runCommandClient("sot = SOT('sot')")
# runCommandClient("sot.setSize(robot.dynamic.getDimension())")
# runCommandClient("plug(sot.control,robot.device.control)")
launchScript
(
initCode
,
'initialize SoT'
)
raw_input
(
"Wait before starting the dynamic graph"
)
runCommandStartDynamicGraph
()
except
rospy
.
ServiceException
,
e
:
rospy
.
logerr
(
"Service call failed: %s"
%
e
)
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