diff --git a/core/python/test/rostest_mtc.py b/core/python/test/rostest_mtc.py index 2f1adb1f..a1cd51f1 100755 --- a/core/python/test/rostest_mtc.py +++ b/core/python/test/rostest_mtc.py @@ -27,7 +27,7 @@ class Test(unittest.TestCase): task.add(stages.CurrentState("current")) move = stages.MoveRelative("move", core.JointInterpolationPlanner()) move.group = self.PLANNING_GROUP - move.setDirection({"joint_1" : 0.2, "joint_2" : 0.4}) + move.setDirection({"joint_1": 0.2, "joint_2": 0.4}) task.add(move) task.enableIntrospection() @@ -42,14 +42,12 @@ class Test(unittest.TestCase): def test_Merger(self): cartesian = core.CartesianPath() + def createDisplacement(group, displacement): move = stages.MoveRelative("displace", cartesian) move.group = group - move.ik_frame = PoseStamped(header = Header(frame_id = "tool0")) - dir = Vector3Stamped( - header = Header(frame_id = "base_link"), - vector = Vector3(*displacement) - ) + move.ik_frame = PoseStamped(header=Header(frame_id="tool0")) + dir = Vector3Stamped(header=Header(frame_id="base_link"), vector=Vector3(*displacement)) move.setDirection(dir) move.restrictDirection(stages.MoveRelative.Direction.FORWARD) return move @@ -58,7 +56,7 @@ class Test(unittest.TestCase): task.add(stages.CurrentState("current")) merger = core.Merger("merger") merger.insert(createDisplacement(self.PLANNING_GROUP, [-0.2, 0, 0])) - merger.insert(createDisplacement(self.PLANNING_GROUP, [ 0.2, 0, 0])) + merger.insert(createDisplacement(self.PLANNING_GROUP, [0.2, 0, 0])) task.add(merger) task.enableIntrospection() @@ -67,6 +65,6 @@ class Test(unittest.TestCase): task.publish(task.solutions[0]) -if __name__ == '__main__': +if __name__ == "__main__": roscpp_init("test_mtc") rostest.rosrun("", "", Test) diff --git a/core/python/test/test_mtc.py b/core/python/test/test_mtc.py index dabe2708..818ce8fe 100644 --- a/core/python/test/test_mtc.py +++ b/core/python/test/test_mtc.py @@ -143,9 +143,11 @@ class TestStages(unittest.TestCase): except TypeError as e: pass except: - self.fail("Assigning {} did raise wrong exception: {}".format(value, sys.exc_info()[0])) + msg = "Assigning {} did raise wrong exception: {}" + self.fail(msg.format(value, sys.exc_info()[0])) else: - self.fail("Assigning {} did not raise an exception, result: {}".format(value, getattr(stage, name))) + msg = "Assigning {} did not raise an exception, result: {}" + self.fail(msg.format(value, getattr(stage, name))) def test_CurrentState(self): stage = stages.CurrentState("current") @@ -181,7 +183,7 @@ class TestStages(unittest.TestCase): stage.setGoal(PointStamped()) stage.setGoal(RobotState()) stage.setGoal("named pose") - stage.setGoal(dict(joint1 = 1.0, joint2 = 2.0)) + stage.setGoal(dict(joint1=1.0, joint2=2.0)) self._check(stage, "path_constraints", Constraints()) def test_MoveRelative(self): @@ -194,7 +196,7 @@ class TestStages(unittest.TestCase): self._check(stage, "path_constraints", Constraints()) stage.setDirection(TwistStamped()) stage.setDirection(Vector3Stamped()) - stage.setDirection({'joint': 0.1}) + stage.setDirection({"joint": 0.1}) def test_Connect(self): planner = core.PipelinePlanner() @@ -290,5 +292,5 @@ class TestTask(unittest.TestCase): task.add(stages.FixedState()) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/core/setup.py b/core/setup.py index adab9f74..2545e437 100644 --- a/core/setup.py +++ b/core/setup.py @@ -5,8 +5,8 @@ from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( # list of packages to setup - packages = ['moveit', 'moveit.python_tools', 'moveit.task_constructor'], - # specify location of root ('') package dir - package_dir = {'' : 'python/src'} + packages=["moveit", "moveit.python_tools", "moveit.task_constructor"], + # specify location of root ("") package dir + package_dir={"": "python/src"}, ) setup(**d) diff --git a/demo/scripts/cartesian.py b/demo/scripts/cartesian.py index 7dc0aa8e..9154b605 100755 --- a/demo/scripts/cartesian.py +++ b/demo/scripts/cartesian.py @@ -8,6 +8,7 @@ from math import pi import time from moveit.python_tools import roscpp_init + roscpp_init("mtc_tutorial") group = "panda_arm" @@ -25,26 +26,26 @@ task.add(stages.CurrentState("current state")) # move along x move = stages.MoveRelative("x +0.2", cartesian) move.group = group -header = Header(frame_id = "world") -move.setDirection(Vector3Stamped(header=header, vector=Vector3(0.2,0,0))) +header = Header(frame_id="world") +move.setDirection(Vector3Stamped(header=header, vector=Vector3(0.2, 0, 0))) task.add(move) # move along y move = stages.MoveRelative("y -0.3", cartesian) move.group = group -move.setDirection(Vector3Stamped(header=header, vector=Vector3(0,-0.3,0))) +move.setDirection(Vector3Stamped(header=header, vector=Vector3(0, -0.3, 0))) task.add(move) # rotate about z move = stages.MoveRelative("rz +45°", cartesian) move.group = group -move.setDirection(TwistStamped(header=header, twist=Twist(angular=Vector3(0,0,pi/4.)))) +move.setDirection(TwistStamped(header=header, twist=Twist(angular=Vector3(0, 0, pi / 4.0)))) task.add(move) # Cartesian motion, defined as joint-space offset move = stages.MoveRelative("joint offset", cartesian) move.group = group -move.setDirection(dict(panda_joint1=pi/6, panda_joint3=-pi/6)) +move.setDirection(dict(panda_joint1=pi / 6, panda_joint3=-pi / 6)) task.add(move) # moveTo named posture, using joint-space interplation