prologue.py 1.24 KB
Newer Older
Olivier Stasse's avatar
Olivier Stasse committed
1
2
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
Guilhem Saurel's avatar
Guilhem Saurel committed
3

4
5
6
# sys.argv is not defined when running the remove interpreter, but it is
# required by rospy
import sys
7

Olivier Stasse's avatar
Olivier Stasse committed
8
from dynamic_graph.entity import PyEntityFactoryClass
9
from dynamic_graph.sot.pyrene.robot import Robot
Olivier Stasse's avatar
Olivier Stasse committed
10

11
12
13
14
15
if not hasattr(sys, 'argv'):
    sys.argv = [
        "dynamic_graph",
    ]

Guilhem Saurel's avatar
Guilhem Saurel committed
16
17
18
19
20
21
22
23
24
25
26
27
print("Prologue Pyrene TALOS Robot")


def makeRobot():
    """
    Create the device.
    This entity behaves exactly like robotsimu except:
    1. it does not provide the increment command
    2. it forwards the robot control to the sot-abstract
       controller.
    """

28
    DeviceTalos = PyEntityFactoryClass('DeviceTalos')
Olivier Stasse's avatar
Olivier Stasse committed
29

30
    # Create the robot using the device.
31
    robot = Robot(name='robot', device=DeviceTalos('PYRENE'), fromRosParam=True)
Guilhem Saurel's avatar
Guilhem Saurel committed
32
    robot.dynamic.com.recompute(0)
33
34
    _com = robot.dynamic.com.value
    robot.device.zmp.value = (_com[0], _com[1], 0.)
Olivier Stasse's avatar
Olivier Stasse committed
35

36
    return robot
Olivier Stasse's avatar
Olivier Stasse committed
37

Guilhem Saurel's avatar
Guilhem Saurel committed
38

Olivier Stasse's avatar
Olivier Stasse committed
39
40
41
42
43
44
45
46
####################################
#        --- IMPORTANT ---         #
#                                  #
# THIS FILE MUST NEVER BE CHANGED. #
# TO RUN YOUR EXPERIMENT, PLEASE   #
# WRITE A SEPARATE PYTHON MODULE   #
# AND LAUNCH IT USING dg-remote!   #
####################################