Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting max_velocity and max_acceleration for arms #237

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rlbench/dataset_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def run(i, lock, task_index, variation_count, results, file_lock, tasks, args):
rlbench_env = Environment(
action_mode=MoveArmThenGripper(JointVelocity(), Discrete()),
obs_config=obs_config,
arm_max_velocity=args.arm_max_velocity,
arm_max_acceleration=args.arm_max_acceleration,
headless=True)
rlbench_env.launch()

Expand Down Expand Up @@ -287,6 +289,8 @@ def parse_args():
parser.add_argument('--processes', type=int, default=1, help='The number of parallel processes during collection.')
parser.add_argument('--episodes_per_task', type=int, default=10, help='The number of episodes to collect per task.')
parser.add_argument('--variations', type=int, default=-1, help='Number of variations to collect per task. -1 for all.')
parser.add_argument('--arm_max_velocity', type=float, default=1.0, help='Max arm velocity used for motion planning.')
parser.add_argument('--arm_max_acceleration', type=float, default=1.0, help='Max arm acceleration used for motion planning.')
return parser.parse_args()


Expand Down
11 changes: 10 additions & 1 deletion rlbench/environment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
from functools import partial
from os.path import exists, dirname, abspath, join
from typing import Type, List

Expand Down Expand Up @@ -38,7 +39,9 @@ def __init__(self,
visual_randomization_config: VisualRandomizationConfig = None,
dynamics_randomization_config: DynamicsRandomizationConfig = None,
attach_grasped_objects: bool = True,
shaped_rewards: bool = False
shaped_rewards: bool = False,
arm_max_velocity: float = 1.0,
arm_max_acceleration: float = 4.0,
):

self._dataset_root = dataset_root
Expand All @@ -54,6 +57,8 @@ def __init__(self,
self._dynamics_randomization_config = dynamics_randomization_config
self._attach_grasped_objects = attach_grasped_objects
self._shaped_rewards = shaped_rewards
self._arm_max_velocity = arm_max_velocity
self._arm_max_acceleration = arm_max_acceleration

if robot_setup not in SUPPORTED_ROBOTS.keys():
raise ValueError('robot_configuration must be one of %s' %
Expand Down Expand Up @@ -97,6 +102,10 @@ def launch(self):

arm_class, gripper_class, _ = SUPPORTED_ROBOTS[
self._robot_setup]
arm_class = partial(
arm_class,
max_velocity=self._arm_max_velocity,
max_acceleration=self._arm_max_acceleration)

# We assume the panda is already loaded in the scene.
if self._robot_setup != 'panda':
Expand Down
Loading