mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-23 13:41:32 +08:00
69 lines
1.7 KiB
Python
69 lines
1.7 KiB
Python
#!/usr/bin/env python
|
|
"""Provide the Morphex robotic platform.
|
|
"""
|
|
|
|
import os
|
|
|
|
from pyrobolearn.robots.legged_robot import HexapodRobot
|
|
|
|
__author__ = "Brian Delhaisse"
|
|
__copyright__ = "Copyright 2018, PyRoboLearn"
|
|
__license__ = "GNU GPLv3"
|
|
__version__ = "1.0.0"
|
|
__maintainer__ = "Brian Delhaisse"
|
|
__email__ = "briandelhaisse@gmail.com"
|
|
__status__ = "Development"
|
|
|
|
|
|
class Morphex(HexapodRobot):
|
|
r"""Morphex Hexapod robot
|
|
|
|
References:
|
|
[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.,
|
|
urdf=os.path.dirname(__file__) + '/urdfs/morphex/morphex.urdf'):
|
|
# check parameters
|
|
if position is None:
|
|
position = (0., 0., 0.2)
|
|
if len(position) == 2: # assume x, y are given
|
|
position = tuple(position) + (0.2,)
|
|
if orientation is None:
|
|
orientation = (0, 0, 0, 1)
|
|
if fixed_base is None:
|
|
fixed_base = False
|
|
|
|
super(Morphex, self).__init__(simulator, urdf, position, orientation, fixed_base, scale)
|
|
self.name = 'morphex'
|
|
|
|
|
|
# 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
|
|
robot = Morphex(sim)
|
|
|
|
# print information about the robot
|
|
robot.print_info()
|
|
|
|
# run simulation
|
|
for i in count():
|
|
# step in simulation
|
|
world.step(sleep_dt=1./240)
|