forked from stepjam/PyRep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* -1 instead of None for making object orphan * init mobile robot support * youBot arm added * added some lua functions for mobile motion planning * added child script to mobile scenes to allow appropriate suffix when multiple instance * base_ref needs to be parent of the robot tree when computing path for collision check * added dubins params for smoother trajectories * updated dummy scene * description example changed * changed args order init * runtimerror when path completed, corrected height target * controller two_wheels distance dependancy added, corrected height target, description info * lowered threshold omni robot * remove output function * Changes to make tests pass. * Refactor of mobile platforms. * Update to youbot model file. * Added packages to setup script. * Gn3112 mobile base (stepjam#24) * added algorithm option to mobile base * added path checking for get_linear mobile base * added comments * docstring corrections * added algorithm arg, correction docstrings * deleted comment * moved waypoint causing test to fail * Fixed bugs in mobiles. Added PID for nonholonomic. Added LoCoBot. * Renaming examples. Joints no longer call get/set config tree. * Model modifications.
- Loading branch information
Showing
46 changed files
with
1,389 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
""" | ||
Facebook/CMU LoCoBot drives to a cube, picks it up, and takes it to a target. | ||
This script contains examples of: | ||
- Linear mobile paths on a non-holonomic platform | ||
- How to use the combination of a mobile base, manipulator, and gripper. | ||
""" | ||
from os.path import dirname, join, abspath | ||
from pyrep import PyRep | ||
from pyrep.robots.mobiles.locobot import LoCoBot | ||
from pyrep.robots.arms.locobot_arm import LoCoBotArm | ||
from pyrep.robots.end_effectors.locobot_gripper import LoCoBotGripper | ||
from pyrep.objects.shape import Shape | ||
from pyrep.objects.dummy import Dummy | ||
|
||
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_locobot_stack_cube.ttt') | ||
pr = PyRep() | ||
pr.launch(SCENE_FILE, headless=False) | ||
pr.start() | ||
|
||
base = LoCoBot() | ||
arm = LoCoBotArm() | ||
gripper = LoCoBotGripper() | ||
|
||
base.set_motor_locked_at_zero_velocity(True) | ||
|
||
|
||
def drive_to_position(position, orientation): | ||
base_path = base.get_linear_path(position, orientation) | ||
base_path.visualize() | ||
done = False | ||
while not done: | ||
done = base_path.step() | ||
pr.step() | ||
pr.step() | ||
|
||
|
||
def move_arm(position, quaternion, ignore_collisions=False): | ||
arm_path = arm.get_path(position, | ||
quaternion=quaternion, | ||
ignore_collisions=ignore_collisions) | ||
arm_path.visualize() | ||
done = False | ||
while not done: | ||
done = arm_path.step() | ||
pr.step() | ||
arm_path.clear_visualization() | ||
|
||
|
||
cuboid = Shape('cuboid') | ||
goal = Shape('goal') | ||
grasp_point = Dummy('grasp_point') | ||
|
||
drive_pos = cuboid.get_position() | ||
drive_pos[1] -= 0.3 | ||
|
||
print('Driving to cube ...') | ||
drive_to_position(drive_pos, 0) | ||
|
||
grasp_point_raised = grasp_point.get_position() | ||
grasp_point_raised[2] += 0.075 | ||
|
||
print('Move arm above cube ...') | ||
move_arm(grasp_point_raised, grasp_point.get_quaternion()) | ||
|
||
print('Arm approach cube ...') | ||
move_arm(grasp_point.get_position(), grasp_point.get_quaternion(), True) | ||
|
||
print('Closing gripper ...') | ||
while not gripper.actuate(0.0, 0.4): | ||
pr.step() | ||
gripper.grasp(cuboid) | ||
|
||
print('Lift cube ...') | ||
move_arm(grasp_point_raised, grasp_point.get_quaternion(), True) | ||
|
||
drive_pos = goal.get_position() | ||
drive_pos[1] -= 0.35 | ||
|
||
print('Driving to goal ...') | ||
drive_to_position(drive_pos, 0) | ||
|
||
goal_point_raised = goal.get_position() | ||
goal_point_raised[2] += 0.05 | ||
|
||
print('Move arm above goal ...') | ||
move_arm(goal_point_raised, grasp_point.get_quaternion()) | ||
|
||
print('Drop cube ...') | ||
gripper.release() | ||
while not gripper.actuate(1.0, 0.4): | ||
pr.step() | ||
|
||
print('Done!') | ||
|
||
pr.stop() | ||
pr.shutdown() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
A turtlebot reaches for 4 randomly places targets. | ||
This script contains examples of: | ||
- Non-linear mobile paths to reach a target with collision avoidance | ||
""" | ||
from os.path import dirname, join, abspath | ||
from pyrep import PyRep | ||
from pyrep.robots.mobiles.turtlebot import TurtleBot | ||
from pyrep.objects.shape import Shape | ||
from pyrep.const import PrimitiveShape | ||
import numpy as np | ||
|
||
LOOPS = 4 | ||
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_turtlebot_navigation.ttt') | ||
pr = PyRep() | ||
pr.launch(SCENE_FILE, headless=False) | ||
pr.start() | ||
agent = TurtleBot() | ||
|
||
# We could have made this target in the scene, but lets create one dynamically | ||
target = Shape.create(type=PrimitiveShape.SPHERE, | ||
size=[0.05, 0.05, 0.05], | ||
color=[1.0, 0.1, 0.1], | ||
static=True, respondable=False) | ||
|
||
position_min, position_max = [-0.5, 1, 0.1], [0.5, 1.5, 0.1] | ||
|
||
starting_pose = agent.get_2d_pose() | ||
|
||
agent.set_motor_locked_at_zero_velocity(True) | ||
|
||
for i in range(LOOPS): | ||
agent.set_2d_pose(starting_pose) | ||
|
||
# Get a random position within a cuboid and set the target position | ||
pos = list(np.random.uniform(position_min, position_max)) | ||
target.set_position(pos) | ||
|
||
path = agent.get_nonlinear_path(position=pos, angle=0) | ||
|
||
path.visualize() | ||
done = False | ||
|
||
while not done: | ||
done = path.step() | ||
pr.step() | ||
|
||
path.clear_visualization() | ||
|
||
print('Reached target %d!' % i) | ||
|
||
pr.stop() | ||
pr.shutdown() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
A Kuka youBot reaches for 4 randomly places targets. | ||
This script contains examples of: | ||
- Linear mobile paths with an omnidirectional robot to reach a target. | ||
""" | ||
from os.path import dirname, join, abspath | ||
from pyrep import PyRep | ||
from pyrep.robots.mobiles.youbot import YouBot | ||
from pyrep.objects.shape import Shape | ||
from pyrep.const import PrimitiveShape | ||
import numpy as np | ||
|
||
LOOPS = 4 | ||
SCENE_FILE = join(dirname(abspath(__file__)), 'scene_youbot_navigation.ttt') | ||
pr = PyRep() | ||
pr.launch(SCENE_FILE, headless=False) | ||
pr.start() | ||
agent = YouBot() | ||
|
||
# We could have made this target in the scene, but lets create one dynamically | ||
target = Shape.create(type=PrimitiveShape.SPHERE, | ||
size=[0.05, 0.05, 0.05], | ||
color=[1.0, 0.1, 0.1], | ||
static=True, respondable=False) | ||
|
||
position_min, position_max = [-0.5, 1.4, 0.1], [1.0, 0.5, 0.1] | ||
|
||
starting_pose = agent.get_2d_pose() | ||
|
||
for i in range(LOOPS): | ||
agent.set_2d_pose(starting_pose) | ||
|
||
# Get a random position within a cuboid and set the target position | ||
pos = list(np.random.uniform(position_min, position_max)) | ||
target.set_position(pos) | ||
|
||
path = agent.get_linear_path(position=pos, angle=0) | ||
|
||
path.visualize() | ||
|
||
done = False | ||
while not done: | ||
done = path.step() | ||
pr.step() | ||
|
||
path.clear_visualization() | ||
|
||
print('Reached target %d!' % i) | ||
|
||
pr.stop() | ||
pr.shutdown() |
File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.