mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-11 12:31:07 +08:00
add 2 examples: attach a gripper to a manipulator, and a manipulator to a quadruped
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
## Robot examples
|
||||
|
||||
More than 60 robots (of various types) are available through `pyrobolearn`.
|
||||
|
||||
Here are the few examples that you can find in this folder:
|
||||
1. `load_robot.py <robot_name>`: load the given robot in the world.
|
||||
2. `visualize_robot.py <robot_name>`: test different visualization tools that can be used on the robot to show its
|
||||
joint axis, bounding boxes, and others.
|
||||
3. `robot_with_sliders.py <robot_name>`: load the given robot in the world and allow you to manipulate the robot's
|
||||
joints with sliders.
|
||||
4. `distribute_epucks.py`: distribute several e-pucks in the world and make them move forward.
|
||||
5. `quadcopter_controller.py`: move a quadcopter in the air using an Xbox or Playstation game controller.
|
||||
6. `robots/<robot>.py`: load the given robot in the simulator by directly instantiating it. Some of these files do
|
||||
more than just loading the robot.
|
||||
|
||||
Notes: to turn the camera in the simulator, keep pressing the `ctrl` key and the left button on the mouse, and
|
||||
move this last one.
|
||||
|
||||
|
||||
#### What to check next?
|
||||
|
||||
Check the `pyrobolearn/examples/interfaces` or `pyrobolearn/examples/kinematics` folder.
|
||||
@@ -0,0 +1,28 @@
|
||||
Robot examples
|
||||
==============
|
||||
|
||||
More than 60 robots (of various types) are available through ``pyrobolearn``.
|
||||
|
||||
Here are the few examples that you can find in this folder:
|
||||
|
||||
1. ``load_robot.py <robot_name>``: load the given robot in the world.
|
||||
2. ``visualize_robot.py <robot_name>``: test different visualization tools that can be used on the robot to show its
|
||||
joint axis, bounding boxes, and others.
|
||||
3. ``robot_with_sliders.py <robot_name>``: load the given robot in the world and allow you to manipulate the robot's
|
||||
joints with sliders.
|
||||
4. ``distribute_epucks.py``: distribute several e-pucks in the world and make them move forward.
|
||||
5. ``quadcopter_controller.py``: move a quadcopter in the air using an Xbox or Playstation game controller.
|
||||
6. ``robots/<robot>.py``: load the given robot in the simulator by directly instantiating it. Some of these files do
|
||||
more than just loading the robot.
|
||||
7. ``attach_gripper_to_manipulator``: attach the specified gripper / hand to the Kuka manipulator robot. In this file,
|
||||
you can check the various grippers you can use.
|
||||
8. ``attach_manipulator_to_quadruped``: attach the Kuka Youbot manipulator to the HyQ2Max quadruped robot.
|
||||
|
||||
Notes: to turn the camera in the simulator, keep pressing the ``ctrl`` key and the left button on the mouse, and
|
||||
move the mouse.
|
||||
|
||||
|
||||
What to check next?
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Check the ``pyrobolearn/examples/interfaces`` or ``pyrobolearn/examples/kinematics`` folder.
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python
|
||||
"""Attach a gripper/hand to the Kuka manipulator.
|
||||
|
||||
In this file, you can attach different grippers / hands to the kuka robot. You can move the robot with the mouse.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
||||
import pyrobolearn as prl
|
||||
|
||||
|
||||
# create parser to select the gripper/hand
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-g', '--gripper', help='the gripper/hand to attach to the kuka robot', type=str,
|
||||
choices=['softhand', 'allegrohand', 'wam_gripper', 'youbot_gripper', 'pr2_gripper', 'jaco_gripper',
|
||||
'fetch_gripper', 'franka_gripper', 'baxter_gripper', 'schunk_hand', 'shadowhand'],
|
||||
default='softhand')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
# create simulator
|
||||
sim = prl.simulators.Bullet()
|
||||
|
||||
# create basic world with floor and gravity
|
||||
world = prl.worlds.BasicWorld(sim)
|
||||
|
||||
# load kuka robot
|
||||
robot = world.load_robot('kuka_iiwa')
|
||||
|
||||
# load hand/gripper
|
||||
hand = world.load_robot(args.gripper, position=(0., 0., 1.5), fixed_base=False)
|
||||
|
||||
# compute parent frame position (this will be removed later and integrated in PRL)
|
||||
parent_frame_position = [0., 0., 0.]
|
||||
if args.gripper == 'shadowhand':
|
||||
parent_frame_position = [0., 0., 0.1]
|
||||
elif args.gripper == 'allegrohand':
|
||||
parent_frame_position = [0., 0., 0.06]
|
||||
elif args.gripper == 'wam_gripper':
|
||||
parent_frame_position = [0., 0., 0.01]
|
||||
elif args.gripper == 'youbot_gripper':
|
||||
parent_frame_position = [0., 0., 0.03]
|
||||
elif args.gripper == 'pr2_gripper':
|
||||
parent_frame_position = [0., 0., 0.002]
|
||||
elif args.gripper == 'jaco_gripper':
|
||||
parent_frame_position = [0., 0., 0.06]
|
||||
elif args.gripper == 'fetch_gripper':
|
||||
parent_frame_position = [0., 0., 0.07]
|
||||
elif args.gripper == 'franka_gripper':
|
||||
parent_frame_position = [0., 0., 0.02]
|
||||
elif args.gripper == 'baxter_gripper':
|
||||
parent_frame_position = [0., 0., -0.03]
|
||||
elif args.gripper == 'schunk_hand':
|
||||
parent_frame_position = [0., 0., 0.002]
|
||||
|
||||
# attach hand/gripper to robot
|
||||
world.attach(body1=robot, body2=hand, link1=robot.end_effectors[0], link2=-1, joint_axis=[0., 0., 0.],
|
||||
parent_frame_position=parent_frame_position, child_frame_position=[0., 0., 0.])
|
||||
|
||||
# set the hand joint positions
|
||||
hand.set_joint_positions([0.] * hand.num_actuated_joints)
|
||||
|
||||
# run simulation
|
||||
for t in prl.count():
|
||||
sim.step(sim.dt)
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python
|
||||
"""Attach the Kuka Youbot manipulator to the HyQ2Max quadruped.
|
||||
"""
|
||||
|
||||
import pyrobolearn as prl
|
||||
|
||||
|
||||
# create simulator
|
||||
sim = prl.simulators.Bullet()
|
||||
|
||||
# create world
|
||||
world = prl.worlds.BasicWorld(sim)
|
||||
|
||||
# create quadruped and manipulator
|
||||
quadruped = world.load_robot('hyq2max')
|
||||
manipulator = world.load_robot('kuka_youbot_arm', position=(0., 0., 1.), fixed_base=False)
|
||||
|
||||
# attach manipulator to the back of the robot
|
||||
world.attach(body1=quadruped, body2=manipulator, link1=-1, link2=-1, joint_axis=[0., 0., 0.],
|
||||
parent_frame_position=[0.25, 0., 0.2], child_frame_position=[0., 0., 0.])
|
||||
|
||||
# run simulation
|
||||
for t in prl.count():
|
||||
sim.step(sim.dt)
|
||||
Reference in New Issue
Block a user