mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-10 12:21:16 +08:00
fix errors appearing when using Py3.5
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import os
|
||||
import numpy as np
|
||||
|
||||
from legged_robot import QuadrupedRobot
|
||||
from pyrobolearn.robots.legged_robot import QuadrupedRobot
|
||||
|
||||
__author__ = "Brian Delhaisse"
|
||||
__copyright__ = "Copyright 2018, PyRoboLearn"
|
||||
|
||||
@@ -6,11 +6,16 @@ Dependencies:
|
||||
- `pyrobolearn.utils`
|
||||
"""
|
||||
|
||||
import sys
|
||||
import copy
|
||||
|
||||
from pyrobolearn.simulators import Simulator
|
||||
from pyrobolearn.utils.transformation import get_rpy_from_quaternion, get_matrix_from_quaternion
|
||||
|
||||
# define long for Python 3.x
|
||||
if int(sys.version[0]) == 3:
|
||||
long = int
|
||||
|
||||
|
||||
__author__ = "Brian Delhaisse"
|
||||
__copyright__ = "Copyright 2018, PyRoboLearn"
|
||||
|
||||
@@ -9,7 +9,7 @@ from .bullet import Bullet
|
||||
from .bullet import Bullet as BulletSim # alias # TODO: remove that alias
|
||||
|
||||
# dart simulator
|
||||
from .dart import Dart
|
||||
# from .dart import Dart
|
||||
|
||||
# # PyBullet simulator
|
||||
# import pybullet
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
This includes notably the joint positions, velocities, and force/torque states.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
from pyrobolearn.states.state import State
|
||||
from pyrobolearn.worlds import World
|
||||
from pyrobolearn.robots import Body
|
||||
|
||||
# define long for Python 3.x
|
||||
if int(sys.version[0]) == 3:
|
||||
long = int
|
||||
|
||||
|
||||
__author__ = "Brian Delhaisse"
|
||||
__copyright__ = "Copyright 2018, PyRoboLearn"
|
||||
@@ -49,9 +54,10 @@ class BodyState(State):
|
||||
"""
|
||||
|
||||
super(BodyState, self).__init__(window_size=window_size, axis=axis, ticks=ticks)
|
||||
if not isinstance(body, (Body, int)):
|
||||
raise TypeError("Expecting an instance of Body, or an identifier from the simulator/world.")
|
||||
if isinstance(body, int):
|
||||
if not isinstance(body, (Body, int, long)):
|
||||
raise TypeError("Expecting an instance of Body, or an identifier from the simulator/world, instead got: "
|
||||
"{}".format(type(body)))
|
||||
if isinstance(body, (int, long)):
|
||||
if not isinstance(world, World):
|
||||
# try to look for the world in global variables
|
||||
if 'world' in globals() and isinstance(globals()['world'], World): # O(1)
|
||||
|
||||
Reference in New Issue
Block a user