Skip to content

Commit

Permalink
[sample4legrobot_auto_balancer.py] add goPos in trot and in pace samples
Browse files Browse the repository at this point in the history
  • Loading branch information
eisoku9618 committed Jan 2, 2016
1 parent b09f502 commit 4c966a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions sample/Sample4LegRobot/sample4legrobot_auto_balancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def init ():
hcf.abc_svc.setAutoBalancerParam(abcp)
# set gg param
ggp = hcf.abc_svc.getGaitGeneratorParam()[1]
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]]
ggp.zmp_weight_map = [1.0]*4
ggp.default_step_height = 0.065 # see https://github.com/fkanehiro/hrpsys-base/issues/801
hcf.abc_svc.setGaitGeneratorParam(ggp)
Expand Down Expand Up @@ -81,12 +82,28 @@ def demoGaitGeneratorSetFootStepsCrawl(print_str="4. setFootSteps in Crawl"):
OpenHRP.AutoBalancerService.Footsteps([OpenHRP.AutoBalancerService.Footstep([0.0+0.01,-0.19,0], [1,0,0,0], "rleg")])])
hcf.abc_svc.waitFootSteps()

def demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str="5. go pos in trot"):
print >> sys.stderr, print_str
# set gait type
abcp=hcf.abc_svc.getAutoBalancerParam()[1]
abcp.default_gait_type = gait_type
hcf.abc_svc.setAutoBalancerParam(abcp)
# set default translate pos
ggp = hcf.abc_svc.getGaitGeneratorParam()[1]
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]]
hcf.abc_svc.setGaitGeneratorParam(ggp)
# go pos
hcf.abc_svc.goPos(-0.5, +0.2, 20)
hcf.abc_svc.waitFootSteps()

def demo():
init()
demoGaitGeneratorSetFootSteps()
demoGaitGeneratorSetFootStepsRectangle()
demoGaitGeneratorSetFootStepsCycloidDelay()
demoGaitGeneratorSetFootStepsCrawl()
demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.TROT, print_str="5. go pos in trot")
demoGoPosQuadruped(gait_type=OpenHRP.AutoBalancerService.PACE, print_str="6. go pos in pace")

if __name__ == '__main__':
demo()

0 comments on commit 4c966a1

Please sign in to comment.