2 from hrpsys
import OpenHRP
8 from waitInput
import *
18 connectPorts(sh.port(
"qOut"), [seq.port(
"qInit"), qRefPort])
29 global seq, seq_svc, sh, sh_svc, tk_svc, log, log_svc
31 ms.load(
"SequencePlayer")
32 seq = ms.create(
"SequencePlayer",
"seq")
33 seq_svc =
narrow(seq.service(
"service0"),
"SequencePlayerService")
35 ms.load(
"StateHolder")
36 sh = ms.create(
"StateHolder",
"StateHolder0")
37 sh_svc =
narrow(sh.service(
"service0"),
"StateHolderService")
38 tk_svc =
narrow(sh.service(
"service1"),
"TimeKeeperService")
41 log = ms.create(
"DataLogger",
"log")
42 log_svc =
narrow(log.service(
"service0"),
"DataLoggerService")
45 global ms, rh, rh_svc, ep_svc, simulation_mode, qRefPort
50 rh_svc =
narrow(rh.service(
"service0"),
"RobotHardwareService")
51 ep_svc =
narrow(rh.ec,
"ExecutionProfileService")
52 qRefPort = rh.port(
"qRef")
61 print "creating components" 64 print "connecting components" 67 print "activating components" 69 print "initialized successfully" 72 seq_svc.setJointAngles([0]*9, tm)
78 rh_svc.servo(joint, SwitchStatus.SWITCH_ON)
81 rh_svc.power(joint, SwitchStatus.SWITCH_ON)
84 rh_svc.power(joint, SwitchStatus.SWITCH_OFF)
87 rh_svc.servo(joint, SwitchStatus.SWITCH_OFF)
90 seq_svc.loadPattern(basename, tm)
93 log_svc.add(
"TimedDoubleSeq",
"pos")
94 log_svc.add(
"TimedLongSeq",
"servoState")
101 seq_svc.setJointAngles([0,0.7,0,2.5,0,1.5,0,0,0], 3.0)
102 seq_svc.waitInterpolation()
104 seq_svc.waitInterpolation()
105 log_svc.save(
"/tmp/demo")
108 if __name__ ==
'__main__':
def findRTC(name, rnc=None)
get RT component
def narrow(ior, klass, package="OpenHRP")
narrow ior
def serializeComponents(rtcs, stopEC=True)
set up execution context of the first RTC so that RTCs are executed sequentially
def servoOff(joint="all")
def findRTCmanager(hostname=None, rnc=None)
get RTCmanager
def connectPorts(outP, inPs, subscription="flush", dataflow="Push", bufferlength=1, rate=1000)
connect ports
def loadPattern(basename, tm=3.0)
def powerOff(joint="all")
def initCORBA()
initialize ORB