7 print "import without hrpsys" 12 from waitInput
import *
19 global hcf, initial_pose, hrpsys_version
20 hcf = HrpsysConfigurator()
21 hcf.getRTCList = hcf.getRTCListUnstable
22 hcf.init (
"Sample4LegRobot(Robot)0",
"$(PROJECT_DIR)/../model/sample_4leg_robot.wrl")
23 initial_pose = [-0.000135, -0.523291, -0.000225, 1.15585, -0.631694, 0.000267,
24 -0.000135, -0.523291, -0.000225, 1.15585, -0.631694, 0.000267,
25 -0.000113, -0.523291, -0.000225, 1.15585, -0.631693, 0.000245,
26 -0.000113, -0.523291, -0.000225, 1.15585, -0.631693, 0.000245]
31 hcf.seq_svc.setJointAngles(initial_pose, 2.0)
32 hcf.waitInterpolation()
34 abcp=hcf.abc_svc.getAutoBalancerParam()[1]
35 abcp.leg_names = [
'rleg',
'lleg',
'rarm',
'larm']
36 hcf.abc_svc.setAutoBalancerParam(abcp)
38 ggp = hcf.abc_svc.getGaitGeneratorParam()[1]
39 ggp.leg_default_translate_pos = [[0.0, -0.19, 0.0], [0.0, 0.19, 0.0], [0.7, -0.19, 0.0], [0.7, 0.19, 0.0]]
40 ggp.zmp_weight_map = [1.0]*4
41 ggp.default_step_height = 0.065
42 hcf.abc_svc.setGaitGeneratorParam(ggp)
43 hcf.startAutoBalancer(limbs=[
'rleg',
'lleg',
'rarm',
'larm'])
44 hrpsys_version = hcf.seq.ref.get_component_profile().version
45 print(
"hrpsys_version = %s"%hrpsys_version)
48 print >> sys.stderr, print_str
49 hcf.setFootSteps([OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.00,-0.19,0], [1,0,0,0],
"rleg"),
50 OpenHRP.AutoBalancerService.Footstep([0.7+0.00,+0.19,0], [1,0,0,0],
"larm")]),
51 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.15,+0.19,0], [1,0,0,0],
"lleg"),
52 OpenHRP.AutoBalancerService.Footstep([0.7+0.15,-0.19,0], [1,0,0,0],
"rarm")]),
53 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.30,-0.19,0], [1,0,0,0],
"rleg"),
54 OpenHRP.AutoBalancerService.Footstep([0.7+0.30,+0.19,0], [1,0,0,0],
"larm")]),
55 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.45,+0.19,0], [1,0,0,0],
"lleg"),
56 OpenHRP.AutoBalancerService.Footstep([0.7+0.45,-0.19,0], [1,0,0,0],
"rarm")]),
57 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.45,-0.19,0], [1,0,0,0],
"rleg"),
58 OpenHRP.AutoBalancerService.Footstep([0.7+0.45,+0.19,0], [1,0,0,0],
"larm")])])
59 hcf.abc_svc.waitFootSteps()
62 ggp=hcf.abc_svc.getGaitGeneratorParam()[1];
63 ggp.swing_trajectory_delay_time_offset=0.05;
64 ggp.default_orbit_type=OpenHRP.AutoBalancerService.RECTANGLE;
65 hcf.abc_svc.setGaitGeneratorParam(ggp)
69 ggp=hcf.abc_svc.getGaitGeneratorParam()[1];
70 ggp.swing_trajectory_delay_time_offset=0.05;
71 ggp.swing_trajectory_final_distance_weight=3.0;
72 ggp.default_orbit_type=OpenHRP.AutoBalancerService.CYCLOIDDELAY;
73 hcf.abc_svc.setGaitGeneratorParam(ggp)
77 print >> sys.stderr, print_str
78 hcf.setFootSteps([OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.00,-0.19,0], [1,0,0,0],
"rleg")]),
79 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.7+0.01,+0.19,0], [1,0,0,0],
"larm")]),
80 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.01,+0.19,0], [1,0,0,0],
"lleg")]),
81 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.7+0.01,-0.19,0], [1,0,0,0],
"rarm")]),
82 OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.01,-0.19,0], [1,0,0,0],
"rleg")])])
83 hcf.abc_svc.waitFootSteps()
85 def demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str="5. go pos in trot"):
86 print >> sys.stderr, print_str
88 abcp=hcf.abc_svc.getAutoBalancerParam()[1]
89 abcp.default_gait_type = gait_type
90 hcf.abc_svc.setAutoBalancerParam(abcp)
92 ggp = hcf.abc_svc.getGaitGeneratorParam()[1]
93 ggp.leg_default_translate_pos = [[0.0, -0.19, 0.0], [0.0, 0.19, 0.0], [0.7, -0.19, 0.0], [0.7, 0.19, 0.0]]
94 hcf.abc_svc.setGaitGeneratorParam(ggp)
96 hcf.abc_svc.goPos(-0.5, +0.2, 20)
97 hcf.abc_svc.waitFootSteps()
100 print >> sys.stderr, print_str
102 abcp=hcf.abc_svc.getAutoBalancerParam()[1]
103 abcp.default_gait_type = gait_type
104 hcf.abc_svc.setAutoBalancerParam(abcp)
106 ggp = hcf.abc_svc.getGaitGeneratorParam()[1]
107 ggp.leg_default_translate_pos = [[0.0, -0.19, 0.0], [0.0, 0.19, 0.0], [0.7, -0.19, 0.0], [0.7, 0.19, 0.0]]
108 hcf.abc_svc.setGaitGeneratorParam(ggp)
110 hcf.abc_svc.goVelocity(-0.1, -0.05, -20)
120 demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str=
"5. go pos in trot")
121 demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.PACE, print_str=
"6. go pos in pace")
124 if __name__ ==
'__main__':
def demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str="5. go pos in trot")
def demoGaitGeneratorSetFootSteps(print_str="1. setFootSteps")
def demoGaitGeneratorSetFootStepsCrawl(print_str="4. setFootSteps in Crawl")
def demoGaitGeneratorSetFootStepsCycloidDelay()
def demoGoVelocityQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str="7. go velocity in trot")
def demoGaitGeneratorSetFootStepsRectangle()