...
 
Commits (9)
......@@ -18,14 +18,13 @@
<build_depend version_gte="1.1" version_lt="2.0">genmsg</build_depend>
<build_depend>sot-core</build_depend>
<build_depend>pinocchio</build_depend>
<build_depend>sot-tools</build_depend>
<build_depend>sot-core</build_depend>
<build_depend>pinocchio</build_depend>
<build_export_depend>pinocchio</build_export_depend>
<exec_depend>sot-tools</exec_depend>
<exec_depend>sot-core</exec_depend>
<exec_depend>pinocchio</exec_depend>
......
......@@ -49,7 +49,6 @@ IF(BUILD_PYTHON_INTERFACE)
__init__.py
humanoid_robot.py
tools.py
parser.py
)
FOREACH(py_file ${${PY_NAME}_PYTHON})
......
This diff is collapsed.
......@@ -133,7 +133,7 @@ def checkFinalConfiguration(position, finalPosition):
if 'argv' in sys.__dict__:
from optparse import OptionParser
from dynamic_graph.sot.dynamics.solver import Solver
from dynamic_graph.sot.dynamic_pinocchio.solver import Solver
# Parse options and enable robotviewer client if wanted.
clt = None
......
......@@ -42,3 +42,8 @@ FOREACH(test ${tests})
waist-attitude-from-sensor
)
ENDFOREACH(test)
IF(BUILD_PYTHON_INTERFACE)
ADD_SUBDIRECTORY(python)
ENDIF(BUILD_PYTHON_INTERFACE)
SET(${PROJECT_NAME}_PYTHON_TESTS
humanoid_robot
)
FOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
ADD_PYTHON_UNIT_TEST("py-${TEST}" "tests/python/${TEST}.py")
ENDFOREACH(TEST ${${PROJECT_NAME}_PYTHON_TESTS})
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
import os
print(os.environ)
from dynamic_graph.sot.dynamics.feet_follower import FeetFollowerFromFile
from dynamic_graph.sot.dynamics.tools import checkFinalConfiguration, clt, plug, robot, solver, timeStep
from dynamic_graph.sot.dynamic_pinocchio.feet_follower import FeetFollowerFromFile
from dynamic_graph.sot.dynamic_pinocchio.tools import checkFinalConfiguration, clt, plug, robot, solver, timeStep
feetFollower = FeetFollowerFromFile('feet-follower')
......
......@@ -4,15 +4,43 @@
import unittest
from dynamic_graph.sot.dynamics.humanoid_robot import HumanoidRobot
from dynamic_graph.sot.dynamic_pinocchio.humanoid_robot import AbstractHumanoidRobot
class Robot (AbstractHumanoidRobot):
def __init__ (self, name, urdfString=None, urdfFile=None):
import pinocchio
if urdfString is not None:
self.loadModelFromString(urdfString)
elif urdfFile is not None:
self.loadModelFromUrdf(urdfFile)
else:
raise RuntimeError("You should provide either a URDF file or a URDF string")
class HumanoidRobotTest(unittest.TestCase):
def test_simple(self):
AbstractHumanoidRobot.__init__(self, name, None)
def defineHalfSitting (self, q):
pass
def test_model_not_exist(self):
self.assertRaises(IOError, HumanoidRobot, "robot", True, "IDONOTEXIST")
class HumanoidRobotTest(unittest.TestCase):
def setUp(self):
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
self.r2d2_urdf_file = os.path.join(dir_path, "r2d2.urdf")
def test_non_instanciable_robot(self):
class NonInstanciableRobot (AbstractHumanoidRobot):
pass
self.assertRaises(TypeError, NonInstanciableRobot, "non_instanciable_robot")
def test_build_robot_from_string(self):
with open(self.r2d2_urdf_file, 'r') as urdf:
urdfString = urdf.read()
robot = Robot("test_build_robot_from_string", urdfString = urdfString)
def test_build_robot_from_urdf(self):
robot = Robot("test_build_robot_from_string", urdfFile = self.r2d2_urdf_file)
if __name__ == '__main__':
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
from dynamic_graph.sot.dynamics.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
from dynamic_graph.sot.dynamic_pinocchio.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
# Move left wrist
reach(robot, 'left-wrist', 0.25, 0.25, 0.5)
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
from dynamic_graph.sot.dynamics.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
from dynamic_graph.sot.dynamic_pinocchio.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
# Move left wrist
reach(robot, 'left-wrist', 0.25, 0, 0.1)
......
......@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
from dynamic_graph.sot.dynamics.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
from dynamic_graph.sot.dynamic_pinocchio.tools import checkFinalConfiguration, clt, reach, robot, solver, timeStep
# Move right wrist
reach(robot, 'right-wrist', 0.25, 0, 0.1)
......