<?xml version="1.0"?>
<program>

<robot file = "xml/robot/centipede6_5.xml"/>

<parameters>
<beta init = "0.5" type = "text"/>
<upRatio init = "0.5" type = "text"/>
<holdRatio init = "0.5" type = "text"/>
<N init = "3" type = "text"/>
<upTime init = "3" type = "text"/>
<upPhase init = "0.5" type = "text"/>
<upOffset init = "0.5" type = "text"/>
</parameters>

<controls>
<config init = "horizontal" states = "horizontal, vertical"/>
</controls>

<main>
<standup time="(upOffset+(N-1)*upPhase+1)*upTime"/>
<walk exit = "$config==vertical"/>
<standup2 time="(upOffset+(N-1)*upPhase+1)*upTime"/>
<walk2 exit = "$config==horizontal"/>
</main>

<behaviors>
<standup>
<getup group = "!left" phase = "upPhase" period = "upTime" cycles = "1"/>
<getup group = "right" offset = "upOffset" phase = "upPhase" period = "upTime" cycles = "1"/>
<bodyrelease group = "zero" period = "upTime"/>
</standup>
<walk>
<wave group = "!left" offset = "0" phase = "beta" period = "3"/>
<wave group = "right" offset = "0.5" phase = "beta" period = "3"/>
</walk>
<standup2>
<bodyhold group = "!body_left" phase = "upPhase" period = "upTime" cycles = "1"/>
<bodyhold group = "body_right" offset = "upOffset" phase = "upPhase" period = "upTime" cycles = "1"/>
<bodyrelease group = "zero_2" period = "upTime"/>
</standup2>
<walk2>
<wave2 group = "!left_2" offset = "0" phase = "beta" period = "3"/>
<wave2 group = "right_2" offset = "0.5" phase = "beta" period = "3"/>
</walk2>
</behaviors>

<automata>
<wave states = "up, down, hold, reset"
times = "(1-beta)*upRatio, (1-beta)*(1-upRatio), beta*holdRatio, beta*(1-holdRatio)"/>
<getup states = "reset"/>
<wave2 states = "up2, down2" times = "(1-beta), beta"/>
<bodyhold type = "table" states = "-80"/>
<bodyrelease type = "table" states = "0"/>
</automata>

<states>
<up angles = "30, -22, -90"/>
<down angles = "30, -60, -27"/>
<hold angles = "@, @, @"/>
<reset angles = "0, -60, -30"/>

<up2 angles = "30, -30"/>
<down2 angles = "0, 0"/>

</states>

</program>


