From dda0e2e37d55dee52ab25bc0b540af886ed17e69 Mon Sep 17 00:00:00 2001 From: Olivier Stasse Date: Thu, 14 May 2020 16:36:01 +0200 Subject: [PATCH 1/3] [python] Fix a bug during initialization phase introduced by #2f5d2c6 If the device is provided in argument then the robot already exist and no simulation is needed. On talos.py the useless initialConfig argument is removed --- src/dynamic_graph/sot/pyrene/robot.py | 3 +-- src/dynamic_graph/sot/talos/talos.py | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dynamic_graph/sot/pyrene/robot.py b/src/dynamic_graph/sot/pyrene/robot.py index 720fbd3..3e79fbd 100644 --- a/src/dynamic_graph/sot/pyrene/robot.py +++ b/src/dynamic_graph/sot/pyrene/robot.py @@ -48,8 +48,7 @@ def defineHalfSitting (self, q): [ 0., 0.]) def __init__(self, name, device=None, tracer=None, fromRosParam=None): - Talos.__init__(self, name, device, tracer, - fromRosParam=fromRosParam) + Talos.__init__(self, name, device=device, tracer=tracer, fromRosParam=fromRosParam) """ TODO:Confirm these values # Define camera positions w.r.t gaze. diff --git a/src/dynamic_graph/sot/talos/talos.py b/src/dynamic_graph/sot/talos/talos.py index ec280a4..a273417 100644 --- a/src/dynamic_graph/sot/talos/talos.py +++ b/src/dynamic_graph/sot/talos/talos.py @@ -51,7 +51,7 @@ def smallToFull(self, config): res = config[0:27] + 7 * (0., ) + config[27:34] + 7 * (0., ) + config[34:] return res - def __init__(self, name, initialConfig, device=None, tracer=None, fromRosParam=False): + def __init__(self, name, device=None, tracer=None, fromRosParam=False): self.OperationalPointsMap = { 'left-wrist': 'arm_left_7_joint', 'right-wrist': 'arm_right_7_joint', @@ -80,6 +80,8 @@ def __init__(self, name, initialConfig, device=None, tracer=None, fromRosParam=F assert hasattr(self, "pinocchioModel") assert hasattr(self, "pinocchioData") + if device!=None: + self.device = device AbstractHumanoidRobot.__init__(self, name, tracer) self.OperationalPoints.append('waist') @@ -92,7 +94,6 @@ def __init__(self, name, initialConfig, device=None, tracer=None, fromRosParam=F self.dynamic.displayModel() self.dimension = self.dynamic.getDimension() - self.device = device self.initializeRobot() self.AdditionalFrames.append( From e51fd3859f4e0ed6bb9d79014fe882b4bea88435 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 14 May 2020 17:11:28 +0200 Subject: [PATCH 2/3] [Python] reformat for tabs to space --- src/dynamic_graph/sot/talos/talos.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/dynamic_graph/sot/talos/talos.py b/src/dynamic_graph/sot/talos/talos.py index a273417..5d51f66 100644 --- a/src/dynamic_graph/sot/talos/talos.py +++ b/src/dynamic_graph/sot/talos/talos.py @@ -3,11 +3,13 @@ from __future__ import print_function +import pinocchio + from dynamic_graph import plug from dynamic_graph.sot.core.math_small_entities import Derivator_of_Vector from dynamic_graph.sot.dynamic_pinocchio import DynamicPinocchio -from dynamic_graph.sot.dynamic_pinocchio.humanoid_robot import AbstractHumanoidRobot -import pinocchio +from dynamic_graph.sot.dynamic_pinocchio.humanoid_robot import \ + AbstractHumanoidRobot from rospkg import RosPack @@ -70,18 +72,17 @@ def __init__(self, name, device=None, tracer=None, fromRosParam=False): raise RuntimeError('"' + rosParamName + '" is not a ROS parameter.') s = rospy.get_param(rosParamName) - self.loadModelFromString(s, rootJointType=pinocchio.JointModelFreeFlyer, - removeMimicJoints=True) + self.loadModelFromString(s, rootJointType=pinocchio.JointModelFreeFlyer, removeMimicJoints=True) else: self.loadModelFromUrdf(self.defaultFilename, - rootJointType=pinocchio.JointModelFreeFlyer, - removeMimicJoints=True) + rootJointType=pinocchio.JointModelFreeFlyer, + removeMimicJoints=True) assert hasattr(self, "pinocchioModel") assert hasattr(self, "pinocchioData") - if device!=None: - self.device = device + if device != None: + self.device = device AbstractHumanoidRobot.__init__(self, name, tracer) self.OperationalPoints.append('waist') From e703a7b54107305fd57e42986801472e788bc81a Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 14 May 2020 17:12:11 +0200 Subject: [PATCH 3/3] =?UTF-8?q?[Python]=20!=3D=20None=20=E2=86=92=20is=20n?= =?UTF-8?q?ot=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dynamic_graph/sot/talos/talos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamic_graph/sot/talos/talos.py b/src/dynamic_graph/sot/talos/talos.py index 5d51f66..67d565d 100644 --- a/src/dynamic_graph/sot/talos/talos.py +++ b/src/dynamic_graph/sot/talos/talos.py @@ -81,7 +81,7 @@ def __init__(self, name, device=None, tracer=None, fromRosParam=False): assert hasattr(self, "pinocchioModel") assert hasattr(self, "pinocchioData") - if device != None: + if device is not None: self.device = device AbstractHumanoidRobot.__init__(self, name, tracer)