From 0a482b409c739a7b8d2e0dd3c1f0cbbe0b9b3c43 Mon Sep 17 00:00:00 2001 From: Brian Delhaisse Date: Tue, 2 Jul 2019 20:11:24 +0200 Subject: [PATCH] fix errors in setup and bullet_ros --- pyrobolearn/robots/laikago.py | 2 +- pyrobolearn/simulators/bullet.py | 4 +-- pyrobolearn/simulators/bullet_ros.py | 3 +- pyrobolearn/simulators/ros_rbdl.py | 54 ---------------------------- requirements.txt | 11 +++--- setup.py | 2 +- 6 files changed, 13 insertions(+), 63 deletions(-) delete mode 100644 pyrobolearn/simulators/ros_rbdl.py diff --git a/pyrobolearn/robots/laikago.py b/pyrobolearn/robots/laikago.py index 3697126..32aebe7 100644 --- a/pyrobolearn/robots/laikago.py +++ b/pyrobolearn/robots/laikago.py @@ -55,7 +55,7 @@ class Laikago(QuadrupedRobot): def get_home_joint_positions(self): """Return the joint positions for the home position""" - return np.zeros(self.num_dofs) + return np.zeros(self.num_actuated_joints) # Test diff --git a/pyrobolearn/simulators/bullet.py b/pyrobolearn/simulators/bullet.py index a5029ec..3b958fd 100644 --- a/pyrobolearn/simulators/bullet.py +++ b/pyrobolearn/simulators/bullet.py @@ -3298,9 +3298,9 @@ class Bullet(Simulator): def calculate_jacobian(self, body_id, link_id, local_position, q, dq, des_ddq): r""" - Return the full geometric Jacobian matrix :math:`J(q) = [J_{lin}(q), J_{ang}(q)]^T`, such that: + Return the full geometric Jacobian matrix :math:`J(q) = [J_{lin}(q)^T, J_{ang}(q)^T]^T`, such that: - .. math:: v = [\dot{p}, \omega]^T = J(q) \dot{q} + .. math:: v = [\dot{p}^T, \omega^T]^T = J(q) \dot{q} where :math:`\dot{p}` is the Cartesian linear velocity of the link, and :math:`\omega` is its angular velocity. diff --git a/pyrobolearn/simulators/bullet_ros.py b/pyrobolearn/simulators/bullet_ros.py index 947da87..0c14dd1 100644 --- a/pyrobolearn/simulators/bullet_ros.py +++ b/pyrobolearn/simulators/bullet_ros.py @@ -192,7 +192,7 @@ class BulletROS(Bullet): # , ROS): # check if valid robot directory # if os.path.isdir(path): - robot_path = '/'.join(path.split('/')[-5:-2]) + robot_path = '/'.join(path.split('/')[-4:-1]) if robot_path == 'pyrobolearn/robots/urdfs': # get corresponding subscriber/publisher @@ -213,6 +213,7 @@ class BulletROS(Bullet): # , ROS): module = importlib.import_module('pyrobolearn.robots.ros.' + name) classes = dict(inspect.getmembers(module, inspect.isclass)) cls = classes['Robot' + name.capitalize()] + print("class: ".format(cls)) dictionary[id_] = cls(name=robot_directory_name, id_=id_) # load subscriber in simulator diff --git a/pyrobolearn/simulators/ros_rbdl.py b/pyrobolearn/simulators/ros_rbdl.py deleted file mode 100644 index f0d7af0..0000000 --- a/pyrobolearn/simulators/ros_rbdl.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -"""ROS-RBDL simulator - -This 'simulator' is not per se a simulator, it communicates with the real robots in the real world using ROS [1], and -computes any necessary kinematic and dynamics information using the RBDL library [2]. - -Specifically, this 'simulator' starts the `roscore` (if not already running), then loads robot urdf models and creates -the necessary topics/services, and uses the rigid body dynamics library to compute kinematic and dynamic information -about the model. - -Dependencies in PRL: -* `pyrobolearn.simulators.simulator.Simulator` - -References: - [1] ROS: http://www.ros.org/ - [2] RBDL: https://rbdl.bitbucket.io/ -""" - -# TODO - -import rospy -import rbdl - -from pyrobolearn.simulators.simulator import Simulator - -__author__ = "Brian Delhaisse" -__copyright__ = "Copyright 2018, PyRoboLearn" -__credits__ = ["Brian Delhaisse"] -__license__ = "GNU GPLv3" -__version__ = "1.0.0" -__maintainer__ = "Brian Delhaisse" -__email__ = "briandelhaisse@gmail.com" -__status__ = "Development" - - -class ROS_RBDL(Simulator): - r"""ROS-RBDL Interface. - - References: - [1] ROS: http://www.ros.org/ - [2] RBDL: https://rbdl.bitbucket.io/ - [3] RBDL in Python: https://rbdl.bitbucket.io/dd/dee/_python_example.html - """ - - def __init__(self): - super(ROS_RBDL, self).__init__() - - def step(self): - """Perform a step in the simulator.""" - pass - - def load_urdf(self, filename, position, orientation): - # load the model in rbdl - model = rbdl.loadModel(filename) diff --git a/requirements.txt b/requirements.txt index 2079650..4233b41 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,12 @@ # To only install dependencies, type: # $ pip install -r requirements.txt +psutil>=5.6.3 # cython +# skbuild # numpy>=1.13.3 numba>=0.42.0 +# pyquaternion numpy-quaternion autograd>=1.2 matplotlib>=2.0.2 @@ -20,9 +23,10 @@ torch>=1.0.0 torchvision>=0.2.1 # simulators +psutils pybullet>=2.4.1 gym>=0.10.9 -# git+git://github.com/benelot/pybullet-gym +# -e git+https://github.com/benelot/pybullet-gym#egg=pybullet-gym # interfaces inputs>=0.5 @@ -33,8 +37,7 @@ gTTS>=2.0.3 # models and algos sklearn>=0.0 # gpytorch>=0.1.0rc4 -# git+git://github.com/cornellius-gp/gpytorch/archive/alpha.zip -# http://github.com/cornellius-gp/gpytorch/archive/alpha.zip +# -e git+https://github.com/cornellius-gp/gpytorch/archive/alpha.zip#egg=gpytorch GPy>=1.9.6 GPyOpt>=1.2.5 # hmmlearn>=0.2.1 @@ -63,4 +66,4 @@ slycot>=0.3.3 # worlds/utils # gdal>=1.11.3 -# need to install rbdl, ipopt, tf \ No newline at end of file +# need to install rbdl, ipopt, tf diff --git a/setup.py b/setup.py index 1eaba57..76d592d 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements # get description from readme file -with open('README.md', 'r') as f: +with open('README.rst', 'r') as f: long_description = f.read() # get the required packages