talos_stairs10_path.py 2.04 KB
Newer Older
1
from hpp.corbaserver.rbprm.scenarios.talos_path_planner import TalosPathPlanner
2
3


4
class PathPlanner(TalosPathPlanner):
5
6
7
    def load_rbprm(self):
        from talos_rbprm.talos_abstract import Robot
        # select ROM model with really conservative ROM shapes
8
9
        Robot.urdfName = "talos_trunk_large_reducedROM"
        self.robot_node_name = "talos_trunk_large_reducedROM"
10
11
12
13
14
15
16
17
18
19
20
        Robot.urdfNameRom = ['talos_lleg_rom_reduced', 'talos_rleg_rom_reduced']
        self.used_limbs = Robot.urdfNameRom
        self.rbprmBuilder = Robot()
        # As the ROM names have changed, we need to set this values again (otherwise it's automatically done)
        self.rbprmBuilder.setReferenceEndEffector('talos_lleg_rom_reduced', self.rbprmBuilder.ref_EE_lLeg)
        self.rbprmBuilder.setReferenceEndEffector('talos_rleg_rom_reduced', self.rbprmBuilder.ref_EE_rLeg)

    def init_problem(self):
        super().init_problem()
        # greatly increase the number of loops of the random shortcut
        self.ps.setParameter("PathOptimization/RandomShortcut/NumberOfLoops", 100)
21
22
        self.ps.setParameter("Kinodynamic/synchronizeVerticalAxis", True)
        self.ps.setParameter("Kinodynamic/verticalAccelerationBound", 3.)
23
24
25

    def compute_extra_config_bounds(self):
        # bounds for the extradof : by default use v_max/a_max on x and y axis and a large value on z axis
26
27
28
29
        self.extra_dof_bounds = [
            -self.v_max, self.v_max, -self.v_max, self.v_max, -10, 10, -self.a_max, self.a_max, -self.a_max,
            self.a_max, -10, 10
        ]
30
31

    def run(self):
32
        self.root_translation_bounds = [-1.5, 3, 0., 3.3, 0.95, 2.]
33
34
        self.init_problem()

35
36
        self.q_init[:3] = [0.05, 1.2, 0.98]
        self.q_goal[:3] = [1.87, 1.2, 1.58]
37

38
        self.init_viewer("multicontact/bauzil_stairs", reduce_sizes=[0.11, 0., 0.], visualize_affordances=["Support"])
39
40
41
        self.init_planner()
        self.solve()
        self.display_path()
42
        # self.play_path()
43
44
        self.hide_rom()

45

46
47
48
if __name__ == "__main__":
    planner = PathPlanner()
    planner.run()