From 3b4fcf1614803a454041a77d2c11c288a7380278 Mon Sep 17 00:00:00 2001 From: Brian Delhaisse Date: Sat, 13 Jul 2019 23:57:09 +0200 Subject: [PATCH] update doc for robots + add grippers --- pyrobolearn/__init__.py | 4 + pyrobolearn/robots/README.md | 2 +- pyrobolearn/robots/__init__.py | 43 +- pyrobolearn/robots/aibo.py | 20 +- pyrobolearn/robots/allegrohand.py | 23 +- pyrobolearn/robots/ant.py | 9 +- pyrobolearn/robots/anymal.py | 26 +- pyrobolearn/robots/atlas.py | 22 +- pyrobolearn/robots/ballbot.py | 17 +- pyrobolearn/robots/baxter.py | 61 +- pyrobolearn/robots/bb8.py | 15 +- pyrobolearn/robots/blackbird.py | 22 +- pyrobolearn/robots/cartpole.py | 35 +- pyrobolearn/robots/cassie.py | 32 +- pyrobolearn/robots/centauro.py | 20 +- pyrobolearn/robots/cogimon.py | 24 +- pyrobolearn/robots/coman.py | 20 +- pyrobolearn/robots/crab.py | 22 +- pyrobolearn/robots/cubli.py | 34 +- pyrobolearn/robots/darwin.py | 20 +- pyrobolearn/robots/ecaa9.py | 31 +- pyrobolearn/robots/edo.py | 24 +- pyrobolearn/robots/epuck.py | 24 +- pyrobolearn/robots/f10_racecar.py | 20 +- pyrobolearn/robots/fetch.py | 59 +- pyrobolearn/robots/flappy.py | 27 +- pyrobolearn/robots/franka.py | 73 +- pyrobolearn/robots/gripper.py | 112 ++ pyrobolearn/robots/half_cheetah.py | 9 +- pyrobolearn/robots/hand.py | 38 +- pyrobolearn/robots/hopper.py | 9 +- pyrobolearn/robots/hubo.py | 26 +- pyrobolearn/robots/humanoid.py | 9 +- pyrobolearn/robots/husky.py | 24 +- pyrobolearn/robots/hyq.py | 22 +- pyrobolearn/robots/hyq2max.py | 24 +- pyrobolearn/robots/icub.py | 26 +- pyrobolearn/robots/jaco.py | 62 +- pyrobolearn/robots/kilobot.py | 28 +- pyrobolearn/robots/kr5.py | 24 +- pyrobolearn/robots/kuka_iiwa.py | 24 +- pyrobolearn/robots/kuka_lwr.py | 24 +- pyrobolearn/robots/laikago.py | 22 +- pyrobolearn/robots/legged_robot.py | 53 +- pyrobolearn/robots/littledog.py | 22 +- pyrobolearn/robots/manipulator.py | 33 +- pyrobolearn/robots/manipulator2d.py | 20 +- pyrobolearn/robots/minitaur.py | 30 +- pyrobolearn/robots/mkz.py | 24 +- pyrobolearn/robots/morphex.py | 22 +- pyrobolearn/robots/nao.py | 21 +- pyrobolearn/robots/opendog.py | 22 +- pyrobolearn/robots/pepper.py | 23 +- pyrobolearn/robots/phantomx.py | 22 +- pyrobolearn/robots/pleurobot.py | 15 +- pyrobolearn/robots/pr2.py | 59 +- pyrobolearn/robots/quadcopter.py | 70 +- pyrobolearn/robots/rhex.py | 24 +- pyrobolearn/robots/robot.py | 42 + pyrobolearn/robots/rrbot.py | 18 +- pyrobolearn/robots/sawyer.py | 22 +- pyrobolearn/robots/schunk_hand.py | 86 + pyrobolearn/robots/sea_hexapod.py | 20 +- pyrobolearn/robots/sea_snake.py | 20 +- pyrobolearn/robots/shadowhand.py | 26 +- pyrobolearn/robots/softhand.py | 23 +- pyrobolearn/robots/swimmer.py | 9 +- pyrobolearn/robots/techpod.py | 26 +- pyrobolearn/robots/uav.py | 44 + .../urdfs/allegrohand/allegro_right_hand.urdf | 4 +- .../robots/urdfs/baxter/baxter_gripper.urdf | 326 ++++ .../robots/urdfs/centauro/schunk_hand.urdf | 1419 +++++++++++++++++ .../robots/urdfs/fetch/fetch_gripper.urdf | 81 + .../robots/urdfs/franka/franka_gripper.urdf | 151 ++ .../robots/urdfs/jaco/jaco_gripper.urdf | 631 ++++++++ pyrobolearn/robots/urdfs/pr2/pr2_gripper.urdf | 683 ++++++++ .../robots/urdfs/shadowhand/left_hand.urdf | 4 +- .../robots/urdfs/shadowhand/right_hand.urdf | 4 +- .../robots/urdfs/softhand/left_hand.urdf | 4 +- .../robots/urdfs/softhand/right_hand.urdf | 4 +- pyrobolearn/robots/urdfs/wam/wam_gripper.urdf | 505 ++++++ .../urdfs/wam/wam_gripper_with_wrist.urdf | 580 +++++++ .../robots/urdfs/youbot/youbot_gripper.urdf | 208 +++ pyrobolearn/robots/usv.py | 11 + pyrobolearn/robots/uuv.py | 11 + pyrobolearn/robots/walker2d.py | 9 +- pyrobolearn/robots/walkman.py | 27 +- pyrobolearn/robots/wam.py | 64 +- pyrobolearn/robots/wheeled_robot.py | 47 +- pyrobolearn/robots/youbot.py | 118 +- 90 files changed, 6277 insertions(+), 622 deletions(-) create mode 100644 pyrobolearn/robots/schunk_hand.py create mode 100644 pyrobolearn/robots/urdfs/baxter/baxter_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/centauro/schunk_hand.urdf create mode 100644 pyrobolearn/robots/urdfs/fetch/fetch_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/franka/franka_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/jaco/jaco_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/pr2/pr2_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/wam/wam_gripper.urdf create mode 100644 pyrobolearn/robots/urdfs/wam/wam_gripper_with_wrist.urdf create mode 100644 pyrobolearn/robots/urdfs/youbot/youbot_gripper.urdf diff --git a/pyrobolearn/__init__.py b/pyrobolearn/__init__.py index 98240c7..56e8b13 100644 --- a/pyrobolearn/__init__.py +++ b/pyrobolearn/__init__.py @@ -5,6 +5,7 @@ name = "pyrobolearn" import sys import signal +from itertools import count # logging import logging @@ -82,6 +83,9 @@ from . import algos # import experiments +# import priority tasks +from . import priorities + # Meta-information about the package __author__ = "Brian Delhaisse" diff --git a/pyrobolearn/robots/README.md b/pyrobolearn/robots/README.md index 9b49b46..1e797ef 100644 --- a/pyrobolearn/robots/README.md +++ b/pyrobolearn/robots/README.md @@ -40,7 +40,7 @@ The folder contains different kind of robots including manipulators, legged robo - [E-puck](https://github.com/gctronic/epuck_driver_cpp) - [F10 racecar](https://github.com/erwincoumans/pybullet_robots/tree/master/data/f10_racecar) - [Fetch](https://github.com/fetchrobotics/fetch_ros) -- [Franka Emika](https://github.com/frankaemika/franka_ros) +- [Franka Emika Panda](https://github.com/frankaemika/franka_ros) - [Half Cheetah](https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf) - [Hopper](https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf) - [Hubo](https://github.com/robEllenberg/hubo-urdf) diff --git a/pyrobolearn/robots/__init__.py b/pyrobolearn/robots/__init__.py index b68702e..2acf306 100644 --- a/pyrobolearn/robots/__init__.py +++ b/pyrobolearn/robots/__init__.py @@ -3,6 +3,7 @@ import os import importlib import inspect +import re # General robot class from .base import Body, MovableBody, ControllableBody @@ -62,23 +63,24 @@ from .rhex import Rhex # Manipulators from .rrbot import RRBot -from .wam import WAM +from .wam import WAM, BarrettHand from .kuka_lwr import KukaLWR from .kuka_iiwa import KukaIIWA -from .jaco import Jaco -from .franka import Franka +from .jaco import Jaco, JacoGripper +from .franka import Franka, FrankaGripper from .sawyer import Sawyer from .edo import Edo from .kr5 import KR5 from .manipulator2d import Manipulator2D # Bi-Manipulators -from .baxter import Baxter +from .baxter import Baxter, BaxterGripper # Hands from .allegrohand import AllegroHand from .softhand import SoftHand from .shadowhand import ShadowHand +from .schunk_hand import SchunkHand # Wheeled from .epuck import Epuck @@ -87,11 +89,11 @@ from .mkz import MKZ from .husky import Husky # Wheeled + (single) manipulator -from .fetch import Fetch +from .fetch import Fetch, FetchGripper # Wheeled + Bi-manipulators from .pepper import Pepper -from .pr2 import PR2 +from .pr2 import PR2, PR2Gripper # Wheeled + Quadruped + Bi-manipulators from .centauro import Centauro @@ -114,7 +116,7 @@ from .cartpole import CartPole from .cubli import Cubli from .sea_snake import SEASnake from .bb8 import BB8 -from .youbot import Youbot, YoubotBase, KukaYoubotArm, YoubotDualArm +from .youbot import Youbot, YoubotBase, KukaYoubotArm, YoubotDualArm, YoubotGripper from .ballbot import Ballbot # Robots # @@ -125,7 +127,7 @@ implemented_robots = set([f[:-3] for f in os.listdir(path) if os.path.isfile(os. and f.endswith('.py')]) # remove few items from the set for s in ['__init__', 'actuators', 'sensors', 'legged_robot', 'manipulator', 'wheeled_robot', 'uav', 'usv', - 'uuv', 'hand']: + 'uuv', 'hand', 'gripper']: if s in implemented_robots: implemented_robots.remove(s) @@ -134,14 +136,31 @@ implemented_robots = list(implemented_robots) # TODO: fix problem with icub implemented_robots.remove('icub') +print(len(implemented_robots), implemented_robots) + # create dictionary that maps robot names to robot classes robot_names_to_classes = {} for robot_name in implemented_robots: module = importlib.import_module('pyrobolearn.robots.' + robot_name) # 'robots.'+robot) # robot_class = getattr(module, robot.capitalize()) - for name, obj in inspect.getmembers(module): + for name, cls in inspect.getmembers(module): # check if it is a class, and the names match - if inspect.isclass(obj) and name.lower() == ''.join(robot_name.split('_')): - robot_names_to_classes[robot_name] = obj - break + if inspect.isclass(cls) and issubclass(cls, Robot): + if name.lower() == ''.join(robot_name.split('_')): + robot_names_to_classes[robot_name] = cls + else: + name_list = re.findall('[0-9]*[A-Z]+[0-9]*[a-z]*', name) + name = '_'.join([n.lower() for n in name_list]) + # TODO: improve regex + if name == 'wamgripper': + name = 'wam_gripper' + elif name == 'uuvrobot': + name = 'uuv_robot' + elif name == 'usvrobot': + name = 'usv_robot' + robot_names_to_classes[name] = cls + +implemented_robots = set(list(robot_names_to_classes.keys())) + +print(len(implemented_robots), implemented_robots) diff --git a/pyrobolearn/robots/aibo.py b/pyrobolearn/robots/aibo.py index 0f42237..523fdf0 100644 --- a/pyrobolearn/robots/aibo.py +++ b/pyrobolearn/robots/aibo.py @@ -23,16 +23,22 @@ class Aibo(QuadrupedRobot): WARNINGS: THE INERTIA MATRICES AND THE POSITION OF COLLISIONS MESHES IN THE URDF NEED TO BE CORRECTED!! References: - [1] https://github.com/dkotfis/aibo_ros + - [1] https://github.com/dkotfis/aibo_ros """ - def __init__(self, - simulator, - position=(0, 0, 0.02), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.02), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/aibo/aibo.urdf'): + """ + Initialize the Aibo robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.02) diff --git a/pyrobolearn/robots/allegrohand.py b/pyrobolearn/robots/allegrohand.py index 885aaed..fd211f2 100644 --- a/pyrobolearn/robots/allegrohand.py +++ b/pyrobolearn/robots/allegrohand.py @@ -20,17 +20,22 @@ class AllegroHand(Hand): r"""Allegro Hand References: - [1] http://www.simlab.co.kr/Allegro-Hand.htm - [2] https://github.com/simlabrobotics/allegro_hand_ros + - [1] http://www.simlab.co.kr/Allegro-Hand.htm + - [2] https://github.com/simlabrobotics/allegro_hand_ros """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - scale=1., - left=False, - fixed_base=True): + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), scale=1., fixed_base=True): + # left=False + """ + Initialize the Allegro hand. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the hand base will be fixed in the world. + scale (float): scaling factor that is used to scale the hand. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/ant.py b/pyrobolearn/robots/ant.py index 620facf..ea78ec0 100644 --- a/pyrobolearn/robots/ant.py +++ b/pyrobolearn/robots/ant.py @@ -19,15 +19,10 @@ class Ant(QuadrupedRobot): r"""Ant Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(0, 0, 0.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/ant.xml'): # check parameters if position is None: diff --git a/pyrobolearn/robots/anymal.py b/pyrobolearn/robots/anymal.py index 89f863b..4c5743d 100644 --- a/pyrobolearn/robots/anymal.py +++ b/pyrobolearn/robots/anymal.py @@ -24,19 +24,25 @@ class ANYmal(QuadrupedRobot): ANYmal is equipped with 12 SEAs' References: - [1] "ANYmal - a Highly Mobile and Dynamic Quadrupedal Robot", Hutter et al., 2016 - [2] "Learning agile and dynamic motor skills for legged robots", Hwangbo et al., 2019 - [3] www.rsl.ethz.ch/robots-media/anymal.html - [4] www.anybotics.com/anymal + - [1] "ANYmal - a Highly Mobile and Dynamic Quadrupedal Robot", Hutter et al., 2016 + - [2] "Learning agile and dynamic motor skills for legged robots", Hwangbo et al., 2019 + - [3] www.rsl.ethz.ch/robots-media/anymal.html + - [4] www.anybotics.com/anymal """ - def __init__(self, - simulator, - position=(0, 0, .6), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .6), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/anymal/anymal.urdf'): + """ + Initialize the ANYmal robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.6) diff --git a/pyrobolearn/robots/atlas.py b/pyrobolearn/robots/atlas.py index 33c2cbc..4aecde5 100644 --- a/pyrobolearn/robots/atlas.py +++ b/pyrobolearn/robots/atlas.py @@ -22,17 +22,23 @@ class Atlas(BipedRobot, BiManipulator): Atlas robot developed by Boston Dynamics. References: - [1] Boston Dynamics: https://www.bostondynamics.com/atlas - [2] URDF: https://github.com/openai/roboschool/tree/master/roboschool/models_robot/atlas_description + - [1] Boston Dynamics: https://www.bostondynamics.com/atlas + - [2] URDF: https://github.com/openai/roboschool/tree/master/roboschool/models_robot/atlas_description """ - def __init__(self, - simulator, - position=(0, 0, 1.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/atlas/atlas_v4_with_multisense.urdf'): + """ + Initialize the Atlas robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.) diff --git a/pyrobolearn/robots/ballbot.py b/pyrobolearn/robots/ballbot.py index 0cf5fcf..7362932 100644 --- a/pyrobolearn/robots/ballbot.py +++ b/pyrobolearn/robots/ballbot.py @@ -17,15 +17,26 @@ __status__ = "Development" # TODO inertia are not corrects class Ballbot(Robot): - r"""BB8 robot + r"""Ballbot robot References: - [1] https://github.com/eborghi10/BB-8-ROS - [2] http://www.theconstructsim.com/bb-8-gazebo-model/ + - [1] https://github.com/eborghi10/BB-8-ROS + - [2] http://www.theconstructsim.com/bb-8-gazebo-model/ """ def __init__(self, simulator, position=(0, 0, 0.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/ballbot/ballbot.urdf'): + """ + Initialize the Ballbot robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/baxter.py b/pyrobolearn/robots/baxter.py index 25aafc1..89b3ee7 100644 --- a/pyrobolearn/robots/baxter.py +++ b/pyrobolearn/robots/baxter.py @@ -5,6 +5,8 @@ import os from pyrobolearn.robots.manipulator import BiManipulator +from pyrobolearn.robots.gripper import ParallelGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -21,17 +23,23 @@ class Baxter(BiManipulator): Baxter robot built by Rethink Robotics. References: - [1] Rethink Robotics: https://www.rethinkrobotics.com/ - [2] https://github.com/RethinkRobotics/baxter_common + - [1] Rethink Robotics: https://www.rethinkrobotics.com/ + - [2] https://github.com/RethinkRobotics/baxter_common """ - def __init__(self, - simulator, - position=(0, 0, 0.95), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.95), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/baxter/baxter.urdf'): + """ + Initialize the Baxter robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.95) @@ -58,6 +66,43 @@ class Baxter(BiManipulator): self.hands = [self.get_link_ids(link) for link in ['left_gripper', 'right_gripper'] if link in self.link_names] +class BaxterGripper(ParallelGripper): + r"""Baxter Gripper + + Baxter robot built by Rethink Robotics. + + References: + - [1] Rethink Robotics: https://www.rethinkrobotics.com/ + - [2] https://github.com/RethinkRobotics/baxter_common + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/baxter/baxter_gripper.urdf'): + """ + Initialize the Baxter gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0, 0, 1) + if fixed_base is None: + fixed_base = True + + super(BaxterGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'baxter_gripper' + + if __name__ == "__main__": from itertools import count from pyrobolearn.simulators import BulletSim diff --git a/pyrobolearn/robots/bb8.py b/pyrobolearn/robots/bb8.py index c69fbec..c70b6ab 100644 --- a/pyrobolearn/robots/bb8.py +++ b/pyrobolearn/robots/bb8.py @@ -19,12 +19,23 @@ class BB8(Robot): r"""BB8 robot References: - [1] https://github.com/eborghi10/BB-8-ROS - [2] http://www.theconstructsim.com/bb-8-gazebo-model/ + - [1] https://github.com/eborghi10/BB-8-ROS + - [2] http://www.theconstructsim.com/bb-8-gazebo-model/ """ def __init__(self, simulator, position=(0, 0, 0.4), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/bb8/bb8.urdf'): + """ + Initialize the BB8 robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.4) diff --git a/pyrobolearn/robots/blackbird.py b/pyrobolearn/robots/blackbird.py index c2edf7c..58be854 100644 --- a/pyrobolearn/robots/blackbird.py +++ b/pyrobolearn/robots/blackbird.py @@ -23,17 +23,23 @@ class Blackbird(BipedRobot): roughly 15 kg" [1]. References: - [1] https://hackaday.io/project/160882-blackbird-bipedal-robot - [2] https://github.com/G-Levine + - [1] https://hackaday.io/project/160882-blackbird-bipedal-robot + - [2] https://github.com/G-Levine """ - def __init__(self, - simulator, - position=(0, 0, 1.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 1.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/blackbird/blackbird_biped.urdf'): + """ + Initialize the Blackbird robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ self.height = 1.2 self.base_height = self.height diff --git a/pyrobolearn/robots/cartpole.py b/pyrobolearn/robots/cartpole.py index 8c57745..cd5d0d0 100644 --- a/pyrobolearn/robots/cartpole.py +++ b/pyrobolearn/robots/cartpole.py @@ -27,23 +27,30 @@ class CartPole(Robot): The number of links for the pendulum can be specified during runtime. References: - [1] "Reinforcement Learning: an Introduction", Barto and Sutton, 1998 - [2] Cartpole bullet environment: + - [1] "Reinforcement Learning: an Introduction", Barto and Sutton, 1998 + - [2] Cartpole bullet environment: github.com/bulletphysics/bullet3/blob/master/examples/pybullet/gym/pybullet_envs/bullet/cartpole_bullet.py - [3] "PyDy Tutorial: Human Standing": https://github.com/pydy/pydy-tutorial-human-standing - [4] "Dynamics with Python balancing the five link pendulum": http://www.moorepants.info/blog/npendulum.html + - [3] "PyDy Tutorial: Human Standing": https://github.com/pydy/pydy-tutorial-human-standing + - [4] "Dynamics with Python balancing the five link pendulum": http://www.moorepants.info/blog/npendulum.html """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - scale=1., - fixed_base=True, - urdf=os.path.join(pybullet_data.getDataPath(), "cartpole.urdf"), - num_links=1, - inverted_pole=False, - pole_mass=1): # pole_mass=10 + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), scale=1., fixed_base=True, + num_links=1, inverted_pole=False, pole_mass=1, + urdf=os.path.join(pybullet_data.getDataPath(), "cartpole.urdf")): # pole_mass=10 + """ + Initialize the Cartpole robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + num_links (int): number of links / poles connected to each other. + inverted_pole (bool): if we should start with inverted poles, or not. + pole_mass (float): mass of each link/pole. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/cassie.py b/pyrobolearn/robots/cassie.py index 56426e5..64e850a 100644 --- a/pyrobolearn/robots/cassie.py +++ b/pyrobolearn/robots/cassie.py @@ -22,22 +22,28 @@ class Cassie(BipedRobot): This class describes the cassie robot developed by Agility Robotics. References: - [1] http://www.agilityrobotics.com/sims/ - [2] "Feedback Control For Cassie With Deep Reinforcement Learning", Xie et al., 2018 - https://arxiv.org/abs/1803.05580 - [3] https://github.com/agilityrobotics/cassie-gazebo-sim - [4] https://github.com/UMich-BipedLab/Cassie_Model - [5] https://github.com/UMich-BipedLab/cassie_description - [6] https://github.com/erwincoumans/pybullet_robots/tree/master/data/cassie + - [1] http://www.agilityrobotics.com/sims/ + - [2] "Feedback Control For Cassie With Deep Reinforcement Learning", Xie et al., 2018 + https://arxiv.org/abs/1803.05580 + - [3] https://github.com/agilityrobotics/cassie-gazebo-sim + - [4] https://github.com/UMich-BipedLab/Cassie_Model + - [5] https://github.com/UMich-BipedLab/cassie_description + - [6] https://github.com/erwincoumans/pybullet_robots/tree/master/data/cassie """ - def __init__(self, - simulator, - position=(0, 0, .8), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .8), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/cassie/cassie.urdf'): + """ + Initialize the Cassie robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.8) diff --git a/pyrobolearn/robots/centauro.py b/pyrobolearn/robots/centauro.py index 7fca7f6..3d268bf 100644 --- a/pyrobolearn/robots/centauro.py +++ b/pyrobolearn/robots/centauro.py @@ -22,19 +22,25 @@ class Centauro(WheeledRobot, QuadrupedRobot, BiManipulator): r"""Centauro robot References: - [1] https://github.com/ADVRHumanoids/centauro-simulator + - [1] https://github.com/ADVRHumanoids/centauro-simulator """ - def __init__(self, - simulator, - position=(0, 0, 1.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/centauro/centauro_stick.urdf' # centauro_stick.urdf, centauro_soft_hand.urdf, centauro_heri.urdf, # centauro_schunk_handL.urdf, centauro_schunk_hand.urdf ): + """ + Initialize the Centauro robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.) diff --git a/pyrobolearn/robots/cogimon.py b/pyrobolearn/robots/cogimon.py index b67e8f1..e67592a 100644 --- a/pyrobolearn/robots/cogimon.py +++ b/pyrobolearn/robots/cogimon.py @@ -20,18 +20,24 @@ class Cogimon(BipedRobot, BiManipulator): r"""Cogimon humanoid robot. References: - [1] https://github.com/ADVRHumanoids/iit-cogimon-ros-pkg + - [1] https://github.com/ADVRHumanoids/iit-cogimon-ros-pkg """ - def __init__(self, - simulator, - position=(0, 0, 1.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., - urdf=os.path.dirname(__file__) + '/urdfs/cogimon/cogimon.urdf', - lower_body=False): # cogimon_lower_body.urdf + def __init__(self, simulator, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + lower_body=False, urdf=os.path.dirname(__file__) + '/urdfs/cogimon/cogimon.urdf'): + # cogimon_lower_body.urdf + """ + Initialize the Cogimon robot. + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + lower_body (bool): if we should only use the lower body of the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.) diff --git a/pyrobolearn/robots/coman.py b/pyrobolearn/robots/coman.py index 9506f06..68045c5 100644 --- a/pyrobolearn/robots/coman.py +++ b/pyrobolearn/robots/coman.py @@ -21,16 +21,22 @@ class Coman(BipedRobot, BiManipulator): r"""Coman robot References: - [1] https://github.com/ADVRHumanoids/iit-coman-ros-pkg + - [1] https://github.com/ADVRHumanoids/iit-coman-ros-pkg """ - def __init__(self, - simulator, - position=(0, 0, 0.5), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.5), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/coman/coman.urdf'): + """ + Initialize the Coman robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.5) diff --git a/pyrobolearn/robots/crab.py b/pyrobolearn/robots/crab.py index ed2c038..5c23d15 100644 --- a/pyrobolearn/robots/crab.py +++ b/pyrobolearn/robots/crab.py @@ -19,17 +19,23 @@ class Crab(HexapodRobot): r"""Crab Hexapod robot References: - [1] http://wiki.ros.org/Robots/HexapodRobot - [2] https://github.com/tuuzdu/crab_project + - [1] http://wiki.ros.org/Robots/HexapodRobot + - [2] https://github.com/tuuzdu/crab_project """ - def __init__(self, - simulator, - position=(0, 0, 0.12), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.12), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/crab/crab.urdf'): + """ + Initialize the Crab robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.12) diff --git a/pyrobolearn/robots/cubli.py b/pyrobolearn/robots/cubli.py index a31d158..a55fe9f 100644 --- a/pyrobolearn/robots/cubli.py +++ b/pyrobolearn/robots/cubli.py @@ -7,6 +7,7 @@ import os from pyrobolearn.robots.robot import Robot from pyrobolearn.utils.transformation import get_rpy_from_quaternion + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" __license__ = "GNU GPLv3" @@ -20,24 +21,31 @@ class Cubli(Robot): r"""Cubli robot References: - [1] "The Cubli: a Cube that can Jump Up and Balance", Gajamohan et al., 2012 - [2] "The Cubli: a Reaction Wheel Based 3D Inverted Pendulum", Gajamohan et al., 2013 - [3] "Nonlinear Analysis and Control of a Reaction Wheel-based 3D Inverted Pendulum", Muehlebach et al., 2017 - [4] "Balancing Control of a Cubical Robot Balancing on its Corner", Chen et al., 2018 + - [1] "The Cubli: a Cube that can Jump Up and Balance", Gajamohan et al., 2012 + - [2] "The Cubli: a Reaction Wheel Based 3D Inverted Pendulum", Gajamohan et al., 2013 + - [3] "Nonlinear Analysis and Control of a Reaction Wheel-based 3D Inverted Pendulum", Muehlebach et al., 2017 + - [4] "Balancing Control of a Cubical Robot Balancing on its Corner", Chen et al., 2018 + - [5] Cubli Robot: https://github.com/xinsongyan/cubli Also, check about M-Blocks: - [1] "M-Blocks: Momentum-driven, Magnetic Modular Robots", Romanishin et al., 2013 - [2] "3D M-Blocks: Self-reconfiguring Robots Capable of Locomtion via Pivoting in 3 Dimensions", Romanishin - et al., 2015 + - [1] "M-Blocks: Momentum-driven, Magnetic Modular Robots", Romanishin et al., 2013 + - [2] "3D M-Blocks: Self-reconfiguring Robots Capable of Locomotion via Pivoting in 3 Dimensions", Romanishin + et al., 2015 """ - def __init__(self, - simulator, - position=(0, 0, 0.5), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.5), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/cubli/cubli.urdf'): + """ + Initialize the Cubli robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.5) diff --git a/pyrobolearn/robots/darwin.py b/pyrobolearn/robots/darwin.py index 6412197..86e42d6 100644 --- a/pyrobolearn/robots/darwin.py +++ b/pyrobolearn/robots/darwin.py @@ -21,16 +21,22 @@ class Darwin(BipedRobot, BiManipulator): r"""Darwin robot References: - [1] https://github.com/HumaRobotics/darwin_description + - [1] https://github.com/HumaRobotics/darwin_description """ - def __init__(self, - simulator, - position=(0, 0, 0.34), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.34), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/darwin/darwin.urdf'): + """ + Initialize the Darwin robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.34) diff --git a/pyrobolearn/robots/ecaa9.py b/pyrobolearn/robots/ecaa9.py index 8cb8d5f..9997360 100755 --- a/pyrobolearn/robots/ecaa9.py +++ b/pyrobolearn/robots/ecaa9.py @@ -64,16 +64,27 @@ class ECAA9(UUVRobot): For a submarine, the coefficient is approximately around 0.04 (see [3]). References: - [1] https://www.ecagroup.com/en/solutions/a9-s-auv-autonomous-underwater-vehicle - [2] UUV Simulator: https://uuvsimulator.github.io/ - [3] Aerodynamics (Nasa - check for equation): https://www.grc.nasa.gov/www/k-12/airplane/short.html - [4] https://s2.smu.edu/propulsion/Pages/navigation.htm - [5] Introduction to Ocean Waves: http://pordlabs.ucsd.edu/rsalmon/111.textbook.pdf - [6] https://fenicsproject.org/ + - [1] https://www.ecagroup.com/en/solutions/a9-s-auv-autonomous-underwater-vehicle + - [2] UUV Simulator: https://uuvsimulator.github.io/ + - [3] Aerodynamics (Nasa - check for equation): https://www.grc.nasa.gov/www/k-12/airplane/short.html + - [4] https://s2.smu.edu/propulsion/Pages/navigation.htm + - [5] Introduction to Ocean Waves: http://pordlabs.ucsd.edu/rsalmon/111.textbook.pdf + - [6] https://fenicsproject.org/ """ - def __init__(self, simulator, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scaling=1., - urdf_path=os.path.dirname(__file__) + '/urdfs/ecaa9/eca_a9.urdf'): + def __init__(self, simulator, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/ecaa9/eca_a9.urdf'): + """ + Initialize the ECAA9 vehicle. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the vehicle base will be fixed in the world. + scale (float): scaling factor that is used to scale the vehicle. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.) @@ -84,10 +95,10 @@ class ECAA9(UUVRobot): if fixed_base is None: fixed_base = False - super(ECAA9, self).__init__(simulator, urdf_path, position, orientation, fixed_base, scaling) + super(ECAA9, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.name = 'eca_a9' - self.volume = 0.0679998770412 * scaling**3 # from urdf + self.volume = 0.0679998770412 * scale ** 3 # from urdf self.sea_water_density = 1027 self.center_buoyancy = np.array([0.000106, 0., 0.6]) # from urdf diff --git a/pyrobolearn/robots/edo.py b/pyrobolearn/robots/edo.py index 42f7d07..490022b 100644 --- a/pyrobolearn/robots/edo.py +++ b/pyrobolearn/robots/edo.py @@ -21,18 +21,24 @@ class Edo(Manipulator): E.Do robot developed by Comau. References: - [1] e.Do: https://edo.cloud/ - [2] Comau: https://www.comau.com/EN/our-competences/robotics/eDO - [3] Github: https://github.com/Comau/eDO_description + - [1] e.Do: https://edo.cloud/ + - [2] Comau: https://www.comau.com/EN/our-competences/robotics/eDO + - [3] Github: https://github.com/Comau/eDO_description """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/edo/edo.urdf'): + """ + Initialize the E.Do robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/epuck.py b/pyrobolearn/robots/epuck.py index 0f7d5a3..506dd66 100644 --- a/pyrobolearn/robots/epuck.py +++ b/pyrobolearn/robots/epuck.py @@ -20,18 +20,24 @@ class Epuck(DifferentialWheeledRobot): r"""Epuck robot References: - [1] http://www.e-puck.org/ - [2] http://www.gctronic.com/doc/index.php/E-Puck - [3] https://github.com/gctronic/epuck_driver_cpp + - [1] http://www.e-puck.org/ + - [2] http://www.gctronic.com/doc/index.php/E-Puck + - [3] https://github.com/gctronic/epuck_driver_cpp """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/epuck/epuck.urdf'): + """ + Initialize the E-puck robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0) diff --git a/pyrobolearn/robots/f10_racecar.py b/pyrobolearn/robots/f10_racecar.py index 1b65370..50b3956 100644 --- a/pyrobolearn/robots/f10_racecar.py +++ b/pyrobolearn/robots/f10_racecar.py @@ -20,16 +20,22 @@ class F10Racecar(AckermannWheeledRobot): r"""F10Racecar robot References: - [1] https://github.com/erwincoumans/pybullet_robots/tree/master/data/f10_racecar + - [1] https://github.com/erwincoumans/pybullet_robots/tree/master/data/f10_racecar """ - def __init__(self, - simulator, - position=(0, 0, .1), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .1), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/f10_racecar/racecar.urdf'): # racecar_differential.urdf + """ + Initialize the F10 racecar. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the car base will be fixed in the world. + scale (float): scaling factor that is used to scale the car. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.1) diff --git a/pyrobolearn/robots/fetch.py b/pyrobolearn/robots/fetch.py index a75a4cb..2d7c7cd 100644 --- a/pyrobolearn/robots/fetch.py +++ b/pyrobolearn/robots/fetch.py @@ -6,6 +6,8 @@ import os from pyrobolearn.robots.wheeled_robot import WheeledRobot from pyrobolearn.robots.manipulator import Manipulator +from pyrobolearn.robots.gripper import ParallelGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -20,17 +22,23 @@ class Fetch(WheeledRobot, Manipulator): r"""Fetch robot References: - [1] Fetch robotics: https://fetchrobotics.com/ - [2] Fetch description: https://github.com/fetchrobotics/fetch_ros + - [1] Fetch robotics: https://fetchrobotics.com/ + - [2] Fetch description: https://github.com/fetchrobotics/fetch_ros """ - def __init__(self, - simulator, - position=(0, 0, 0.1), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.1), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/fetch/fetch.urdf'): + """ + Initialize the Fetch manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.1) @@ -45,6 +53,41 @@ class Fetch(WheeledRobot, Manipulator): self.name = 'fetch' +class FetchGripper(ParallelGripper): + r"""Fetch Gripper + + References: + - [1] Fetch robotics: https://fetchrobotics.com/ + - [2] Fetch description: https://github.com/fetchrobotics/fetch_ros + """ + + def __init__(self, simulator, position=(0, 0, 0.16), orientation=(0, -0.707, 0, 0.707), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/fetch/fetch_gripper.urdf'): + """ + Initialize the Fetch gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.16) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.16,) + if orientation is None: + orientation = (0, -0.707, 0, 0.707) + if fixed_base is None: + fixed_base = True + + super(FetchGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'fetch_gripper' + + # Test if __name__ == "__main__": from itertools import count diff --git a/pyrobolearn/robots/flappy.py b/pyrobolearn/robots/flappy.py index 811db05..73f5cae 100644 --- a/pyrobolearn/robots/flappy.py +++ b/pyrobolearn/robots/flappy.py @@ -2,6 +2,8 @@ """Provide the techpod platform. """ +# TODO: finish to implement this class + import os import json import numpy as np @@ -42,8 +44,8 @@ class Wing(object): Python code translated from C++ code provided in [1]. References: - [1] https://github.com/purdue-biorobotics/flappy/blob/master/flappy/envs/Wing.cpp - [2] "Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals", Fei et al., + - [1] https://github.com/purdue-biorobotics/flappy/blob/master/flappy/envs/Wing.cpp + - [2] "Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals", Fei et al., 2019 """ @@ -306,16 +308,27 @@ class Flappy(FlappingWingUAV): described in the paper and code [2,3]. The gravity is carried out by pybullet. References: - [1] "Design Optimization and System Integration of Robotic Hummingbird", Zhang et al., 2017 - [2] "Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals", Fei et al., + - [1] "Design Optimization and System Integration of Robotic Hummingbird", Zhang et al., 2017 + - [2] "Flappy Hummingbird: An Open Source Dynamic Simulation of Flapping Wing Robots and Animals", Fei et al., 2019 - [3] https://github.com/purdue-biorobotics/flappy + - [3] https://github.com/purdue-biorobotics/flappy """ - def __init__(self, simulator, position=(0, 0, 0.5), orientation=(0, 0, 0, 1), fixed_base=False, scaling=1., + def __init__(self, simulator, position=(0, 0, 0.5), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/flappy/flappy.urdf', config=os.path.dirname(__file__) + '/urdfs/flappy/config/mav_config.json'): - super(Flappy, self).__init__(simulator, urdf, position, orientation, fixed_base) + """ + Initialize the Flappy robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + super(Flappy, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) with open(config) as f: config = json.load(f)[0] diff --git a/pyrobolearn/robots/franka.py b/pyrobolearn/robots/franka.py index ce9f1f5..9f9979d 100644 --- a/pyrobolearn/robots/franka.py +++ b/pyrobolearn/robots/franka.py @@ -5,6 +5,8 @@ import os from pyrobolearn.robots.manipulator import Manipulator +from pyrobolearn.robots.gripper import ParallelGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -16,24 +18,31 @@ __status__ = "Development" class Franka(Manipulator): - r"""Franka Emika robot + r"""Franka Emika Panda robot - WARNING: CURRENTLY, THE INERTIAL TAGS ARE NOT SET IN THE URDF!! + Warnings: CURRENTLY, THE INERTIAL TAGS ARE NOT CORRECT IN THE URDF!! I INVENTED THEM MYSELF BASED ON THE VOLUME, + UNIFORM DENSITY, AND SUPPOSED MASS. References: - [1] Documentation: https://frankaemika.github.io/docs/index.html - [2] Overview: https://frankaemika.github.io/docs/overview.html - [3] C++ library: https://github.com/frankaemika/libfranka - [2] ROS integration: https://github.com/frankaemika/franka_ros + - [1] Documentation: https://frankaemika.github.io/docs/index.html + - [2] Overview: https://frankaemika.github.io/docs/overview.html + - [3] C++ library: https://github.com/frankaemika/libfranka + - [4] ROS integration: https://github.com/frankaemika/franka_ros """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - scale=1., - fixed_base=True, + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), scale=1., fixed_base=True, urdf=os.path.dirname(__file__) + '/urdfs/franka/franka.urdf'): + """ + Initialize the Franka Emika Panda manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) @@ -50,6 +59,46 @@ class Franka(Manipulator): # self.disable_motor() +class FrankaGripper(ParallelGripper): + r"""Franka Emika Panda gripper + + Warnings: CURRENTLY, THE INERTIAL TAGS ARE NOT CORRECT IN THE URDF!! I INVENTED THEM MYSELF BASED ON THE VOLUME, + UNIFORM DENSITY, AND SUPPOSED MASS. + + References: + - [1] Documentation: https://frankaemika.github.io/docs/index.html + - [2] Overview: https://frankaemika.github.io/docs/overview.html + - [3] C++ library: https://github.com/frankaemika/libfranka + - [4] ROS integration: https://github.com/frankaemika/franka_ros + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0., 0, 1.), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/franka/franka_gripper.urdf'): + """ + Initialize the Franka Emika Panda gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0, 0, 1.) + if fixed_base is None: + fixed_base = True + + super(FrankaGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'franka_gripper' + + # Test if __name__ == "__main__": from itertools import count diff --git a/pyrobolearn/robots/gripper.py b/pyrobolearn/robots/gripper.py index e69de29..dc38f50 100644 --- a/pyrobolearn/robots/gripper.py +++ b/pyrobolearn/robots/gripper.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +"""Provide the Gripper abstract classes. +""" + +from pyrobolearn.robots.robot import Robot + +__author__ = "Brian Delhaisse" +__copyright__ = "Copyright 2019, PyRoboLearn" +__credits__ = ["Brian Delhaisse"] +__license__ = "GNU GPLv3" +__version__ = "1.0.0" +__maintainer__ = "Brian Delhaisse" +__email__ = "briandelhaisse@gmail.com" +__status__ = "Development" + + +class Gripper(Robot): + r"""Gripper end-effector + """ + + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the gripper. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the URDF file. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + """ + super(Gripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + + self.fingers = [] # list of fingers where each finger is a list of links/joints + + @property + def num_fingers(self): + """Return the number of fingers on the hand""" + return len(self.fingers) + + def get_finger(self, finger_id=None): + """Return the list of joint/link ids for the specified finger""" + if finger_id: + return self.fingers[finger_id] + return self.fingers + + +class ParallelGripper(Gripper): + r"""Parallel Gripper + + When the fingers are closing toward each other, they remain parallel. Most of the time, these types of grippers + have 2 fingers. This type is also known as the slider type. + """ + + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the gripper. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the URDF file. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + """ + super(ParallelGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + + +class AngularGripper(Gripper): + r"""Angular Gripper + + When the fingers are closing toward each other, each finger rotates around an axis. They can have 2, 3, or even + 4 grippers. This type is also known as the lever type. + """ + + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the gripper. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the URDF file. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + """ + super(AngularGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + + +class VacuumGripper(Gripper): + r"""Vacuum Gripper + + A vacuum gripper doesn't have any fingers but use suction in order to grasp different objects. Note that this + required the simulator to be able to simulate soft bodies and the interaction of these ones with rigid bodies. + """ + + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the gripper. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the URDF file. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + """ + super(VacuumGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) diff --git a/pyrobolearn/robots/half_cheetah.py b/pyrobolearn/robots/half_cheetah.py index c7e591e..90259b3 100644 --- a/pyrobolearn/robots/half_cheetah.py +++ b/pyrobolearn/robots/half_cheetah.py @@ -19,15 +19,10 @@ class HalfCheetah(Robot): r"""Half Cheetah Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(-0.5, 0, 0.1), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 0.1), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/half_cheetah.xml'): # check parameters if position is None: diff --git a/pyrobolearn/robots/hand.py b/pyrobolearn/robots/hand.py index e6de8f1..6babfcb 100644 --- a/pyrobolearn/robots/hand.py +++ b/pyrobolearn/robots/hand.py @@ -18,13 +18,18 @@ class Hand(Robot): r"""Hand end-effector """ - def __init__(self, - simulator, - urdf, - position=(0, 0, 1.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1.): + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the hand robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(Hand, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.fingers = [] # list of fingers where each finger is a list of links/joints @@ -46,13 +51,18 @@ class TwoHand(Hand): """ - def __init__(self, - simulator, - urdf, - position=(0, 0, 1.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1.): + def __init__(self, simulator, urdf, position=(0, 0, 1.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the two hands robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(TwoHand, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.left_fingers = [] # list of ids in self.fingers diff --git a/pyrobolearn/robots/hopper.py b/pyrobolearn/robots/hopper.py index ca98d68..14164ab 100644 --- a/pyrobolearn/robots/hopper.py +++ b/pyrobolearn/robots/hopper.py @@ -19,15 +19,10 @@ class Hopper(Robot): r"""Hopper Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(-0.5, 0, 0.1), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 0.1), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/hopper.xml'): # check parameters if position is None: diff --git a/pyrobolearn/robots/hubo.py b/pyrobolearn/robots/hubo.py index 3c54a53..8a458a8 100644 --- a/pyrobolearn/robots/hubo.py +++ b/pyrobolearn/robots/hubo.py @@ -27,19 +27,25 @@ class Hubo(BipedRobot, BiManipulator, TwoHand): and 1 for the waist. References: - [1] ROS wiki: http://wiki.ros.org/Robots/HUBO - [2] Hubo Lab: hubolab.kaist.ac.kr - [3] Rainbow Robotics: http://www.rainbow-robotics.com/new/ - [4] URDF: https://github.com/robEllenberg/hubo-urdf + - [1] ROS wiki: http://wiki.ros.org/Robots/HUBO + - [2] Hubo Lab: hubolab.kaist.ac.kr + - [3] Rainbow Robotics: http://www.rainbow-robotics.com/new/ + - [4] URDF: https://github.com/robEllenberg/hubo-urdf """ - def __init__(self, - simulator, - position=(0, 0, 1), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 1), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/hubo/hubo.urdf'): + """ + Initialize the Hubo robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.) diff --git a/pyrobolearn/robots/humanoid.py b/pyrobolearn/robots/humanoid.py index 2181b91..48aef8b 100644 --- a/pyrobolearn/robots/humanoid.py +++ b/pyrobolearn/robots/humanoid.py @@ -20,15 +20,10 @@ class Humanoid(BipedRobot, BiManipulator): r"""Humanoid Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(-0.5, 0, 1.), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 1.), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/humanoid.xml'): # humanoid_symmetric.xml # check parameters if position is None: diff --git a/pyrobolearn/robots/husky.py b/pyrobolearn/robots/husky.py index 3ec9a10..e96bca6 100644 --- a/pyrobolearn/robots/husky.py +++ b/pyrobolearn/robots/husky.py @@ -22,18 +22,24 @@ class Husky(DifferentialWheeledRobot): Husky robot from Clearpath Robotics [1]. References: - [1] Clearpath Robotics: https://www.clearpathrobotics.com/husky-unmanned-ground-vehicle-robot/ - [2] ROS wiki: http://wiki.ros.org/Robots/Husky - [3] Github: https://github.com/husky/husky + - [1] Clearpath Robotics: https://www.clearpathrobotics.com/husky-unmanned-ground-vehicle-robot/ + - [2] ROS wiki: http://wiki.ros.org/Robots/Husky + - [3] Github: https://github.com/husky/husky """ - def __init__(self, - simulator, - position=(0, 0, .14), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .14), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/husky/husky.urdf'): + """ + Initialize the Husky robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.14) diff --git a/pyrobolearn/robots/hyq.py b/pyrobolearn/robots/hyq.py index 4642da0..1a7e6e7 100644 --- a/pyrobolearn/robots/hyq.py +++ b/pyrobolearn/robots/hyq.py @@ -21,17 +21,23 @@ class HyQ(QuadrupedRobot): HyQ robot created by IIT. References: - [1] https://dls.iit.it/robots/hyq-robot - [2] https://github.com/iit-DLSLab/hyq-description + - [1] https://dls.iit.it/robots/hyq-robot + - [2] https://github.com/iit-DLSLab/hyq-description """ - def __init__(self, - simulator, - position=(0, 0, .9), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .9), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/hyq/hyq.urdf'): + """ + Initialize the HyQ robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.9) diff --git a/pyrobolearn/robots/hyq2max.py b/pyrobolearn/robots/hyq2max.py index 3604b7f..eef7c02 100644 --- a/pyrobolearn/robots/hyq2max.py +++ b/pyrobolearn/robots/hyq2max.py @@ -22,20 +22,26 @@ class HyQ2Max(QuadrupedRobot): HyQ2Max robot created by IIT. References: - [1] "Design of the Hydraulically-Actuated,Torque-Controlled Quadruped Robot HyQ2Max", Semini et al., 2016 - [2] https://dls.iit.it/robots/hyq2max - [3] https://github.com/iit-DLSLab/hyq2max-description + - [1] "Design of the Hydraulically-Actuated,Torque-Controlled Quadruped Robot HyQ2Max", Semini et al., 2016 + - [2] https://dls.iit.it/robots/hyq2max + - [3] https://github.com/iit-DLSLab/hyq2max-description """ default_height = 0.8 - def __init__(self, - simulator, - position=(0, 0, 0.8), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.8), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/hyq2max/hyq2max.urdf'): + """ + Initialize the HyQ2Max robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.8) diff --git a/pyrobolearn/robots/icub.py b/pyrobolearn/robots/icub.py index 2247d8c..0321a70 100644 --- a/pyrobolearn/robots/icub.py +++ b/pyrobolearn/robots/icub.py @@ -2,6 +2,8 @@ """Provide the ICub robotic platform. """ +# TODO: fix bug + import os from pyrobolearn.robots.legged_robot import BipedRobot @@ -20,18 +22,24 @@ class ICub(BipedRobot, BiManipulator): r"""ICub robot References: - [1] http://www.icub.org/ - [2] https://github.com/robotology-playground/icub-models - [3] https://github.com/robotology-playground/icub-model-generator + - [1] http://www.icub.org/ + - [2] https://github.com/robotology-playground/icub-models + - [3] https://github.com/robotology-playground/icub-model-generator """ - def __init__(self, - simulator, - position=(0, 0, 0.7), - orientation=(0, 0, 1, 0), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.7), orientation=(0, 0, 1, 0), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/icub/icub-v2.5+.urdf'): + """ + Initialize the ICub robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.7) diff --git a/pyrobolearn/robots/jaco.py b/pyrobolearn/robots/jaco.py index 92a585f..d927633 100644 --- a/pyrobolearn/robots/jaco.py +++ b/pyrobolearn/robots/jaco.py @@ -5,6 +5,8 @@ import os from pyrobolearn.robots.manipulator import Manipulator +from pyrobolearn.robots.gripper import AngularGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -19,18 +21,24 @@ class Jaco(Manipulator): r"""Jaco (manipulator) robot References: - [1] https://github.com/JenniferBuehler/jaco-arm-pkgs - [2] https://github.com/Kinovarobotics/kinova-ros - [3] https://github.com/RIVeR-Lab/wpi_jaco + - [1] https://github.com/JenniferBuehler/jaco-arm-pkgs + - [2] https://github.com/Kinovarobotics/kinova-ros + - [3] https://github.com/RIVeR-Lab/wpi_jaco """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/jaco/jaco.urdf'): + """ + Initialize the Jaco manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) @@ -45,6 +53,42 @@ class Jaco(Manipulator): self.name = 'jaco' +class JacoGripper(AngularGripper): + r"""Jaco Gripper + + References: + - [1] https://github.com/JenniferBuehler/jaco-arm-pkgs + - [2] https://github.com/Kinovarobotics/kinova-ros + - [3] https://github.com/RIVeR-Lab/wpi_jaco + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/jaco/jaco_gripper.urdf'): + """ + Initialize the Jaco gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0.707, 0, 0.707) + if fixed_base is None: + fixed_base = True + + super(JacoGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'jaco_gripper' + + # Test if __name__ == "__main__": from itertools import count diff --git a/pyrobolearn/robots/kilobot.py b/pyrobolearn/robots/kilobot.py index 98fbbf5..0c423d5 100644 --- a/pyrobolearn/robots/kilobot.py +++ b/pyrobolearn/robots/kilobot.py @@ -31,22 +31,28 @@ class Kilobot(Robot): - linear resonant actuator (LRA) [5.2] References: - [1] "Kilobot: a Low Cost Scalable Robot System for Collective Behaviors", Rubenstein et al., 2012 - [2] "Programmable self-assembly in a thousand-robot swarm", Rubenstein et al., 2014 - [3] Harvard's Self-Organizing Systems Research Group: https://ssr.seas.harvard.edu/kilobots - [4] K-Team Corporation: https://www.k-team.com/mobile-robotics-products/kilobot - [5] Precision Micro drives: https://www.precisionmicrodrives.com/ + - [1] "Kilobot: a Low Cost Scalable Robot System for Collective Behaviors", Rubenstein et al., 2012 + - [2] "Programmable self-assembly in a thousand-robot swarm", Rubenstein et al., 2014 + - [3] Harvard's Self-Organizing Systems Research Group: https://ssr.seas.harvard.edu/kilobots + - [4] K-Team Corporation: https://www.k-team.com/mobile-robotics-products/kilobot + - [5] Precision Micro drives: https://www.precisionmicrodrives.com/ - ERM: https://www.precisionmicrodrives.com/vibration-motors/ - LRA: https://www.precisionmicrodrives.com/vibration-motors/linear-resonant-actuators-lras/ """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/kilobot/kilobot.urdf'): # TODO: finish URDF + """ + Initialize the Kilobot robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0) diff --git a/pyrobolearn/robots/kr5.py b/pyrobolearn/robots/kr5.py index bb43a79..1cdce43 100644 --- a/pyrobolearn/robots/kr5.py +++ b/pyrobolearn/robots/kr5.py @@ -21,18 +21,24 @@ class KR5(Manipulator): Payload of 5.00kg and a reach of 650mm or 850mm. References: - [1] Kuka robotics: https://www.kuka.com/en-de - [2] https://github.com/a-price/KR5sixxR650WP_description - [3] https://github.com/ros-industrial/kuka_experimental + - [1] Kuka robotics: https://www.kuka.com/en-de + - [2] https://github.com/a-price/KR5sixxR650WP_description + - [3] https://github.com/ros-industrial/kuka_experimental """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/kuka/kr5/kr5.urdf'): + """ + Initialize the KR5 manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/kuka_iiwa.py b/pyrobolearn/robots/kuka_iiwa.py index be37595..a08a66e 100644 --- a/pyrobolearn/robots/kuka_iiwa.py +++ b/pyrobolearn/robots/kuka_iiwa.py @@ -22,18 +22,24 @@ class KukaIIWA(Manipulator): end-effector. Payload of 14kg and a range of 820mm. References: - [1] Kuka robotics: https://www.kuka.com/en-de - [2] https://github.com/IFL-CAMP/iiwa_stack - [3] https://github.com/bulletphysics/bullet3/tree/master/data/kuka_iiwa + - [1] Kuka robotics: https://www.kuka.com/en-de + - [2] https://github.com/IFL-CAMP/iiwa_stack + - [3] https://github.com/bulletphysics/bullet3/tree/master/data/kuka_iiwa """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - scale=1., - fixed_base=True, + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), scale=1., fixed_base=True, urdf=os.path.dirname(__file__) + '/urdfs/kuka/kuka_iiwa/iiwa14.urdf'): + """ + Initialize the Kuka IIWA manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/kuka_lwr.py b/pyrobolearn/robots/kuka_lwr.py index fc6310c..e65ff05 100644 --- a/pyrobolearn/robots/kuka_lwr.py +++ b/pyrobolearn/robots/kuka_lwr.py @@ -22,18 +22,24 @@ class KukaLWR(Manipulator): Payload of 7kg and a range of 790mm. References: - [1] Kuka robotics: https://www.kuka.com/en-de - [2] https://github.com/CentroEPiaggio/kuka-lwr - [3] https://github.com/bulletphysics/bullet3/tree/master/data/kuka_lwr + - [1] Kuka robotics: https://www.kuka.com/en-de + - [2] https://github.com/CentroEPiaggio/kuka-lwr + - [3] https://github.com/bulletphysics/bullet3/tree/master/data/kuka_lwr """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/kuka/kuka_lwr/kuka.urdf'): + """ + Initialize the Kuka LWR robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/laikago.py b/pyrobolearn/robots/laikago.py index 32aebe7..212c2e9 100644 --- a/pyrobolearn/robots/laikago.py +++ b/pyrobolearn/robots/laikago.py @@ -20,17 +20,23 @@ class Laikago(QuadrupedRobot): r"""Laikago robot References: - [1] Laikago: http://www.unitree.cc/e/action/ShowInfo.php?classid=6&id=1 - [2] https://github.com/erwincoumans/pybullet_robots/tree/master/data/laikago + - [1] Laikago: http://www.unitree.cc/e/action/ShowInfo.php?classid=6&id=1 + - [2] https://github.com/erwincoumans/pybullet_robots/tree/master/data/laikago """ - def __init__(self, - simulator, - position=(0, 0, .5), - orientation=(0.5, 0.5, 0.5, 0.5), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .5), orientation=(0.5, 0.5, 0.5, 0.5), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/laikago/laikago.urdf'): + """ + Initialize the Laikago robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.5) diff --git a/pyrobolearn/robots/legged_robot.py b/pyrobolearn/robots/legged_robot.py index 6282ea1..ff88b75 100644 --- a/pyrobolearn/robots/legged_robot.py +++ b/pyrobolearn/robots/legged_robot.py @@ -30,6 +30,18 @@ class LeggedRobot(Robot): def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1., foot_frictions=None): + """ + Initialize the Legged robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + foot_frictions (float, list of float): foot friction value(s). + """ super(LeggedRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale=scale) # leg and feet ids @@ -174,7 +186,7 @@ class LeggedRobot(Robot): References: - [1] "Postural Stability of Biped Robots and Foot-Rotation Index (FRI) Point", Goswami, 1999 - [2] "Ground Reference Points in Legged Locomotion: Definitions, Biological Trajectories and Control - Implications", Popovic et al., 2005 + Implications", Popovic et al., 2005 """ if floor_id is not None: # get contact points between the robot's links and the floor @@ -255,7 +267,7 @@ class LeggedRobot(Robot): References: - [1] "Ground Reference Points in Legged Locomotion: Definitions, Biological Trajectories and Control - Implications", Popovic et al., 2005 + Implications", Popovic et al., 2005 - [2] "Biped Walking Pattern Generation by using Preview Control of ZMP", Kajita et al., 2003 - [3] "Exploiting Angular Momentum to Enhance Bipedal Center-of-Mass Control", Hofmann et al., 2009 """ @@ -329,7 +341,7 @@ class LeggedRobot(Robot): References: - [1] "Postural Stability of Biped Robots and the Foot-Rotation Indicator (FRI) Point", Goswami, 1999 - [2] "Ground Reference Points in Legged Locomotion: Definitions, Biological Trajectories and Control - Implications", Popovic et al., 2005 + Implications", Popovic et al., 2005 """ raise NotImplementedError @@ -363,7 +375,7 @@ class LeggedRobot(Robot): References: - [1] "Ground Reference Points in Legged Locomotion: Definitions, Biological Trajectories and Control - Implications", Popovic et al., 2005 + Implications", Popovic et al., 2005 """ # update the CoM if update_com: @@ -730,6 +742,17 @@ class BipedRobot(LeggedRobot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the Biped robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(BipedRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.left_leg_id = 0 @@ -767,6 +790,17 @@ class QuadrupedRobot(LeggedRobot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the Quadruped robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(QuadrupedRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.left_front_leg_id = 0 @@ -826,6 +860,17 @@ class HexapodRobot(LeggedRobot): """ def __init__(self, simulator, urdf, position, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the hexapod robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(HexapodRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.left_front_leg_id = 0 diff --git a/pyrobolearn/robots/littledog.py b/pyrobolearn/robots/littledog.py index b09b682..3533eb0 100644 --- a/pyrobolearn/robots/littledog.py +++ b/pyrobolearn/robots/littledog.py @@ -20,18 +20,24 @@ class LittleDog(QuadrupedRobot): r"""Little Dog References: - [1] "The LittleDog Robot", Murphy et al., 2010 + - [1] "The LittleDog Robot", Murphy et al., 2010 https://journals.sagepub.com/doi/abs/10.1177/0278364910387457?journalCode=ijra - [2] https://github.com/RobotLocomotion/LittleDog + - [2] https://github.com/RobotLocomotion/LittleDog """ - def __init__(self, - simulator, - position=(0, 0, 0.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/littledog/littleDog.urdf'): + """ + Initialize the LittleDog robots. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.2) diff --git a/pyrobolearn/robots/manipulator.py b/pyrobolearn/robots/manipulator.py index 0154504..8db2814 100644 --- a/pyrobolearn/robots/manipulator.py +++ b/pyrobolearn/robots/manipulator.py @@ -20,13 +20,18 @@ class Manipulator(Robot): Manipulator robots are robots that use some of its end-effectors to manipulate objects in its environment. """ - def __init__(self, - simulator, - urdf, - position=(0, 0, 0.), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1.): + def __init__(self, simulator, urdf, position=(0, 0, 0.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the manipulator. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(Manipulator, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.arms = [] # list of arms where an arm is a list of links @@ -123,8 +128,18 @@ class BiManipulator(Manipulator): Bi-manipulators are robots that have two manipulators to manipulate objects in the environment. """ - def __init__(self, simulator, urdf, position=(0, 0, 1.5), orientation=(0, 0, 0, 1), fixed_base=False, - scale=1.): + def __init__(self, simulator, urdf, position=(0, 0, 1.5), orientation=(0, 0, 0, 1), fixed_base=False, scale=1.): + """ + Initialize the bi-manipulator. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(BiManipulator, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.left_arm_id = 0 diff --git a/pyrobolearn/robots/manipulator2d.py b/pyrobolearn/robots/manipulator2d.py index 68d962a..7443cc3 100644 --- a/pyrobolearn/robots/manipulator2d.py +++ b/pyrobolearn/robots/manipulator2d.py @@ -20,16 +20,22 @@ class Manipulator2D(Manipulator): r"""2D manipulator robot References: - [1] https://github.com/domingoesteban/robolearn_robots_ros + - [1] https://github.com/domingoesteban/robolearn_robots_ros """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/manipulator2d/manipulator2d.urdf'): + """ + Initialize the 2D manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/minitaur.py b/pyrobolearn/robots/minitaur.py index cdebc1e..eed2f7b 100644 --- a/pyrobolearn/robots/minitaur.py +++ b/pyrobolearn/robots/minitaur.py @@ -23,20 +23,26 @@ class Minitaur(QuadrupedRobot): Minitaur robot from Ghost Robotics (https://www.ghostrobotics.io/) References: - [1] "Design Principles for a Family of Direct-Drive Legged Robots", Kenneally et al., 2016 - [2] pybullet/gym/pybullet_envs/bullet/minitaur.py - [3] https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/gym/pybullet_envs/bullet/minitaur.py + - [1] "Design Principles for a Family of Direct-Drive Legged Robots", Kenneally et al., 2016 + - [2] pybullet/gym/pybullet_envs/bullet/minitaur.py + - [3] https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/gym/pybullet_envs/bullet/minitaur.py """ - def __init__(self, - simulator, - position=(0, 0, .3), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., - couple_legs=True, - foot_friction=1., - urdf=os.path.dirname(__file__) + '/urdfs/minitaur/minitaur.urdf'): + def __init__(self, simulator, position=(0, 0, .3), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + couple_legs=True, foot_friction=1., urdf=os.path.dirname(__file__) + '/urdfs/minitaur/minitaur.urdf'): + """ + Initialize the Minitaur robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + couple_legs (bool): if True, it will couple the legs by setting a constraint between two legs. + foot_friction (float): foot friction value. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.3) diff --git a/pyrobolearn/robots/mkz.py b/pyrobolearn/robots/mkz.py index 469b69b..8fb37b3 100644 --- a/pyrobolearn/robots/mkz.py +++ b/pyrobolearn/robots/mkz.py @@ -22,18 +22,24 @@ class MKZ(AckermannWheeledRobot): Drive-by-wire interface to the Dataspeed Inc. Lincoln MKZ DBW kit. References: - [1] Dataspeed Inc.: https://www.dataspeedinc.com/ - [2] ROS wiki: http://wiki.ros.org/dbw_mkz - [3] Bitbucket: https://bitbucket.org/DataspeedInc/dbw_mkz_ros + - [1] Dataspeed Inc.: https://www.dataspeedinc.com/ + - [2] ROS wiki: http://wiki.ros.org/dbw_mkz + - [3] Bitbucket: https://bitbucket.org/DataspeedInc/dbw_mkz_ros """ - def __init__(self, - simulator, - position=(0, 0, .4), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .4), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/mkz/mkz.urdf'): + """ + Initialize the MKZ car. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.4) diff --git a/pyrobolearn/robots/morphex.py b/pyrobolearn/robots/morphex.py index fcabd18..1468e77 100644 --- a/pyrobolearn/robots/morphex.py +++ b/pyrobolearn/robots/morphex.py @@ -19,17 +19,23 @@ class Morphex(HexapodRobot): r"""Morphex Hexapod robot References: - [1] http://zentasrobots.com/ - [2] https://gist.github.com/lanius/cb8b5e0ede9ff3b2b2c1bc68b95066fb + - [1] http://zentasrobots.com/ + - [2] https://gist.github.com/lanius/cb8b5e0ede9ff3b2b2c1bc68b95066fb """ - def __init__(self, - simulator, - position=(0, 0, 0.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/morphex/morphex.urdf'): + """ + Initialize the Morphex robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.2) diff --git a/pyrobolearn/robots/nao.py b/pyrobolearn/robots/nao.py index 2be95bd..ac3181c 100644 --- a/pyrobolearn/robots/nao.py +++ b/pyrobolearn/robots/nao.py @@ -20,15 +20,24 @@ __status__ = "Development" class Nao(BipedRobot, BiManipulator, TwoHand): r"""Nao robot + References: + - [1] https://github.com/ros-naoqi/nao_robot + - [2] https://github.com/ros-naoqi/nao_meshes """ - def __init__(self, - simulator, - position=(0, 0, 0.35), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.35), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/nao/nao_v40.urdf'): + """ + Initialize the Nao robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.35) diff --git a/pyrobolearn/robots/opendog.py b/pyrobolearn/robots/opendog.py index 094e684..b855cf2 100644 --- a/pyrobolearn/robots/opendog.py +++ b/pyrobolearn/robots/opendog.py @@ -19,17 +19,23 @@ class OpenDog(QuadrupedRobot): r""" OpenDog robot References: - [1] https://github.com/XRobots/openDog - [2] https://github.com/wiccopruebas/opendog_project + - [1] https://github.com/XRobots/openDog + - [2] https://github.com/wiccopruebas/opendog_project """ - def __init__(self, - simulator, - position=(0, 0, .6), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, .6), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/opendog/opendog.urdf'): + """ + Initialize the OpenDog robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.6) diff --git a/pyrobolearn/robots/pepper.py b/pyrobolearn/robots/pepper.py index 0d71e12..93db59f 100644 --- a/pyrobolearn/robots/pepper.py +++ b/pyrobolearn/robots/pepper.py @@ -26,16 +26,25 @@ class Pepper(WheeledRobot, BiManipulator): for these joints are probably not correct. For more information: - [1] http://doc.aldebaran.com/2-0/home_juliette.html + - [1] http://doc.aldebaran.com/2-0/home_juliette.html + + References: + - [2] https://github.com/ros-naoqi/pepper_robot """ - def __init__(self, - simulator, - position=(0, 0, 0.9), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.9), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/pepper/pepper.urdf'): + """ + Initialize the Pepper robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.9) diff --git a/pyrobolearn/robots/phantomx.py b/pyrobolearn/robots/phantomx.py index 03a38eb..ad8d3c8 100644 --- a/pyrobolearn/robots/phantomx.py +++ b/pyrobolearn/robots/phantomx.py @@ -19,17 +19,23 @@ class PhantomX(HexapodRobot): r"""Phantom X Hexapod robot References: - [1] https://www.trossenrobotics.com/phantomx-ax-hexapod.aspx - [2] https://github.com/HumaRobotics/phantomx_description + - [1] https://www.trossenrobotics.com/phantomx-ax-hexapod.aspx + - [2] https://github.com/HumaRobotics/phantomx_description """ - def __init__(self, - simulator, - position=(0, 0, 0.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/phantomx/phantomx.urdf'): + """ + Initialize the PhantomX robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.2) diff --git a/pyrobolearn/robots/pleurobot.py b/pyrobolearn/robots/pleurobot.py index 09031b2..68e4730 100644 --- a/pyrobolearn/robots/pleurobot.py +++ b/pyrobolearn/robots/pleurobot.py @@ -21,12 +21,23 @@ class Pleurobot(QuadrupedRobot, UUVRobot, USVRobot): r"""Pleurobot Salamander robot References: - [1] https://github.com/KM-RoBoTa/pleurobot_ros_pkg - [2] https://biorob.epfl.ch/pleurobot + - [1] https://github.com/KM-RoBoTa/pleurobot_ros_pkg + - [2] https://biorob.epfl.ch/pleurobot """ def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/pleurobot/pleurobot.urdf'): + """ + Initialize the Pleurobot robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/pr2.py b/pyrobolearn/robots/pr2.py index b99a59d..c60f083 100644 --- a/pyrobolearn/robots/pr2.py +++ b/pyrobolearn/robots/pr2.py @@ -6,6 +6,8 @@ import os from pyrobolearn.robots.wheeled_robot import WheeledRobot from pyrobolearn.robots.manipulator import BiManipulator +from pyrobolearn.robots.gripper import AngularGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -20,17 +22,23 @@ class PR2(WheeledRobot, BiManipulator): r"""PR2 robot References: - [1] http://www.willowgarage.com/pages/pr2/overview - [2] https://github.com/pr2/pr2_common + - [1] http://www.willowgarage.com/pages/pr2/overview + - [2] https://github.com/pr2/pr2_common """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/pr2/pr2.urdf'): + """ + Initialize the PR2 robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) @@ -45,6 +53,41 @@ class PR2(WheeledRobot, BiManipulator): self.name = 'pr2' +class PR2Gripper(AngularGripper): + r"""PR2 Gripper + + References: + - [1] http://www.willowgarage.com/pages/pr2/overview + - [2] https://github.com/pr2/pr2_common + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, -0.707, 0, 0.707), fixed_base=True, scale=1., + urdf=os.path.dirname(os.path.abspath(__file__)) + '/urdfs/pr2/pr2_gripper.urdf'): + """ + Initialize the PR2 Gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, -0.707, 0, 0.707) + if fixed_base is None: + fixed_base = True + + super(PR2Gripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'pr2_gripper' + + # Test if __name__ == "__main__": from itertools import count diff --git a/pyrobolearn/robots/quadcopter.py b/pyrobolearn/robots/quadcopter.py index 8ef141e..c90bd82 100644 --- a/pyrobolearn/robots/quadcopter.py +++ b/pyrobolearn/robots/quadcopter.py @@ -23,7 +23,8 @@ __status__ = "Development" class Quadcopter(RotaryWingUAV): r"""Quadcopter - WARNING: Currently, in pybullet there is no air, so we simulate the thrust force. + WARNING: If the given simulator can not simulate air dynamics, then we compute and simulate the thrust force. + For instance, in pybullet there is no air, so we simulate the thrust force with that simulator. Based on momentum theory, we can calculate the thrust [5,6,7] to be: @@ -53,27 +54,33 @@ class Quadcopter(RotaryWingUAV): * the air density :math:`\rho` is :math:`1.225kg/m^3` at sea level and at :math:`15C`. References: - [1] https://www.wilselby.com/research/ros-integration/ - [2] https://github.com/wilselby/ROS_quadrotor_simulator - [3] https://github.com/prfraanje/quadcopter_sim - [4] https://github.com/ethz-asl/rotors_simulator + - [1] https://www.wilselby.com/research/ros-integration/ + - [2] https://github.com/wilselby/ROS_quadrotor_simulator + - [3] https://github.com/prfraanje/quadcopter_sim + - [4] https://github.com/ethz-asl/rotors_simulator - [5] "Propeller Thrust" (NASA): https://www.grc.nasa.gov/WWW/K-12/airplane/propth.html - [6] "Static thrust calculation": https://quadcopterproject.wordpress.com/static-thrust-calculation/ - [7] "Propeller Static & Dynamic Thrust Calculation": + - [5] "Propeller Thrust" (NASA): https://www.grc.nasa.gov/WWW/K-12/airplane/propth.html + - [6] "Static thrust calculation": https://quadcopterproject.wordpress.com/static-thrust-calculation/ + - [7] "Propeller Static & Dynamic Thrust Calculation": https://www.electricrcaircraftguy.com/2013/09/propeller-static-dynamic-thrust-equation.html https://www.electricrcaircraftguy.com/2014/04/propeller-static-dynamic-thrust-equation-background.html - [8] "Flying Principle of a Quadrotor" (from the course "Autonomous Navigation for Flying Robots" on EdX), + - [8] "Flying Principle of a Quadrotor" (from the course "Autonomous Navigation for Flying Robots" on EdX), Jurgen, https://jsturm.de/publications/data/lecture_1_part_3.pdf """ - def __init__(self, - simulator, - position=(0, 0, 0.2), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.2), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/quadcopter/quadcopter.urdf'): + """ + Initialize the quadcopter robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.2) @@ -167,25 +174,26 @@ class Quadcopter(RotaryWingUAV): # call parent method super(Quadcopter, self).set_joint_velocities(velocities, joint_ids, forces, max_velocity) - # calculate thrust force of the given joints, and apply it on the link - for jnt, d, v in zip(joint_ids, self.propeller_directions, velocities): - if max_velocity and v > self.max_velocity: - v = self.max_velocity + # if the simulator can not simulate air, calculate thrust force of the given joints, and apply it on the link + if not self.simulator.simulate_gas_dynamics(): + for jnt, d, v in zip(joint_ids, self.propeller_directions, velocities): + if max_velocity and v > self.max_velocity: + v = self.max_velocity - # compute propeller speed v0 - state = self.sim.get_link_state(self.id, jnt, compute_velocity=True) # , compute_forward_kinematics=True) - R = get_matrix_from_quaternion(state[1]) - linear_velocity = np.array(state[-2]) - propeller_up_vec = R.dot(np.array([0., 0., 1.])) - v0 = linear_velocity.dot(propeller_up_vec) - # v0 = 0 # static thrust + # compute propeller speed v0 + state = self.sim.get_link_state(self.id, jnt, compute_velocity=True) # , compute_forward_kinematics=True) + R = get_matrix_from_quaternion(state[1]) + linear_velocity = np.array(state[-2]) + propeller_up_vec = R.dot(np.array([0., 0., 1.])) + v0 = linear_velocity.dot(propeller_up_vec) + # v0 = 0 # static thrust - # compute thrust - f = self.calculate_thrust_force(v * d, self.area, self.propeller_pitch, v0) - # f = self.mass * self.gravity / 4. + # compute thrust + f = self.calculate_thrust_force(v * d, self.area, self.propeller_pitch, v0) + # f = self.mass * self.gravity / 4. - # apply force in the simulation - self.apply_external_force(force=[0, 0, f], link_id=jnt, position=(0., 0., 0.)) + # apply force in the simulation + self.apply_external_force(force=[0, 0, f], link_id=jnt, position=(0., 0., 0.)) def get_stationary_joint_velocity(self): fg = self.mass * self.gravity / 4. diff --git a/pyrobolearn/robots/rhex.py b/pyrobolearn/robots/rhex.py index 4f7d33f..de3a5db 100644 --- a/pyrobolearn/robots/rhex.py +++ b/pyrobolearn/robots/rhex.py @@ -24,18 +24,24 @@ class Rhex(HexapodRobot): It was created by researchers at the University of Michigan and McGill University. References: - [1] https://robots.ieee.org/robots/rhex/ - [2] https://www.rhex.web.tr/ - [3] https://github.com/grafoteka/rhex + - [1] https://robots.ieee.org/robots/rhex/ + - [2] https://www.rhex.web.tr/ + - [3] https://github.com/grafoteka/rhex """ - def __init__(self, - simulator, - position=(0, 0, 0.12), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.12), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/rhex/rhex.urdf'): + """ + Initialize the Rhex robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.12) diff --git a/pyrobolearn/robots/robot.py b/pyrobolearn/robots/robot.py index efe99e9..854f855 100644 --- a/pyrobolearn/robots/robot.py +++ b/pyrobolearn/robots/robot.py @@ -1505,6 +1505,48 @@ class Robot(ControllableBody): pass def get_link_accelerations(self, link_ids=None): + r""" + + Args: + link_ids: + + Returns: + + """ + pass + + def get_link_world_accelerations(self, link_ids=None, flatten=True): + r""" + Return the linear and angular accelerations (expressed in the Cartesian world space coordinates) for the given + link(s). + + The acceleration of a link can be computed in a recursive form: + + .. math:: a_i = a_{i-1} + s + + or from the base to the link: + + .. math:: + + or based on the Jacobian: + + .. math:: a = \frac{d}{dt} v = \frac{d}{dt} J(q) \dot{q} = J(q) \ddot{q} + \dot{J}(q) \dot{q}, + + where :math:`J(q)` is the link Jacobian at the current configuration (i.e. joint positions) :math:`q`, + :math:`\dot{q}` and :math:`\ddot{q}` are the current joint velocities and accelerations respectively, and + :math:`\dot{J}(q)` is the time derivative of the link Jacobian. + + Args: + link_ids (int, int[N], None): link id, or list of desired link ids. If None, get the linear and angular + velocities of all links associated to actuated joints. + flatten (bool): if True, it will return a 1D array instead of a 2D array + + Returns: + if 1 link: + np.array[6]: linear and angular velocity of the link in the Cartesian world space + if multiple links: + np.array[Nx6], np.array[N,6]: linear and angular velocity of each link + """ pass def get_link_contacts(self, link_ids): diff --git a/pyrobolearn/robots/rrbot.py b/pyrobolearn/robots/rrbot.py index b8f0a4a..3c3e5b0 100644 --- a/pyrobolearn/robots/rrbot.py +++ b/pyrobolearn/robots/rrbot.py @@ -23,13 +23,19 @@ class RRBot(Manipulator): for these joints are probably not correct. """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1, + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1, urdf=os.path.dirname(__file__) + '/urdfs/rrbot/rrbot.urdf'): + """ + Initialize the RRBot robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/sawyer.py b/pyrobolearn/robots/sawyer.py index d74ffc1..2a616b9 100644 --- a/pyrobolearn/robots/sawyer.py +++ b/pyrobolearn/robots/sawyer.py @@ -22,17 +22,23 @@ class Sawyer(Manipulator, WheeledRobot): Sawyer robot built by Rethink Robotics. References: - [1] Rethink Robotics - [2] https://github.com/RethinkRobotics/sawyer_robot + - [1] Rethink Robotics + - [2] https://github.com/RethinkRobotics/sawyer_robot """ - def __init__(self, - simulator, - position=(0, 0, 0.92), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.92), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/sawyer/sawyer.urdf'): + """ + Initialize the Sawyer robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.92) diff --git a/pyrobolearn/robots/schunk_hand.py b/pyrobolearn/robots/schunk_hand.py new file mode 100644 index 0000000..f854df6 --- /dev/null +++ b/pyrobolearn/robots/schunk_hand.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +"""Provide the Schunk hand robotic platform. +""" + +import os + +from pyrobolearn.robots.hand import Hand + + +__author__ = "Brian Delhaisse" +__copyright__ = "Copyright 2018, PyRoboLearn" +__license__ = "GNU GPLv3" +__version__ = "1.0.0" +__maintainer__ = "Brian Delhaisse" +__email__ = "briandelhaisse@gmail.com" +__status__ = "Development" + + +class SchunkHand(Hand): + r"""Schunk Hand + + References: + - [1] https://github.com/fzi-forschungszentrum-informatik/schunk_svh_driver + - [2] https://github.com/ADVRHumanoids/centauro-simulator + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1.): + # left=False + """ + Initialize the Schunk hand. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the hand base will be fixed in the world. + scale (float): scaling factor that is used to scale the hand. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0, 0, 1) + if fixed_base is None: + fixed_base = True + + # if left: + # urdf_path = '../robots/urdfs/centauro/schunk_left_hand.urdf' + # else: + urdf_path = os.path.dirname(__file__) + '/urdfs/centauro/schunk_hand.urdf' + + super(SchunkHand, self).__init__(simulator, urdf_path, position, orientation, fixed_base, scale) + self.name = 'schunk_hand' + + +# Test +if __name__ == "__main__": + from itertools import count + from pyrobolearn.simulators import BulletSim + from pyrobolearn.worlds import BasicWorld + + # Create simulator + sim = BulletSim() + + # create world + world = BasicWorld(sim) + + # create robot + right_hand = SchunkHand(sim) + + # print information about the robot + right_hand.print_info() + # H = right_hand.get_mass_matrix() + # print("Inertia matrix: H(q) = {}".format(H)) + + # Position control using sliders + right_hand.add_joint_slider() + + for i in count(): + right_hand.update_joint_slider() + # right_hand.set_joint_positions([0.] * right_hand.num_dofs) + + # step in simulation + world.step(sleep_dt=1./240) diff --git a/pyrobolearn/robots/sea_hexapod.py b/pyrobolearn/robots/sea_hexapod.py index fac56ba..603549e 100644 --- a/pyrobolearn/robots/sea_hexapod.py +++ b/pyrobolearn/robots/sea_hexapod.py @@ -19,16 +19,22 @@ class SEAHexapod(HexapodRobot): r"""SEA Hexapod robot (from CMU Biorobotics Lab) References: - [1] https://github.com/alexansari101/snake_ws + - [1] https://github.com/alexansari101/snake_ws """ - def __init__(self, - simulator, - position=(0, 0, 0.15), - orientation=(0, 0, 0.707, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.15), orientation=(0, 0, 0.707, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/cmu_sea/hexapod.urdf'): + """ + Initialize the SEA Hexapod robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.15) diff --git a/pyrobolearn/robots/sea_snake.py b/pyrobolearn/robots/sea_snake.py index 0efc0f7..a55fc92 100644 --- a/pyrobolearn/robots/sea_snake.py +++ b/pyrobolearn/robots/sea_snake.py @@ -19,16 +19,22 @@ class SEASnake(Robot): r"""SEA snake robot (from CMU Biorobotics Lab) References: - [1] https://github.com/alexansari101/snake_ws + - [1] https://github.com/alexansari101/snake_ws """ - def __init__(self, - simulator, - position=(-0.5, 0, 0.1), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 0.1), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/cmu_sea/snake.urdf'): + """ + Initialize the SEA snake robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (-0.5, 0., 0.1) diff --git a/pyrobolearn/robots/shadowhand.py b/pyrobolearn/robots/shadowhand.py index b02ca1b..a029798 100644 --- a/pyrobolearn/robots/shadowhand.py +++ b/pyrobolearn/robots/shadowhand.py @@ -19,18 +19,24 @@ class ShadowHand(Hand): r"""Shadow Hand References: - [1] https://www.shadowrobot.com/products/dexterous-hand/ - [2] Shadow hand description: https://github.com/shadow-robot/sr_common - [3] Documentation: https://dexterous-hand.readthedocs.io/en/latest/index.html + - [1] https://www.shadowrobot.com/products/dexterous-hand/ + - [2] Shadow hand description: https://github.com/shadow-robot/sr_common + - [3] Documentation: https://dexterous-hand.readthedocs.io/en/latest/index.html """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0.707, 0.707), - scale=1., - left=True, - fixed_base=True): + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0.707, 0.707), fixed_base=True, scale=1., + left=True): + """ + Initialize the Shadow hand robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + left (bool): if we should create a left hand, or right hand. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/softhand.py b/pyrobolearn/robots/softhand.py index 90ab5b2..08092fa 100644 --- a/pyrobolearn/robots/softhand.py +++ b/pyrobolearn/robots/softhand.py @@ -20,17 +20,22 @@ class SoftHand(Hand): r"""Pisa-IIT Soft Hand References: - [1] https://github.com/CentroEPiaggio/pisa-iit-soft-hand - [2] "Adaptive Synergies for the Design and Control of the Pisa/IIT SoftHand", Catalano et al., 2014 + - [1] https://github.com/CentroEPiaggio/pisa-iit-soft-hand + - [2] "Adaptive Synergies for the Design and Control of the Pisa/IIT SoftHand", Catalano et al., 2014 """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - scale=1., - left=True, - fixed_base=True): + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., left=True): + """ + Initialize the Soft hand robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + left (bool): if we should create a left hand, or right hand. + """ # check parameters if position is None: position = (0., 0., 0.) diff --git a/pyrobolearn/robots/swimmer.py b/pyrobolearn/robots/swimmer.py index cdcea86..4ee0110 100644 --- a/pyrobolearn/robots/swimmer.py +++ b/pyrobolearn/robots/swimmer.py @@ -19,15 +19,10 @@ class Swimmer(Robot): r"""Swimmer Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(-0.5, 0, 0.1), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 0.1), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/swimmer.xml'): # check parameters if position is None: diff --git a/pyrobolearn/robots/techpod.py b/pyrobolearn/robots/techpod.py index 2827e30..214e53e 100755 --- a/pyrobolearn/robots/techpod.py +++ b/pyrobolearn/robots/techpod.py @@ -29,18 +29,24 @@ class Techpod(FixedWingUAV): is carried out by pybullet. References: - [1] https://github.com/ethz-asl/rotors_simulator - [2] "Theory of flight": web.mit.edu/16.00/www/aec/flight.html - [3] "NASA: Guided Tours of the BGA": www.grc.nasa.gov/WWW/k-12/airplane/guided.html + - [1] https://github.com/ethz-asl/rotors_simulator + - [2] "Theory of flight": web.mit.edu/16.00/www/aec/flight.html + - [3] "NASA: Guided Tours of the BGA": www.grc.nasa.gov/WWW/k-12/airplane/guided.html """ - def __init__(self, - simulator, - position=(0, 0, 0.5), - orientation=(0, 0, 0, 1), - fixed_base=False, - scaling=1., + def __init__(self, simulator, position=(0, 0, 0.5), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/techpod/techpod.urdf'): + """ + Initialize the Techpod robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.5) @@ -51,7 +57,7 @@ class Techpod(FixedWingUAV): if fixed_base is None: fixed_base = False - super(Techpod, self).__init__(simulator, urdf, position, orientation, fixed_base, scaling) + super(Techpod, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.name = 'techpod' # info diff --git a/pyrobolearn/robots/uav.py b/pyrobolearn/robots/uav.py index 02187fc..9f1a931 100644 --- a/pyrobolearn/robots/uav.py +++ b/pyrobolearn/robots/uav.py @@ -21,6 +21,17 @@ class UAVRobot(Robot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the UAV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(UAVRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.propellers = [] # list of propellers id @@ -43,6 +54,17 @@ class FixedWingUAV(UAVRobot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the Fixed wing UAV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(FixedWingUAV, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) @@ -52,6 +74,17 @@ class RotaryWingUAV(UAVRobot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the rotary UAV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(RotaryWingUAV, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) def hover(self): @@ -94,4 +127,15 @@ class FlappingWingUAV(UAVRobot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the flapping UAV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(FlappingWingUAV, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) diff --git a/pyrobolearn/robots/urdfs/allegrohand/allegro_right_hand.urdf b/pyrobolearn/robots/urdfs/allegrohand/allegro_right_hand.urdf index 2eb4f85..2744a7d 100644 --- a/pyrobolearn/robots/urdfs/allegrohand/allegro_right_hand.urdf +++ b/pyrobolearn/robots/urdfs/allegrohand/allegro_right_hand.urdf @@ -22,7 +22,7 @@ and one fixed link will be added for the tip. --> - + - + --> diff --git a/pyrobolearn/robots/urdfs/baxter/baxter_gripper.urdf b/pyrobolearn/robots/urdfs/baxter/baxter_gripper.urdf new file mode 100644 index 0000000..3075bf8 --- /dev/null +++ b/pyrobolearn/robots/urdfs/baxter/baxter_gripper.urdf @@ -0,0 +1,326 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + 1000 + 0.0 0.0 1.0 + 1e5 + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1000 + 1000 + 0.0 0.0 1.0 + 1e5 + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + EffortJointInterface + + + EffortJointInterface + 1 + + + + transmission_interface/SimpleTransmission + + EffortJointInterface + + + EffortJointInterface + 1 + + + + 1 + + + 1 + + + + diff --git a/pyrobolearn/robots/urdfs/centauro/schunk_hand.urdf b/pyrobolearn/robots/urdfs/centauro/schunk_hand.urdf new file mode 100644 index 0000000..9f298da --- /dev/null +++ b/pyrobolearn/robots/urdfs/centauro/schunk_hand.urdf @@ -0,0 +1,1419 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/EffortJointInterface + + + 1 + hardware_interface/EffortJointInterface + + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + 70 + 70 + 0.001 + + 10000000.0 + 100000.0 + + + + diff --git a/pyrobolearn/robots/urdfs/fetch/fetch_gripper.urdf b/pyrobolearn/robots/urdfs/fetch/fetch_gripper.urdf new file mode 100644 index 0000000..4dba22b --- /dev/null +++ b/pyrobolearn/robots/urdfs/fetch/fetch_gripper.urdf @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/franka/franka_gripper.urdf b/pyrobolearn/robots/urdfs/franka/franka_gripper.urdf new file mode 100644 index 0000000..4a3ca25 --- /dev/null +++ b/pyrobolearn/robots/urdfs/franka/franka_gripper.urdf @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/jaco/jaco_gripper.urdf b/pyrobolearn/robots/urdfs/jaco/jaco_gripper.urdf new file mode 100644 index 0000000..67c36d7 --- /dev/null +++ b/pyrobolearn/robots/urdfs/jaco/jaco_gripper.urdf @@ -0,0 +1,631 @@ + + + + + + + + + + + + + + + + Gazebo/Grey + 1 + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 1 + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 1 + 100000 + 100000 + 100000000.0 + 1.0 + + + + Gazebo/White + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/FlatBlack + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + Gazebo/Grey + 100000 + 100000 + 100000000.0 + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/pr2/pr2_gripper.urdf b/pyrobolearn/robots/urdfs/pr2/pr2_gripper.urdf new file mode 100644 index 0000000..b26ee11 --- /dev/null +++ b/pyrobolearn/robots/urdfs/pr2/pr2_gripper.urdf @@ -0,0 +1,683 @@ + + + + + + + + + + + + + + + + + + true + 1000.0 + + + true + 1.0 + 5 + power_state + 10.0 + 87.78 + -474 + 525 + 15.52 + 16.41 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + true + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + true + false + + 100.0 + + r_gripper_l_finger_tip_link_collision + + + true + r_gripper_l_finger_tip_link + 100.0 + r_gripper_l_finger_tip_bumper + + + + + + + + + + + + + + + + true + false + + 100.0 + + r_gripper_r_finger_tip_link_collision + + + true + r_gripper_r_finger_tip_link + 100.0 + r_gripper_r_finger_tip_bumper + + + + + + + + + + true + 100.0 + r_gripper_l_finger_link + r_gripper_l_finger_pose_ground_truth + 0.0 + base_link + + + true + 100.0 + r_gripper_l_finger_link + r_gripper_l_finger_force_ground_truth + + + + + + + + + + + + + 0.17126 + + 7.7562e-05 + 1.49095e-06 + -9.83385e-06 + 0.000197083 + -3.06125e-06 + 0.000181054 + + 0.03598 0.0173 -0.00164 0 0 0 + + 0.82991 -0.157 0.790675 0 -0 0 + false + + + + 0.17389 + + 7.73841e-05 + -2.09309e-06 + -8.36228e-06 + 0.000198474 + 2.4611e-06 + 0.00018107 + + 0.03576 -0.01736 -0.00095 0 0 0 + + 0.82991 -0.219 0.790675 0 0 0 + false + + + + + r_gripper_motor_screw_link + r_gripper_r_finger_tip_link + -3141.6 + + 0 1 0 + + + + r_gripper_l_finger_tip_link + r_gripper_motor_screw_link + 3141.6 + + 0 1 0 + + + + + + r_gripper_r_parallel_link + r_gripper_palm_link + + 0 0 -1 + + 0.2 + + + 0.05891 -0.031 0 0 0 0 + + + r_gripper_l_parallel_link + r_gripper_palm_link + + 0 0 1 + + 0.2 + + + 0.05891 0.031 0 0 0 0 + + + r_gripper_r_parallel_link + r_gripper_r_finger_tip_link + + 0 0 1 + + -0.018 -0.021 0 0 0 0 + + + r_gripper_l_parallel_link + r_gripper_l_finger_tip_link + + 0 0 1 + + -0.018 0.021 0 0 0 0 + + + r_gripper_r_finger_tip_link + r_gripper_l_finger_tip_link + + 0 1 0 + + + + + true + + + + true + + + + true + + + + true + + + + + + + + + + + + + + + + + + + + + + true + + + + true + 100.0 + r_gripper_palm_link + r_gripper_palm_pose_ground_truth + 0 0 0 + 0 0 0 + 0.0 + map + + + + + 20 + 40 + 2 + + r_gripper_r_finger_tip_link + r_gripper_l_finger_tip_link + r_gripper_palm_link + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/shadowhand/left_hand.urdf b/pyrobolearn/robots/urdfs/shadowhand/left_hand.urdf index 80b794d..84e359e 100644 --- a/pyrobolearn/robots/urdfs/shadowhand/left_hand.urdf +++ b/pyrobolearn/robots/urdfs/shadowhand/left_hand.urdf @@ -31,12 +31,12 @@ - + diff --git a/pyrobolearn/robots/urdfs/shadowhand/right_hand.urdf b/pyrobolearn/robots/urdfs/shadowhand/right_hand.urdf index c6e288f..100e23b 100644 --- a/pyrobolearn/robots/urdfs/shadowhand/right_hand.urdf +++ b/pyrobolearn/robots/urdfs/shadowhand/right_hand.urdf @@ -31,12 +31,12 @@ - + diff --git a/pyrobolearn/robots/urdfs/softhand/left_hand.urdf b/pyrobolearn/robots/urdfs/softhand/left_hand.urdf index 1680b43..5710114 100644 --- a/pyrobolearn/robots/urdfs/softhand/left_hand.urdf +++ b/pyrobolearn/robots/urdfs/softhand/left_hand.urdf @@ -39,8 +39,8 @@ - - + + diff --git a/pyrobolearn/robots/urdfs/softhand/right_hand.urdf b/pyrobolearn/robots/urdfs/softhand/right_hand.urdf index 2974b3b..524430f 100644 --- a/pyrobolearn/robots/urdfs/softhand/right_hand.urdf +++ b/pyrobolearn/robots/urdfs/softhand/right_hand.urdf @@ -39,8 +39,8 @@ - - + + diff --git a/pyrobolearn/robots/urdfs/wam/wam_gripper.urdf b/pyrobolearn/robots/urdfs/wam/wam_gripper.urdf new file mode 100644 index 0000000..56c1dfb --- /dev/null +++ b/pyrobolearn/robots/urdfs/wam/wam_gripper.urdf @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/wam/wam_gripper_with_wrist.urdf b/pyrobolearn/robots/urdfs/wam/wam_gripper_with_wrist.urdf new file mode 100644 index 0000000..24b97b5 --- /dev/null +++ b/pyrobolearn/robots/urdfs/wam/wam_gripper_with_wrist.urdf @@ -0,0 +1,580 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + 0.8 + 0.8 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyrobolearn/robots/urdfs/youbot/youbot_gripper.urdf b/pyrobolearn/robots/urdfs/youbot/youbot_gripper.urdf new file mode 100644 index 0000000..e30e537 --- /dev/null +++ b/pyrobolearn/robots/urdfs/youbot/youbot_gripper.urdf @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + + transmission_interface/SimpleTransmission + + EffortJointInterface + 1 + + + EffortJointInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gazebo/Black + false + true + + + Gazebo/Black + false + true + + + Gazebo/Black + false + true + + + transmission_interface/SimpleTransmission + + EffortJointInterface + 1 + + + EffortJointInterface + + + + transmission_interface/SimpleTransmission + + EffortJointInterface + 1 + + + EffortJointInterface + + + + diff --git a/pyrobolearn/robots/usv.py b/pyrobolearn/robots/usv.py index 8b5a93d..7f5038d 100644 --- a/pyrobolearn/robots/usv.py +++ b/pyrobolearn/robots/usv.py @@ -21,4 +21,15 @@ class USVRobot(Robot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the USV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(USVRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) diff --git a/pyrobolearn/robots/uuv.py b/pyrobolearn/robots/uuv.py index 41f7d9b..dc80cb7 100644 --- a/pyrobolearn/robots/uuv.py +++ b/pyrobolearn/robots/uuv.py @@ -21,4 +21,15 @@ class UUVRobot(Robot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the UUV. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(UUVRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) diff --git a/pyrobolearn/robots/walker2d.py b/pyrobolearn/robots/walker2d.py index fd63606..c75aa59 100644 --- a/pyrobolearn/robots/walker2d.py +++ b/pyrobolearn/robots/walker2d.py @@ -19,15 +19,10 @@ class Walker2D(Robot): r"""Walker 2D Mujoco Model References: - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf + - [1] description: https://github.com/bulletphysics/bullet3/tree/master/examples/pybullet/gym/pybullet_data/mjcf """ - def __init__(self, - simulator, - position=(-0.5, 0, 0.1), - orientation=(0, 0.707, 0, 0.707), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(-0.5, 0, 0.1), orientation=(0, 0.707, 0, 0.707), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/mjcfs/walker2d.xml'): # check parameters if position is None: diff --git a/pyrobolearn/robots/walkman.py b/pyrobolearn/robots/walkman.py index c2f0615..1b3470d 100644 --- a/pyrobolearn/robots/walkman.py +++ b/pyrobolearn/robots/walkman.py @@ -25,18 +25,25 @@ class Walkman(BipedRobot, BiManipulator): each ankle). References: - [1] "WALK-MAN: A High-Performance Humanoid Platform for Realistic Environments", Tsagarakis et al., 2017 - [2] https://github.com/ADVRHumanoids/iit-walkman-ros-pkg + - [1] "WALK-MAN: A High-Performance Humanoid Platform for Realistic Environments", Tsagarakis et al., 2017 + - [2] https://github.com/ADVRHumanoids/iit-walkman-ros-pkg """ - def __init__(self, - simulator, - position=(0, 0, 1.14), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., - urdf=os.path.dirname(__file__) + '/urdfs/walkman/walkman.urdf', - lower_body=False): # 'walkman_lower_body.urdf' + def __init__(self, simulator, position=(0, 0, 1.14), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + lower_body=False, urdf=os.path.dirname(__file__) + '/urdfs/walkman/walkman.urdf'): + # 'walkman_lower_body.urdf' + """ + Initialize the Walkman robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + lower_body (bool): if True, it will instantiate only the lower part of the robot (i.e. the legs). + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 1.14) diff --git a/pyrobolearn/robots/wam.py b/pyrobolearn/robots/wam.py index 2b3b7ed..a150c90 100644 --- a/pyrobolearn/robots/wam.py +++ b/pyrobolearn/robots/wam.py @@ -1,10 +1,11 @@ #!/usr/bin/env python -"""Provide the WAM robotic platform. +"""Provide the WAM robotic platform and the Barrett hand gripper. """ import os from pyrobolearn.robots.manipulator import Manipulator +from pyrobolearn.robots.gripper import AngularGripper __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -19,17 +20,23 @@ class WAM(Manipulator): r"""Wam robot References: - [1] https://advanced.barrett.com/wam-arm-1 - [2] https://github.com/jhu-lcsr/barrett_model + - [1] https://advanced.barrett.com/wam-arm-1 + - [2] https://github.com/jhu-lcsr/barrett_model """ - def __init__(self, - simulator, - position=(0, 0, 0), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/wam/wam.urdf'): + """ + Initialize the WAM robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.) @@ -46,6 +53,45 @@ class WAM(Manipulator): # self.disable_motor() +class BarrettHand(AngularGripper): + r"""BarretHand (Gripper) + + References: + - [1] https://advanced.barrett.com/wam-arm-1 + - [2] https://github.com/jhu-lcsr/barrett_model + """ + + def __init__(self, simulator, position=(0, 0, 0), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/wam/wam_gripper.urdf'): + """ + Initialize the Barrett hand/gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0, 0, 1) + if fixed_base is None: + fixed_base = True + + super(BarrettHand, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'barrett_hand' + + +# alias +WAMGripper = BarrettHand + + # Test if __name__ == "__main__": import numpy as np diff --git a/pyrobolearn/robots/wheeled_robot.py b/pyrobolearn/robots/wheeled_robot.py index bdb6a5d..a28b519 100644 --- a/pyrobolearn/robots/wheeled_robot.py +++ b/pyrobolearn/robots/wheeled_robot.py @@ -24,6 +24,17 @@ class WheeledRobot(Robot): """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the wheeled robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(WheeledRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) self.wheels = [] @@ -122,15 +133,26 @@ class DifferentialWheeledRobot(WheeledRobot): \omega_L &= v - \frac{d}{2r} \omega References: - [1] Wikipedia: https://en.wikipedia.org/wiki/Differential_wheeled_robot - [2] "Pros and cons for different types of drive selection": + - [1] Wikipedia: https://en.wikipedia.org/wiki/Differential_wheeled_robot + - [2] "Pros and cons for different types of drive selection": https://robohub.org/pros-and-cons-for-different-types-of-drive-selection/ - [3] Wheel Control Theory: + - [3] Wheel Control Theory: http://www.robotplatform.com/knowledge/Classification_of_Robots/wheel_control_theory.html - [4] "Robotics: Modelling, Planning and Control" (section 11.2), Siciliano et al., 2010 + - [4] "Robotics: Modelling, Planning and Control" (section 11.2), Siciliano et al., 2010 """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the differential wheeled robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(DifferentialWheeledRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) @@ -170,14 +192,25 @@ class AckermannWheeledRobot(WheeledRobot): Check also [2] for the different types of drive. References: - [1] Wikipedia: https://en.wikipedia.org/wiki/Ackermann_steering_geometry - [2] "Pros and cons for different types of drive selection": + - [1] Wikipedia: https://en.wikipedia.org/wiki/Ackermann_steering_geometry + - [2] "Pros and cons for different types of drive selection": https://robohub.org/pros-and-cons-for-different-types-of-drive-selection/ - [3] Wheel Control Theory: + - [3] Wheel Control Theory: http://www.robotplatform.com/knowledge/Classification_of_Robots/wheel_control_theory.html """ def __init__(self, simulator, urdf, position=None, orientation=None, fixed_base=False, scale=1.): + """ + Initialize the Ackermann wheeled robot. + + Args: + simulator (Simulator): simulator instance. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + """ super(AckermannWheeledRobot, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) diff --git a/pyrobolearn/robots/youbot.py b/pyrobolearn/robots/youbot.py index 58d305d..0cf186b 100644 --- a/pyrobolearn/robots/youbot.py +++ b/pyrobolearn/robots/youbot.py @@ -1,7 +1,7 @@ #!/usr/bin/env python """Provide the Youbot robotic platforms. -These include: YoubotBase, KukaYoubotArm, Youbot, YoubotDualArm +These include: YoubotBase, KukaYoubotArm, Youbot, YoubotDualArm, YoubotGripper """ import os @@ -9,6 +9,8 @@ import numpy as np from pyrobolearn.robots.manipulator import Manipulator, BiManipulator from pyrobolearn.robots.wheeled_robot import DifferentialWheeledRobot +from pyrobolearn.robots.gripper import ParallelGripper + __author__ = "Brian Delhaisse" __copyright__ = "Copyright 2018, PyRoboLearn" @@ -23,16 +25,22 @@ class YoubotBase(DifferentialWheeledRobot): r"""Youbot Base robot References: - [1] https://github.com/youbot + - [1] https://github.com/youbot """ - def __init__(self, - simulator, - position=(0, 0, 0.085), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.085), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/youbot/youbot_base_only.urdf'): + """ + Initialize the Youbot base robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.085) @@ -55,16 +63,22 @@ class KukaYoubotArm(Manipulator): r"""Kuka Youbot arm robot References: - [1] https://github.com/youbot + - [1] https://github.com/youbot """ - def __init__(self, - simulator, - position=(0, 0, 0.03), - orientation=(0, 0, 0, 1), - fixed_base=True, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.03), orientation=(0, 0, 0, 1), fixed_base=True, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/youbot/youbot_arm_only.urdf'): + """ + Initialize the Kuka Youbot manipulator. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.03) @@ -83,16 +97,22 @@ class Youbot(Manipulator, DifferentialWheeledRobot): r"""Youbot robot References: - [1] https://github.com/youbot + - [1] https://github.com/youbot """ - def __init__(self, - simulator, - position=(0, 0, 0.085), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.085), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/youbot/youbot.urdf'): + """ + Initialize the Youbot robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.085) @@ -115,16 +135,22 @@ class YoubotDualArm(BiManipulator, DifferentialWheeledRobot): r"""Youbot dual arm robot References: - [1] https://github.com/youbot + - [1] https://github.com/youbot """ - def __init__(self, - simulator, - position=(0, 0, 0.085), - orientation=(0, 0, 0, 1), - fixed_base=False, - scale=1., + def __init__(self, simulator, position=(0, 0, 0.085), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., urdf=os.path.dirname(__file__) + '/urdfs/youbot/youbot_dual_arm.urdf'): + """ + Initialize the Youbot dual arm robot. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the robot base will be fixed in the world. + scale (float): scaling factor that is used to scale the robot. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ # check parameters if position is None: position = (0., 0., 0.085) @@ -143,6 +169,40 @@ class YoubotDualArm(BiManipulator, DifferentialWheeledRobot): # self.wheel_directions = np.ones(len(self.wheels)) +class YoubotGripper(ParallelGripper): + r"""Youbot Gripper + + References: + - [1] https://github.com/youbot + """ + + def __init__(self, simulator, position=(0., 0., 0.), orientation=(0, 0, 0, 1), fixed_base=False, scale=1., + urdf=os.path.dirname(__file__) + '/urdfs/youbot/youbot_gripper.urdf'): + """ + Initialize the Youbot gripper. + + Args: + simulator (Simulator): simulator instance. + position (np.array[3]): Cartesian world position. + orientation (np.array[4]): Cartesian world orientation expressed as a quaternion [x,y,z,w]. + fixed_base (bool): if True, the gripper will be fixed in the world. + scale (float): scaling factor that is used to scale the gripper. + urdf (str): path to the urdf. Do not change it unless you know what you are doing. + """ + # check parameters + if position is None: + position = (0., 0., 0.) + if len(position) == 2: # assume x, y are given + position = tuple(position) + (0.,) + if orientation is None: + orientation = (0, 0, 0, 1) + if fixed_base is None: + fixed_base = True + + super(YoubotGripper, self).__init__(simulator, urdf, position, orientation, fixed_base, scale) + self.name = 'youbot_gripper' + + # Test if __name__ == "__main__": from itertools import count