file_path
stringlengths 20
207
| content
stringlengths 5
3.85M
| size
int64 5
3.85M
| lang
stringclasses 9
values | avg_line_length
float64 1.33
100
| max_line_length
int64 4
993
| alphanum_fraction
float64 0.26
0.93
|
---|---|---|---|---|---|---|
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/ur10/rmpflow_suction/ur10_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,717 | YAML | 27.914893 | 76 | 0.616489 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/ur10/rmpflow_suction/ur10_rmpflow_config_cortex.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .03
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .05
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 200.
metric_scalar: 200.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,719 | YAML | 27.93617 | 76 | 0.616771 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/ur10/rmpflow_suction/ur10_robot_description.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot description file defines the generalized coordinates and how to map
# those to the underlying URDF DOFs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF, except when otherwise specified below under
# cspace_urdf_bridge.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
root_link: world
default_q: [-1.57, -1.57, -1.57, -1.57, 1.57, 0]
collision_spheres:
- upper_arm_link:
- center: [0.0, -0.045, 0.01]
radius: 0.1
- center: [0.0, -0.045, 0.06]
radius: 0.09
- center: [0.0, -0.045, 0.12]
radius: 0.06
- center: [0.0, -0.045, 0.18]
radius: 0.06
- center: [0.0, -0.045, 0.24]
radius: 0.06
- center: [0.0, -0.045, 0.3]
radius: 0.06
- center: [0.0, -0.045, 0.36]
radius: 0.06
- center: [0.0, -0.045, 0.42]
radius: 0.06
- center: [0.0, -0.045, 0.48]
radius: 0.06
- center: [0.0, -0.045, 0.54]
radius: 0.06
- center: [0.0, -0.045, 0.6]
radius: 0.08
- forearm_link:
- center: [0.0, 0.0, 0.0]
radius: 0.08
- center: [0.0, 0.0, 0.06]
radius: 0.07
- center: [0.0, 0.0, 0.12]
radius: 0.05
- center: [0.0, 0.0, 0.18]
radius: 0.05
- center: [0.0, 0.0, 0.24]
radius: 0.05
- center: [0.0, 0.0, 0.30]
radius: 0.05
- center: [0.0, 0.0, 0.36]
radius: 0.05
- center: [0.0, 0.0, 0.42]
radius: 0.05
- center: [0.0, 0.0, 0.48]
radius: 0.05
- center: [0.0, 0.0, 0.54]
radius: 0.05
- center: [0.0, 0.0, 0.57]
radius: 0.065
- wrist_1_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.055, 0.0]
radius: 0.05
- center: [0.0, 0.11, 0.0]
radius: 0.065
- wrist_2_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.0, 0.055]
radius: 0.05
- center: [0.0, 0, 0.11]
radius: 0.065
- wrist_3_link:
- center: [0.0, 0.0, 0.0]
radius: 0.045
- center: [0.0, 0.05, 0.0]
radius: 0.05
- ee_link:
- center: [0, 0, 0]
radius: 0.03
- center: [0.027, 0.0, 0.0]
radius: 0.03
- center: [0.054, 0.0, 0.0]
radius: 0.03
- center: [0.081, 0.0, 0.0]
radius: 0.03
- center: [0.108, 0.0, 0.0]
radius: 0.03 | 2,971 | YAML | 27.304762 | 79 | 0.531134 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10/rmpflow/ur10_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,717 | YAML | 27.914893 | 76 | 0.616489 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10/rmpflow/ur10_robot_description.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot description file defines the generalized coordinates and how to map
# those to the underlying URDF DOFs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF, except when otherwise specified below under
# cspace_urdf_bridge.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
root_link: world
subtree_root_link: base_link
default_q: [-1.57, -1.57, -1.57, -1.57, 1.57, 0]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted.
cspace_to_urdf_rules:
# Example:
# - {name: robot_finger_joint1, rule: fixed, value: 0.025}
composite_task_spaces: []
collision_spheres:
- upper_arm_link:
- center: [0.0, -0.045, 0.01]
radius: 0.1
- center: [0.0, -0.045, 0.06]
radius: 0.09
- center: [0.0, -0.045, 0.12]
radius: 0.06
- center: [0.0, -0.045, 0.18]
radius: 0.06
- center: [0.0, -0.045, 0.24]
radius: 0.06
- center: [0.0, -0.045, 0.3]
radius: 0.06
- center: [0.0, -0.045, 0.36]
radius: 0.06
- center: [0.0, -0.045, 0.42]
radius: 0.06
- center: [0.0, -0.045, 0.48]
radius: 0.06
- center: [0.0, -0.045, 0.54]
radius: 0.06
- center: [0.0, -0.045, 0.6]
radius: 0.08
- forearm_link:
- center: [0.0, 0.0, 0.0]
radius: 0.08
- center: [0.0, 0.0, 0.06]
radius: 0.07
- center: [0.0, 0.0, 0.12]
radius: 0.05
- center: [0.0, 0.0, 0.18]
radius: 0.05
- center: [0.0, 0.0, 0.24]
radius: 0.05
- center: [0.0, 0.0, 0.30]
radius: 0.05
- center: [0.0, 0.0, 0.36]
radius: 0.05
- center: [0.0, 0.0, 0.42]
radius: 0.05
- center: [0.0, 0.0, 0.48]
radius: 0.05
- center: [0.0, 0.0, 0.54]
radius: 0.05
- center: [0.0, 0.0, 0.57]
radius: 0.065
- wrist_1_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.055, 0.0]
radius: 0.05
- center: [0.0, 0.11, 0.0]
radius: 0.065
- wrist_2_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.0, 0.055]
radius: 0.05
- center: [0.0, 0, 0.11]
radius: 0.065
- wrist_3_link:
- center: [0.0, 0.0, 0.0]
radius: 0.045
- center: [0.0, 0.05, 0.0]
radius: 0.05
| 3,006 | YAML | 27.638095 | 79 | 0.564205 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10/rmpflow_suction/ur10_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,717 | YAML | 27.914893 | 76 | 0.616489 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10/rmpflow_suction/ur10_rmpflow_config_cortex.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .03
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .05
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 200.
metric_scalar: 200.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,719 | YAML | 27.93617 | 76 | 0.616771 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10/rmpflow_suction/ur10_robot_description.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot description file defines the generalized coordinates and how to map
# those to the underlying URDF DOFs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF, except when otherwise specified below under
# cspace_urdf_bridge.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
root_link: world
subtree_root_link: base_link
default_q: [-1.57, -1.57, -1.57, -1.57, 1.57, 0]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted.
cspace_to_urdf_rules:
# Example:
# - {name: robot_finger_joint1, rule: fixed, value: 0.025}
composite_task_spaces: []
collision_spheres:
- upper_arm_link:
- center: [0.0, -0.045, 0.01]
radius: 0.1
- center: [0.0, -0.045, 0.06]
radius: 0.09
- center: [0.0, -0.045, 0.12]
radius: 0.06
- center: [0.0, -0.045, 0.18]
radius: 0.06
- center: [0.0, -0.045, 0.24]
radius: 0.06
- center: [0.0, -0.045, 0.3]
radius: 0.06
- center: [0.0, -0.045, 0.36]
radius: 0.06
- center: [0.0, -0.045, 0.42]
radius: 0.06
- center: [0.0, -0.045, 0.48]
radius: 0.06
- center: [0.0, -0.045, 0.54]
radius: 0.06
- center: [0.0, -0.045, 0.6]
radius: 0.08
- forearm_link:
- center: [0.0, 0.0, 0.0]
radius: 0.08
- center: [0.0, 0.0, 0.06]
radius: 0.07
- center: [0.0, 0.0, 0.12]
radius: 0.05
- center: [0.0, 0.0, 0.18]
radius: 0.05
- center: [0.0, 0.0, 0.24]
radius: 0.05
- center: [0.0, 0.0, 0.30]
radius: 0.05
- center: [0.0, 0.0, 0.36]
radius: 0.05
- center: [0.0, 0.0, 0.42]
radius: 0.05
- center: [0.0, 0.0, 0.48]
radius: 0.05
- center: [0.0, 0.0, 0.54]
radius: 0.05
- center: [0.0, 0.0, 0.57]
radius: 0.065
- wrist_1_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.055, 0.0]
radius: 0.05
- center: [0.0, 0.11, 0.0]
radius: 0.065
- wrist_2_link:
- center: [0.0, 0.0, 0.0]
radius: 0.05
- center: [0.0, 0.0, 0.055]
radius: 0.05
- center: [0.0, 0, 0.11]
radius: 0.065
- wrist_3_link:
- center: [0.0, 0.0, 0.0]
radius: 0.045
- center: [0.0, 0.05, 0.0]
radius: 0.05
- ee_link:
- center: [0, 0, 0]
radius: 0.03
- center: [0.027, 0.0, 0.0]
radius: 0.03
- center: [0.054, 0.0, 0.0]
radius: 0.03
- center: [0.081, 0.0, 0.0]
radius: 0.03
- center: [0.108, 0.0, 0.0]
radius: 0.03 | 3,285 | YAML | 27.573913 | 79 | 0.551598 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur3/rmpflow/ur3_robot_description.yaml | # The robot description defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
0.0,-1.0,0.9,0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- shoulder_link:
- "center": [-0.0, 0.0, -0.02]
"radius": 0.055
- "center": [0.01, -0.019, -0.0]
"radius": 0.045
- "center": [0.004, -0.007, 0.019]
"radius": 0.05
- upper_arm_link:
- "center": [0.003, 0.002, 0.104]
"radius": 0.052
- "center": [-0.232, 0.002, 0.112]
"radius": 0.043
- "center": [-0.121, -0.001, 0.12]
"radius": 0.042
- "center": [-0.163, 0.002, 0.118]
"radius": 0.041
- "center": [-0.086, 0.001, 0.121]
"radius": 0.041
- "center": [-0.02, 0.014, 0.121]
"radius": 0.041
- "center": [-0.026, -0.019, 0.126]
"radius": 0.035
- "center": [-0.238, 0.0, 0.146]
"radius": 0.04
- forearm_link:
- "center": [-0.013, 0.001, 0.04]
"radius": 0.042
- "center": [-0.214, -0.002, 0.035]
"radius": 0.039
- "center": [-0.171, -0.0, 0.027]
"radius": 0.036
- "center": [-0.083, 0.0, 0.029]
"radius": 0.036
- "center": [0.009, -0.006, 0.054]
"radius": 0.034
- "center": [-0.204, 0.006, 0.003]
"radius": 0.036
- "center": [-0.103, 0.002, 0.028]
"radius": 0.035
- "center": [0.006, 0.01, 0.054]
"radius": 0.034
- "center": [-0.213, 0.005, 0.043]
"radius": 0.037
- "center": [-0.022, -0.002, 0.025]
"radius": 0.033
- "center": [-0.137, 0.001, 0.027]
"radius": 0.036
- "center": [-0.05, 0.0, 0.034]
"radius": 0.039
- wrist_1_link:
- "center": [0.0, -0.009, -0.002]
"radius": 0.041
- "center": [-0.003, 0.019, 0.001]
"radius": 0.037
- "center": [0.006, 0.007, -0.024]
"radius": 0.033
- wrist_2_link:
- "center": [-0.0, 0.0, -0.015]
"radius": 0.041
- "center": [-0.0, 0.012, 0.001]
"radius": 0.039
- "center": [-0.0, -0.018, -0.001]
"radius": 0.04
- wrist_3_link:
- "center": [0.0, 0.002, -0.025]
"radius": 0.035
| 2,844 | YAML | 28.329897 | 80 | 0.549226 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur3/rmpflow/ur3_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.15]
pt2: [0, 0, 0]
radius: .065
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,718 | YAML | 27.925532 | 76 | 0.61663 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur16e/rmpflow/ur16e_robot_description.yaml | # The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
0.0,-1.2,1.1,0.0,0.0,-0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- shoulder_link:
- "center": [0.0, 0.0, 0.01]
"radius": 0.085
- "center": [0.003, -0.022, -0.009]
"radius": 0.082
- "center": [-0.021, -0.041, 0.036]
"radius": 0.064
- upper_arm_link:
- "center": [-0.007, 0.0, 0.177]
"radius": 0.085
- "center": [-0.475, -0.0, 0.176]
"radius": 0.068
- "center": [-0.061, -0.0, 0.176]
"radius": 0.084
- "center": [-0.317, -0.0, 0.176]
"radius": 0.065
- "center": [-0.214, -0.001, 0.174]
"radius": 0.063
- "center": [-0.382, -0.0, 0.176]
"radius": 0.065
- "center": [-0.165, -0.001, 0.175]
"radius": 0.064
- "center": [-0.002, 0.002, 0.188]
"radius": 0.083
- "center": [-0.265, 0.0, 0.174]
"radius": 0.063
- "center": [-0.465, 0.003, 0.034]
"radius": 0.088
- forearm_link:
- "center": [-0.074, -0.0, 0.04]
"radius": 0.068
- "center": [-0.191, 0.0, 0.039]
"radius": 0.063
- "center": [-0.301, 0.0, 0.037]
"radius": 0.058
- "center": [-0.359, -0.001, 0.059]
"radius": 0.055
- "center": [-0.02, 0.003, 0.051]
"radius": 0.058
- "center": [-0.138, -0.0, 0.044]
"radius": 0.065
- "center": [-0.248, 0.001, 0.056]
"radius": 0.059
- "center": [-0.361, 0.004, 0.029]
"radius": 0.052
- wrist_1_link:
- "center": [0.0, 0.005, -0.007]
"radius": 0.056
- "center": [-0.001, -0.02, 0.0]
"radius": 0.055
- wrist_2_link:
- "center": [-0.0, 0.001, -0.0]
"radius": 0.056
- "center": [-0.0, 0.021, 0.0]
"radius": 0.055
- "center": [-0.004, -0.011, -0.011]
"radius": 0.053
- wrist_3_link:
- "center": [-0.016, 0.002, -0.025]
"radius": 0.034
- "center": [0.016, -0.011, -0.024]
"radius": 0.034
- "center": [0.009, 0.018, -0.025]
"radius": 0.034
| 2,786 | YAML | 28.336842 | 79 | 0.548816 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur16e/rmpflow/ur16e_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,717 | YAML | 27.914893 | 76 | 0.616489 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur3e/rmpflow/ur3e_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.15]
pt2: [0, 0, 0]
radius: .065
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,718 | YAML | 27.925532 | 76 | 0.61663 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur3e/rmpflow/ur3e_robot_description.yaml | # The robot description defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
0.0,-1.0,0.9,0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- shoulder_link:
- "center": [-0.0, 0.0, -0.02]
"radius": 0.055
- "center": [0.01, -0.019, -0.0]
"radius": 0.045
- "center": [0.004, -0.007, 0.019]
"radius": 0.05
- wrist_1_link:
- "center": [0.0, -0.009, -0.002]
"radius": 0.041
- "center": [-0.003, 0.019, 0.001]
"radius": 0.037
- "center": [0.006, 0.007, -0.024]
"radius": 0.033
- wrist_2_link:
- "center": [-0.0, 0.0, -0.015]
"radius": 0.041
- "center": [-0.0, 0.012, 0.001]
"radius": 0.039
- "center": [-0.0, -0.018, -0.001]
"radius": 0.04
- wrist_3_link:
- "center": [0.0, 0.002, -0.025]
"radius": 0.035
- upper_arm_link:
- "center": [-0.008, 0.0, 0.127]
"radius": 0.056
- "center": [-0.091, 0.0, 0.127]
"radius": 0.054
- "center": [-0.174, -0.0, 0.13]
"radius": 0.051
- "center": [-0.242, -0.0, 0.106]
"radius": 0.048
- "center": [-0.15, 0.0, 0.105]
"radius": 0.051
- "center": [0.0, 0.0, 0.11]
"radius": 0.056
- "center": [-0.245, 0.005, 0.143]
"radius": 0.043
- "center": [-0.058, -0.002, 0.105]
"radius": 0.052
- "center": [-0.055, 0.001, 0.132]
"radius": 0.055
- "center": [-0.14, 0.0, 0.133]
"radius": 0.052
- forearm_link:
- "center": [-0.084, -0.0, 0.033]
"radius": 0.044
- "center": [-0.157, -0.0, 0.035]
"radius": 0.043
- "center": [-0.008, -0.0, 0.053]
"radius": 0.043
- "center": [-0.213, 0.0, 0.074]
"radius": 0.042
- "center": [-0.213, -0.0, 0.021]
"radius": 0.042
- "center": [-0.13, -0.0, 0.022]
"radius": 0.044
- "center": [-0.003, -0.003, 0.041]
"radius": 0.037
- "center": [-0.118, 0.001, 0.039]
"radius": 0.044
- "center": [-0.059, -0.001, 0.037]
"radius": 0.044
- "center": [-0.168, -0.0, 0.016]
"radius": 0.043
| 2,830 | YAML | 28.185567 | 80 | 0.544523 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10e/rmpflow/ur10e_robot_description.yaml | # The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
-0.0,-1.2,1.1,0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- shoulder_link:
- "center": [0.0, 0.0, 0.01]
"radius": 0.085
- "center": [0.003, -0.022, -0.009]
"radius": 0.082
- upper_arm_link:
- "center": [-0.031, 0.0, 0.176]
"radius": 0.084
- "center": [-0.589, 0.0, 0.177]
"radius": 0.068
- "center": [-0.418, -0.0, 0.176]
"radius": 0.064
- "center": [-0.224, -0.0, 0.176]
"radius": 0.064
- "center": [-0.309, 0.002, 0.176]
"radius": 0.063
- "center": [-0.14, -0.001, 0.177]
"radius": 0.064
- "center": [-0.516, 0.0, 0.176]
"radius": 0.064
- "center": [0.008, -0.001, 0.184]
"radius": 0.077
- "center": [-0.617, -0.002, 0.167]
"radius": 0.063
- "center": [-0.068, -0.005, 0.179]
"radius": 0.079
- forearm_link:
- "center": [-0.056, -0.0, 0.04]
"radius": 0.067
- "center": [-0.182, -0.0, 0.038]
"radius": 0.065
- "center": [-0.317, -0.0, 0.024]
"radius": 0.062
- "center": [-0.429, 0.0, 0.029]
"radius": 0.059
- "center": [-0.566, 0.0, 0.056]
"radius": 0.057
- "center": [-0.256, 0.0, 0.024]
"radius": 0.064
- "center": [-0.565, -0.001, 0.029]
"radius": 0.057
- "center": [-0.106, 0.0, 0.044]
"radius": 0.067
- "center": [-0.378, -0.0, 0.025]
"radius": 0.061
- "center": [-0.017, 0.007, 0.053]
"radius": 0.057
- "center": [-0.52, -0.001, 0.029]
"radius": 0.058
- "center": [-0.475, -0.0, 0.029]
"radius": 0.059
- "center": [-0.0, 0.005, 0.119]
"radius": 0.06
- wrist_1_link:
- "center": [0.0, 0.005, -0.007]
"radius": 0.056
- "center": [-0.001, -0.02, 0.0]
"radius": 0.055
- wrist_2_link:
- "center": [-0.0, 0.001, -0.0]
"radius": 0.056
- "center": [-0.0, 0.021, 0.0]
"radius": 0.055
- "center": [-0.004, -0.011, -0.011]
"radius": 0.053
- wrist_3_link:
- "center": [-0.016, 0.002, -0.025]
"radius": 0.034
- "center": [0.016, -0.011, -0.024]
"radius": 0.034
- "center": [0.009, 0.018, -0.025]
"radius": 0.034
| 3,020 | YAML | 28.330097 | 79 | 0.539404 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur10e/rmpflow/ur10e_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.22]
pt2: [0, 0, 0]
radius: .09
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,717 | YAML | 27.914893 | 76 | 0.616489 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur5e/rmpflow/ur5e_robot_description.yaml | # The robot description defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
0.0,-1.0,0.9,0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- wrist_1_link:
- "center": [-0.0, 0.027, -0.002]
"radius": 0.041
- "center": [-0.003, -0.032, 0.001]
"radius": 0.037
- "center": [-0.002, -0.003, -0.0]
"radius": 0.039
- "center": [-0.0, 0.0, -0.058]
"radius": 0.045
- wrist_2_link:
- "center": [-0.0, 0.0, -0.015]
"radius": 0.041
- "center": [0.0, 0.018, 0.001]
"radius": 0.039
- "center": [0.0, -0.033, -0.001]
"radius": 0.04
- wrist_3_link:
- "center": [-0.001, 0.002, -0.025]
"radius": 0.038
- shoulder_link:
- "center": [-0.006, -0.012, 0.027]
"radius": 0.059
- "center": [0.011, 0.007, -0.048]
"radius": 0.055
- "center": [0.018, -0.031, -0.001]
"radius": 0.05
- upper_arm_link:
- "center": [-0.183, 0.0, 0.15]
"radius": 0.069
- "center": [-0.344, 0.0, 0.126]
"radius": 0.069
- "center": [-0.03, 0.0, 0.146]
"radius": 0.069
- "center": [-0.425, 0.0, 0.142]
"radius": 0.069
- "center": [-0.27, -0.001, 0.151]
"radius": 0.069
- "center": [-0.11, 0.0, 0.137]
"radius": 0.069
- "center": [0.001, -0.0, 0.135]
"radius": 0.068
- "center": [-0.226, -0.001, 0.123]
"radius": 0.068
- "center": [-0.426, -0.001, 0.118]
"radius": 0.067
- "center": [-0.359, 0.005, 0.155]
"radius": 0.064
- "center": [-0.307, 0.0, 0.121]
"radius": 0.069
- "center": [-0.156, -0.0, 0.129]
"radius": 0.069
- "center": [-0.123, -0.001, 0.151]
"radius": 0.068
- "center": [-0.064, 0.005, 0.125]
"radius": 0.064
- forearm_link:
- "center": [-0.005, 0.001, 0.048]
"radius": 0.059
- "center": [-0.317, 0.0, -0.001]
"radius": 0.053
- "center": [-0.386, -0.0, 0.021]
"radius": 0.049
- "center": [-0.01, 0.001, 0.018]
"radius": 0.052
- "center": [-0.268, 0.0, -0.001]
"radius": 0.054
- "center": [-0.034, -0.0, 0.014]
"radius": 0.058
- "center": [-0.393, 0.001, -0.019]
"radius": 0.047
- "center": [-0.326, -0.009, 0.028]
"radius": 0.042
- "center": [-0.342, 0.0, -0.008]
"radius": 0.051
- "center": [0.031, -0.009, 0.037]
"radius": 0.033
- "center": [-0.222, 0.0, 0.002]
"radius": 0.055
- "center": [-0.176, 0.0, 0.005]
"radius": 0.055
- "center": [-0.129, 0.0, 0.008]
"radius": 0.056
- "center": [-0.082, 0.0, 0.011]
"radius": 0.057
| 3,384 | YAML | 28.434782 | 80 | 0.529846 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur5e/rmpflow/ur5e_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.15]
pt2: [0, 0, 0]
radius: .065
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,718 | YAML | 27.925532 | 76 | 0.61663 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur5/rmpflow/ur5_robot_description.yaml | # The robot description defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- shoulder_pan_joint
- shoulder_lift_joint
- elbow_joint
- wrist_1_joint
- wrist_2_joint
- wrist_3_joint
default_q: [
0.0,-1.0,0.9,0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- wrist_1_link:
- "center": [-0.0, 0.027, -0.002]
"radius": 0.041
- "center": [-0.003, -0.032, 0.001]
"radius": 0.037
- "center": [-0.002, -0.003, -0.0]
"radius": 0.039
- wrist_2_link:
- "center": [-0.0, 0.0, -0.015]
"radius": 0.041
- "center": [0.0, 0.018, 0.001]
"radius": 0.039
- "center": [0.0, -0.033, -0.001]
"radius": 0.04
- wrist_3_link:
- "center": [0.0, 0.002, -0.025]
"radius": 0.035
- shoulder_link:
- "center": [-0.006, -0.012, 0.027]
"radius": 0.059
- "center": [0.011, 0.007, -0.048]
"radius": 0.055
- "center": [0.018, -0.031, -0.001]
"radius": 0.05
- upper_arm_link:
- "center": [-0.41, -0.001, 0.121]
"radius": 0.06
- "center": [-0.201, 0.0, 0.136]
"radius": 0.059
- "center": [-0.016, 0.0, 0.121]
"radius": 0.06
- "center": [-0.306, -0.0, 0.135]
"radius": 0.059
- "center": [-0.122, -0.0, 0.135]
"radius": 0.059
- "center": [-0.006, 0.004, 0.162]
"radius": 0.052
- "center": [-0.272, -0.0, 0.136]
"radius": 0.059
- "center": [-0.429, 0.006, 0.173]
"radius": 0.052
- "center": [-0.388, -0.015, 0.15]
"radius": 0.043
- "center": [-0.028, -0.02, 0.142]
"radius": 0.047
- "center": [-0.152, 0.0, 0.136]
"radius": 0.059
- "center": [-0.387, 0.025, 0.145]
"radius": 0.042
- "center": [-0.236, 0.0, 0.136]
"radius": 0.059
- "center": [-0.35, 0.013, 0.14]
"radius": 0.05
- "center": [-0.062, 0.002, 0.149]
"radius": 0.055
- forearm_link:
- "center": [-0.021, 0.0, 0.026]
"radius": 0.053
- "center": [-0.177, 0.0, 0.016]
"radius": 0.047
- "center": [-0.27, -0.0, 0.017]
"radius": 0.047
- "center": [-0.392, 0.003, 0.039]
"radius": 0.044
- "center": [-0.114, 0.002, 0.019]
"radius": 0.044
- "center": [-0.31, 0.0, 0.017]
"radius": 0.046
- "center": [0.02, -0.001, 0.039]
"radius": 0.042
- "center": [-0.202, 0.001, 0.017]
"radius": 0.046
- "center": [-0.392, 0.003, -0.006]
"radius": 0.04
- "center": [-0.035, 0.0, 0.018]
"radius": 0.049
- "center": [0.008, 0.02, 0.039]
"radius": 0.041
- "center": [0.01, -0.029, 0.045]
"radius": 0.035
- "center": [-0.134, -0.001, 0.017]
"radius": 0.046
- "center": [-0.252, 0.0, 0.016]
"radius": 0.047
- "center": [-0.075, 0.001, 0.019]
"radius": 0.046
- "center": [-0.348, 0.002, 0.022]
"radius": 0.045
| 3,501 | YAML | 28.428571 | 80 | 0.52842 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/universal_robots/ur5/rmpflow/ur5_rmpflow_config.yaml | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
api_version: 1.0
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 80.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 2.15
velocity_damping_region: 0.5
damping_gain: 300.
metric_weight: 100.
target_rmp:
accel_p_gain: 80.
accel_d_gain: 120.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000.
min_metric_scalar: 2500.
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 200.
accel_d_gain: 40.
metric_scalar: 10.
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .05
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 1200.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0, 0, 0.15]
pt2: [0, 0, 0]
radius: .065
body_collision_controllers:
- name: wrist_2_link
radius: .04
- name: wrist_3_link
radius: .04
- name: tool0
radius: .04
| 2,718 | YAML | 27.925532 | 76 | 0.61663 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Flexiv/rizon4/rmpflow/flexiv_rizon4_robot_description.yaml | # The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6
- joint7
default_q: [
0.0,-0.5,0.0002,0.5,-0.0,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- link1:
- "center": [-0.002, -0.002, 0.071]
"radius": 0.069
- "center": [-0.004, -0.011, 0.173]
"radius": 0.062
- "center": [0.003, -0.015, 0.22]
"radius": 0.058
- "center": [-0.002, -0.006, 0.113]
"radius": 0.067
- link2:
- "center": [0.001, 0.036, 0.126]
"radius": 0.061
- "center": [0.005, 0.041, 0.031]
"radius": 0.058
- "center": [-0.007, 0.042, -0.008]
"radius": 0.056
- "center": [-0.004, 0.035, 0.151]
"radius": 0.059
- link3:
- "center": [-0.005, 0.002, 0.06]
"radius": 0.059
- "center": [-0.012, 0.008, 0.144]
"radius": 0.055
- "center": [-0.018, 0.012, 0.197]
"radius": 0.052
- "center": [-0.01, 0.005, 0.105]
"radius": 0.057
- link4:
- "center": [-0.018, 0.026, 0.139]
"radius": 0.06
- "center": [-0.003, 0.034, 0.039]
"radius": 0.056
- "center": [-0.006, 0.038, 0.001]
"radius": 0.054
- "center": [-0.013, 0.029, 0.096]
"radius": 0.058
- link5:
- "center": [0.001, -0.003, 0.069]
"radius": 0.058
- "center": [0.003, -0.01, 0.169]
"radius": 0.054
- "center": [-0.003, -0.006, 0.112]
"radius": 0.057
- "center": [-0.0, -0.012, 0.195]
"radius": 0.052
- "center": [0.0, 0.0, 0.0]
"radius": 0.06
- link6:
- "center": [0.014, 0.069, 0.107]
"radius": 0.06
- "center": [0.002, 0.049, 0.035]
"radius": 0.059
- "center": [-0.001, 0.043, -0.005]
"radius": 0.053
- "center": [-0.001, 0.067, 0.106]
"radius": 0.059
- link7:
- "center": [-0.005, -0.006, 0.041]
"radius": 0.05
- "center": [0.009, 0.002, 0.041]
"radius": 0.05
- "center": [0.0, 0.0, 0.0]
"radius": 0.05
| 2,661 | YAML | 27.021052 | 79 | 0.547914 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Flexiv/rizon4/rmpflow/rizon4_rmpflow_config.yaml | # Artificially limit the robot joints. For example:
# A joint with range +-pi would be limited to +-(pi-.01)
joint_limit_buffers: [.01, .01, .01, .01, .01, .01, .01]
# RMPflow has many modifiable parameters, but these serve as a great start.
# Most parameters will not need to be modified
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 4.
velocity_damping_region: 1.5
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
# body_cylinders are used to promote self-collision avoidance between the robot and its base
# The example below defines the robot base to be a capsule defined by the absolute coordinates pt1 and pt2.
# The semantic name provided for each body_cylinder does not need to be present in the robot URDF.
body_cylinders:
- name: base_link
pt1: [0,0,.333]
pt2: [0,0,0.]
radius: .07
# body_collision_controllers defines spheres located at specified frames in the robot URDF
# These spheres will not be allowed to collide with the capsules enumerated under body_cylinders
# By design, most frames in industrial robots are kinematically unable to collide with the robot base.
# It is often only necessary to define body_collision_controllers near the end effector
body_collision_controllers:
- name: flange
radius: .05 | 3,202 | YAML | 33.074468 | 107 | 0.641162 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Denso/cobotta_pro_900/rmpflow/robot_descriptor.yaml | # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# RMPflow will only use these joints to control the robot position.
cspace:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
# Global frame of the URDF
root_link: world
# The default cspace position of this robot
default_q: [
0.0,0.3,1.2,0.0,0.0,0.0
]
# RMPflow uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, RMPflow will
# not be able to avoid obstacles.
collision_spheres:
- J1:
- "center": [0.0, 0.0, 0.1]
"radius": 0.08
- "center": [0.0, 0.0, 0.15]
"radius": 0.08
- "center": [0.0, 0.0, 0.2]
"radius": 0.08
- J2:
- "center": [0.0, 0.08, 0.0]
"radius": 0.08
- "center": [0.0, 0.16, 0.0]
"radius": 0.08
- "center": [0.0, 0.175, 0.05]
"radius": 0.065
- "center": [0.0, 0.175, 0.1]
"radius": 0.065
- "center": [0.0, 0.175, 0.15]
"radius": 0.065
- "center": [0.0, 0.175, 0.2]
"radius": 0.065
- "center": [0.0, 0.175, 0.25]
"radius": 0.065
- "center": [0.0, 0.175, 0.3]
"radius": 0.065
- "center": [0.0, 0.175, 0.35]
"radius": 0.065
- "center": [0.0, 0.175, 0.4]
"radius": 0.065
- "center": [0.0, 0.175, 0.45]
"radius": 0.065
- "center": [0.0, 0.175, 0.5]
"radius": 0.065
- "center": [0.0, 0.1, 0.5]
"radius": 0.07
- J3:
- "center": [0.0, 0.025, 0]
"radius": 0.065
- "center": [0.0, -0.025, 0]
"radius": 0.065
- "center": [0.0, -0.025, 0.05]
"radius": 0.065
- "center": [0.0, -0.025, 0.1]
"radius": 0.065
- "center": [0.0, -0.025, 0.15]
"radius": 0.06
- "center": [0.0, -0.025, 0.2]
"radius": 0.06
- "center": [0.0, -0.025, 0.25]
"radius": 0.06
- "center": [0.0, -0.025, 0.3]
"radius": 0.06
- "center": [0.0, -0.025, 0.35]
"radius": 0.055
- "center": [0.0, -0.025, 0.4]
"radius": 0.055
- J5:
- "center": [0.0, 0.05, 0]
"radius": 0.055
- "center": [0.0, 0.1, 0]
"radius": 0.055
- J6:
- "center": [0.0, 0.0, -0.05]
"radius": 0.05
- "center": [0.0, 0.0, -0.1]
"radius": 0.05
- "center": [0.0, 0.0, -0.15]
"radius": 0.05
- "center": [0.0, 0.0, 0.04]
"radius": 0.035
- "center": [0.0, 0.0, 0.08]
"radius": 0.035
- "center": [0.0, 0.0, 0.12]
"radius": 0.035
- right_inner_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.02
- "center": [0.0, -0.03, 0.025]
"radius": 0.02
- "center": [0.0, -0.05, 0.05]
"radius": 0.02
- right_inner_finger:
- "center": [0.0, 0.02, 0.0]
"radius": 0.015
- "center": [0.0, 0.02, 0.015]
"radius": 0.015
- "center": [0.0, 0.02, 0.03]
"radius": 0.015
- "center": [0.0, 0.025, 0.04]
"radius": 0.01
- left_inner_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.02
- "center": [0.0, -0.03, 0.025]
"radius": 0.02
- "center": [0.0, -0.05, 0.05]
"radius": 0.02
- left_inner_finger:
- "center": [0.0, 0.02, 0.0]
"radius": 0.015
- "center": [0.0, 0.02, 0.015]
"radius": 0.015
- "center": [0.0, 0.02, 0.03]
"radius": 0.015
- "center": [0.0, 0.025, 0.04]
"radius": 0.01 | 3,988 | YAML | 26.701389 | 80 | 0.522818 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Denso/cobotta_pro_900/rmpflow/cobotta_rmpflow_common.yaml | # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# Artificially limit the robot joints. For example:
# A joint with range +-pi would be limited to +-(pi-.01)
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
# RMPflow has many modifiable parameters, but these serve as a great start.
# Most parameters will not need to be modified
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 30.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
# body_cylinders are used to promote self-collision avoidance between the robot and its base
# The example below defines the robot base to be a capsule defined by the absolute coordinates pt1 and pt2.
# The semantic name provided for each body_cylinder does not need to be present in the robot URDF.
body_cylinders:
- name: base
pt1: [0,0,.12]
pt2: [0,0,0.]
radius: .08
- name: second_link
pt1: [0,0,.12]
pt2: [0,0,.12]
radius: .16
# body_collision_controllers defines spheres located at specified frames in the robot URDF
# These spheres will not be allowed to collide with the capsules enumerated under body_cylinders
# By design, most frames in industrial robots are kinematically unable to collide with the robot base.
# It is often only necessary to define body_collision_controllers near the end effector
body_collision_controllers:
- name: J5
radius: .05
- name: J6
radius: .05
- name: right_inner_finger
radius: .02
- name: left_inner_finger
radius: .02
- name: right_inner_knuckle
radius: .02
- name: left_inner_knuckle
radius: .02
| 3,947 | YAML | 32.743589 | 107 | 0.64682 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Denso/cobotta_pro_1300/rmpflow/robot_descriptor.yaml | # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# RMPflow will only use these joints to control the robot position.
cspace:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
# Global frame of the URDF
root_link: world
# The default cspace position of this robot
default_q: [
0.0,0.3,1.2,0.0,0.0,0.0
]
# RMPflow uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, RMPflow will
# not be able to avoid obstacles.
collision_spheres:
- J1:
- "center": [0.0, 0.0, 0.1]
"radius": 0.09
- "center": [0.0, 0.0, 0.15]
"radius": 0.09
- "center": [0.0, 0.0, 0.2]
"radius": 0.09
- J2:
- "center": [0.0, 0.08, 0.0]
"radius": 0.09
- "center": [0.0, 0.16, 0.0]
"radius": 0.09
- "center": [0.0, 0.2, 0.0]
"radius": 0.09
- "center": [0.0, 0.197, 0.05]
"radius": 0.08
- "center": [0.0, 0.195, 0.1]
"radius": 0.08
- "center": [0.0, 0.192, 0.15]
"radius": 0.08
- "center": [0.0, 0.19, 0.2]
"radius": 0.065
- "center": [0.0, 0.187, 0.25]
"radius": 0.065
- "center": [0.0, 0.185, 0.3]
"radius": 0.065
- "center": [0.0, 0.182, 0.35]
"radius": 0.065
- "center": [0.0, 0.18, 0.4]
"radius": 0.065
- "center": [0.0, 0.177, 0.45]
"radius": 0.065
- "center": [0.0, 0.175, 0.5]
"radius": 0.065
- "center": [0.0, 0.174, 0.55]
"radius": 0.065
- "center": [0.0, 0.173, 0.6]
"radius": 0.065
- "center": [0.0, 0.172, 0.65]
"radius": 0.075
- "center": [0.0, 0.16, 0.7]
"radius": 0.075
- J3:
- "center": [0.0, 0.025, 0]
"radius": 0.075
- "center": [0.0, -0.045, 0]
"radius": 0.065
- "center": [0.0, -0.045, 0.05]
"radius": 0.065
- "center": [0.0, -0.045, 0.1]
"radius": 0.065
- "center": [0.0, -0.045, 0.15]
"radius": 0.06
- "center": [0.0, -0.045, 0.2]
"radius": 0.06
- "center": [0.0, -0.045, 0.25]
"radius": 0.06
- "center": [0.0, -0.045, 0.3]
"radius": 0.06
- "center": [0.0, -0.045, 0.35]
"radius": 0.055
- "center": [0.0, -0.05, 0.4]
"radius": 0.055
- "center": [0.0, -0.05, 0.45]
"radius": 0.055
- "center": [0.0, -0.05, 0.5]
"radius": 0.055
- "center": [0.0, -0.05, 0.55]
"radius": 0.055
- "center": [0.0, -0.05, 0.59]
"radius": 0.055
- J5:
- "center": [0.0, 0.05, 0]
"radius": 0.055
- "center": [0.0, 0.1, 0]
"radius": 0.055
- J6:
- "center": [0.0, 0.0, -0.05]
"radius": 0.05
- "center": [0.0, 0.0, -0.1]
"radius": 0.05
- "center": [0.0, 0.0, -0.15]
"radius": 0.05
- "center": [0.0, 0.0, 0.04]
"radius": 0.035
- "center": [0.0, 0.0, 0.08]
"radius": 0.035
- "center": [0.0, 0.0, 0.12]
"radius": 0.035
- right_inner_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.02
- "center": [0.0, -0.03, 0.025]
"radius": 0.02
- "center": [0.0, -0.05, 0.05]
"radius": 0.02
- right_inner_finger:
- "center": [0.0, 0.02, 0.0]
"radius": 0.015
- "center": [0.0, 0.02, 0.015]
"radius": 0.015
- "center": [0.0, 0.02, 0.03]
"radius": 0.015
- "center": [0.0, 0.025, 0.04]
"radius": 0.01
- left_inner_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.02
- "center": [0.0, -0.03, 0.025]
"radius": 0.02
- "center": [0.0, -0.05, 0.05]
"radius": 0.02
- left_inner_finger:
- "center": [0.0, 0.02, 0.0]
"radius": 0.015
- "center": [0.0, 0.02, 0.015]
"radius": 0.015
- "center": [0.0, 0.02, 0.03]
"radius": 0.015
- "center": [0.0, 0.025, 0.04]
"radius": 0.01
| 4,439 | YAML | 26.407407 | 80 | 0.511602 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Denso/cobotta_pro_1300/rmpflow/cobotta_rmpflow_common.yaml | # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# Artificially limit the robot joints. For example:
# A joint with range +-pi would be limited to +-(pi-.01)
joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
# RMPflow has many modifiable parameters, but these serve as a great start.
# Most parameters will not need to be modified
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 30.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
# body_cylinders are used to promote self-collision avoidance between the robot and its base
# The example below defines the robot base to be a capsule defined by the absolute coordinates pt1 and pt2.
# The semantic name provided for each body_cylinder does not need to be present in the robot URDF.
body_cylinders:
- name: base
pt1: [0,0,.12]
pt2: [0,0,0.]
radius: .09
- name: second_link
pt1: [0,0,.1]
pt2: [0,0,.1]
radius: .2
# body_collision_controllers defines spheres located at specified frames in the robot URDF
# These spheres will not be allowed to collide with the capsules enumerated under body_cylinders
# By design, most frames in industrial robots are kinematically unable to collide with the robot base.
# It is often only necessary to define body_collision_controllers near the end effector
body_collision_controllers:
- name: J5
radius: .05
- name: J6
radius: .05
- name: right_inner_finger
radius: .02
- name: left_inner_finger
radius: .02
- name: right_inner_knuckle
radius: .02
- name: left_inner_knuckle
radius: .02
| 3,944 | YAML | 32.717948 | 107 | 0.646552 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/dofbot/rmpflow/robot_descriptor.yaml | # Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
# The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF, except when otherwise specified below under
# cspace_urdf_bridge
cspace:
- joint1
- joint2
- joint3
- joint4
root_link: base_link
default_q: [
0.00, 0.00, 0.00, 0.00
] | 861 | YAML | 30.925925 | 79 | 0.765389 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/dofbot/rmpflow/dofbot_rmpflow_common.yaml | # Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
joint_limit_buffers: [.01, .01, .01, .01]
# Note: metric_weight and metric_scalar mean the same thing. Set to zero to turn it off.
rmp_params:
cspace_target_rmp:
metric_scalar: 50.
position_gain: 100.
damping_gain: 50.
robust_position_term_thresh: .5
inertia: 0.
cspace_trajectory_rmp: # Note: unused
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp: # Note: unused
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp: # Note: Less important
max_velocity: 4. # max_xd
velocity_damping_region: 1.5
damping_gain: 1000.0
metric_weight: 0.
target_rmp:
accel_p_gain: 100.
accel_d_gain: 400.
accel_norm_eps: .025
# TODO: meters
metric_alpha_length_scale: .001
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
# TODO: meters
proximity_metric_boost_length_scale: .0025
xi_estimator_gate_std_dev: 20000. # unused
accept_user_weights: false # Values >= .5 are true and < .5 are false
axis_target_rmp: # Note: Won't be used for end effector position control
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
# TODO: meters
proximity_metric_boost_length_scale: .01
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp: # Note import if no obstacles
damping_gain: 50.
# TODO: meters
damping_std_dev: .005
damping_robustness_eps: 1e-2
# TODO: meters
damping_velocity_gate_length_scale: .001
repulsion_gain: 800.
# TODO: meters
repulsion_std_dev: .001
# TODO: meters
metric_modulation_radius: .05
metric_scalar: 10000. # Real value should be this.
#metric_scalar: 0. # Turns off collision avoidance.
# TODO: meters
metric_exploder_std_dev: .0025
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 0.
canonical_resolve:
max_acceleration_norm: 50. # TODO: try setting much larger
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_stem
pt1: [0,0,.333]
pt2: [0,0,0.]
radius: .05
body_collision_controllers:
- name: link5
radius: .08
| 3,309 | YAML | 30.826923 | 88 | 0.618918 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/README.md | The Kawasaki RS robot URDF files have all been modified such that the +X axis lies in front of the robot to fit with Isaac Sim convention. This corresponds to the same change in each URDF:
<joint name="world2base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
<origin rpy="0 0 -1.5707963267948966" xyz="0 0 0"/>
</joint>
from the original
<joint name="world2base" type="fixed">
<parent link="world"/>
<child link="base_link"/>
<origin rpy="0 0 0" xyz="0 0 0"/>
</joint>.
The URDFs have also been modified to include a new frame in the center of the robot gripper called "gripper_center". The following has been added at the bottom of each URDF:
<link name="gripper_center"/>
<joint name="gripper_center_joint" type="fixed">
<origin rpy="0 0 0" xyz="0.0 0.0 .2"/>
<parent link="onrobot_rg2_base_link"/>
<child link="gripper_center"/>
</joint>
These modified URDF files were used to generate the Kawasaki RS USD files that are stored on the Nucleus Isaac Sim server. | 1,031 | Markdown | 37.222221 | 189 | 0.695441 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs013n/rmpflow/rs013n_rmpflow_config.yaml | joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 100.
position_gain: 200.
damping_gain: 100.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0,0,.6]
pt2: [0,0,0.]
radius: .18
body_collision_controllers:
- name: onrobot_rg2_base_link
radius: .05
- name: link5
radius: .07
| 2,324 | YAML | 28.0625 | 51 | 0.582186 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs007l/rmpflow/rs007l_robot_description.yaml | # The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6
default_q: [
0.0,-0.2,-1.7,-1.507,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
- {name: finger_joint, rule: fixed, value: -0.0}
- {name: left_inner_knuckle_joint, rule: fixed, value: 0.0}
- {name: right_inner_knuckle_joint, rule: fixed, value: -0.0}
- {name: right_outer_knuckle_joint, rule: fixed, value: 0.0}
- {name: left_inner_finger_joint, rule: fixed, value: -0.0}
- {name: right_inner_finger_joint, rule: fixed, value: 0.0}
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- link1:
- "center": [-0.031, 0.0, -0.07]
"radius": 0.083
- "center": [-0.013, -0.001, -0.007]
"radius": 0.077
- "center": [-0.079, -0.0, -0.051]
"radius": 0.078
- link2:
- "center": [0.031, -0.009, -0.106]
"radius": 0.061
- "center": [0.103, 0.001, -0.117]
"radius": 0.059
- "center": [0.267, -0.001, -0.119]
"radius": 0.054
- "center": [0.191, 0.0, -0.121]
"radius": 0.054
- "center": [0.351, 0.003, -0.116]
"radius": 0.051
- "center": [-0.019, 0.004, -0.101]
"radius": 0.056
- "center": [0.47, 0.013, -0.105]
"radius": 0.044
- "center": [0.4, 0.011, -0.113]
"radius": 0.048
- link3:
- "center": [0.004, -0.0, 0.011]
"radius": 0.105
- link4:
- "center": [0.0, 0.0, 0.0]
"radius": 0.05
- "center": [0.001, -0.001, 0.125]
"radius": 0.05
- "center": [0.0, -0.0, 0.042]
"radius": 0.05
- "center": [0.001, -0.001, 0.084]
"radius": 0.05
- "center": [0.0, -0.0, 0.372]
"radius": 0.065
- "center": [0.0, -0.0, 0.162]
"radius": 0.065
- "center": [0.0, -0.0, 0.318]
"radius": 0.064
- "center": [0.0, -0.0, 0.265]
"radius": 0.065
- "center": [0.0, -0.0, 0.213]
"radius": 0.065
- link5:
- "center": [0.04, 0.0, 0.0]
"radius": 0.041
- onrobot_rg2_base_link:
- "center": [0.0, 0.001, 0.04]
"radius": 0.044
- "center": [0.0, -0.002, 0.084]
"radius": 0.037
- "center": [0.0, 0.01, 0.12]
"radius": 0.031
- "center": [-0.0, -0.011, 0.115]
"radius": 0.031
- left_outer_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.015
- "center": [-0.0, -0.04, 0.034]
"radius": 0.015
- "center": [-0.0, -0.013, 0.011]
"radius": 0.015
- "center": [-0.0, -0.027, 0.023]
"radius": 0.015
- left_inner_knuckle:
- "center": [0.0, -0.014, 0.014]
"radius": 0.015
- "center": [-0.001, -0.002, 0.002]
"radius": 0.015
- "center": [0.001, -0.031, 0.031]
"radius": 0.015
- right_inner_knuckle:
- "center": [0.0, -0.014, 0.014]
"radius": 0.015
- "center": [-0.001, -0.002, 0.002]
"radius": 0.015
- "center": [0.001, -0.031, 0.031]
"radius": 0.015
- right_inner_finger:
- "center": [0.002, 0.01, 0.028]
"radius": 0.013
- "center": [0.003, 0.006, 0.014]
"radius": 0.012
- "center": [-0.003, 0.012, 0.037]
"radius": 0.012
- left_inner_finger:
- "center": [0.002, 0.01, 0.028]
"radius": 0.013
- "center": [0.003, 0.006, 0.014]
"radius": 0.012
- "center": [-0.003, 0.012, 0.037]
"radius": 0.012
- right_outer_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.015
- "center": [-0.0, -0.04, 0.034]
"radius": 0.015
- "center": [-0.0, -0.013, 0.011]
"radius": 0.015
- "center": [-0.0, -0.027, 0.023]
"radius": 0.015
| 4,204 | YAML | 28.822695 | 79 | 0.529258 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs007l/rmpflow/rs007l_rmpflow_config.yaml | joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 100.
position_gain: 200.
damping_gain: 100.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0,0,.4]
pt2: [0,0,0.]
radius: .13
body_collision_controllers:
- name: onrobot_rg2_base_link
radius: .05
- name: link5
radius: .07
| 2,324 | YAML | 28.0625 | 51 | 0.582186 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs007n/rmpflow/rs007n_rmpflow_config.yaml | joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 100.
position_gain: 200.
damping_gain: 100.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0,0,.4]
pt2: [0,0,0.]
radius: .13
body_collision_controllers:
- name: onrobot_rg2_base_link
radius: .05
- name: link5
radius: .07
| 2,324 | YAML | 28.0625 | 51 | 0.582186 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs007n/rmpflow/rs007n_robot_description.yaml | # The robot descriptor defines the generalized coordinates and how to map those
# to the underlying URDF dofs.
api_version: 1.0
# Defines the generalized coordinates. Each generalized coordinate is assumed
# to have an entry in the URDF.
# Lula will only use these joints to control the robot position.
cspace:
- joint1
- joint2
- joint3
- joint4
- joint5
- joint6
default_q: [
0.0,-0.2,-1.7,-1.507,0.0,0.0
]
# Most dimensions of the cspace have a direct corresponding element
# in the URDF. This list of rules defines how unspecified coordinates
# should be extracted or how values in the URDF should be overwritten.
cspace_to_urdf_rules:
- {name: finger_joint, rule: fixed, value: -0.0}
- {name: left_inner_knuckle_joint, rule: fixed, value: 0.0}
- {name: right_inner_knuckle_joint, rule: fixed, value: -0.0}
- {name: right_outer_knuckle_joint, rule: fixed, value: 0.0}
- {name: left_inner_finger_joint, rule: fixed, value: -0.0}
- {name: right_inner_finger_joint, rule: fixed, value: 0.0}
# Lula uses collision spheres to define the robot geometry in order to avoid
# collisions with external obstacles. If no spheres are specified, Lula will
# not be able to avoid obstacles.
collision_spheres:
- link1:
- "center": [-0.031, 0.0, -0.07]
"radius": 0.083
- "center": [-0.013, -0.001, -0.007]
"radius": 0.077
- "center": [-0.079, -0.0, -0.051]
"radius": 0.078
- link3:
- "center": [0.004, -0.0, 0.011]
"radius": 0.105
- link4:
- "center": [0.0, 0.0, 0.0]
"radius": 0.05
- "center": [0.001, -0.001, 0.125]
"radius": 0.05
- "center": [-0.001, -0.001, 0.11]
"radius": 0.067
- "center": [0.0, -0.0, 0.042]
"radius": 0.055
- "center": [0.0, -0.0, 0.268]
"radius": 0.067
- "center": [0.0, -0.0, 0.228]
"radius": 0.067
- "center": [-0.0, -0.0, 0.189]
"radius": 0.067
- "center": [-0.001, -0.001, 0.15]
"radius": 0.067
- link5:
- "center": [0.04, 0.0, 0.0]
"radius": 0.041
- onrobot_rg2_base_link:
- "center": [0.0, 0.001, 0.04]
"radius": 0.044
- "center": [0.0, -0.002, 0.084]
"radius": 0.037
- "center": [0.0, 0.01, 0.12]
"radius": 0.031
- "center": [-0.0, -0.011, 0.115]
"radius": 0.031
- left_outer_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.015
- "center": [-0.0, -0.04, 0.034]
"radius": 0.015
- "center": [-0.0, -0.013, 0.011]
"radius": 0.015
- "center": [-0.0, -0.027, 0.023]
"radius": 0.015
- left_inner_knuckle:
- "center": [0.0, -0.014, 0.014]
"radius": 0.015
- "center": [-0.001, -0.002, 0.002]
"radius": 0.015
- "center": [0.001, -0.031, 0.031]
"radius": 0.015
- right_inner_knuckle:
- "center": [0.0, -0.014, 0.014]
"radius": 0.015
- "center": [-0.001, -0.002, 0.002]
"radius": 0.015
- "center": [0.001, -0.031, 0.031]
"radius": 0.015
- right_inner_finger:
- "center": [0.002, 0.01, 0.028]
"radius": 0.013
- "center": [0.003, 0.006, 0.014]
"radius": 0.012
- "center": [-0.003, 0.012, 0.037]
"radius": 0.012
- left_inner_finger:
- "center": [0.002, 0.01, 0.028]
"radius": 0.013
- "center": [0.003, 0.006, 0.014]
"radius": 0.012
- "center": [-0.003, 0.012, 0.037]
"radius": 0.012
- right_outer_knuckle:
- "center": [0.0, 0.0, 0.0]
"radius": 0.015
- "center": [-0.0, -0.04, 0.034]
"radius": 0.015
- "center": [-0.0, -0.013, 0.011]
"radius": 0.015
- "center": [-0.0, -0.027, 0.023]
"radius": 0.015
- link2:
- "center": [0.044, 0.001, -0.11]
"radius": 0.065
- "center": [0.243, 0.0, -0.119]
"radius": 0.055
- "center": [-0.008, 0.002, -0.108]
"radius": 0.063
- "center": [0.333, 0.006, -0.114]
"radius": 0.049
- "center": [0.373, -0.015, -0.111]
"radius": 0.045
- "center": [0.284, 0.001, -0.118]
"radius": 0.052
- "center": [0.075, 0.0, -0.116]
"radius": 0.061
- "center": [0.133, 0.0, -0.117]
"radius": 0.059
- "center": [0.189, 0.0, -0.118]
"radius": 0.057
| 4,210 | YAML | 28.865248 | 79 | 0.529454 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs080n/rmpflow/rs080n_rmpflow_config.yaml | joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 100.
position_gain: 200.
damping_gain: 100.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0,0,.7]
pt2: [0,0,0.]
radius: .23
body_collision_controllers:
- name: onrobot_rg2_base_link
radius: .05
- name: link5
radius: .12
| 2,324 | YAML | 28.0625 | 51 | 0.582186 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/motion_policy_configs/Kawasaki/rs025n/rmpflow/rs025n_rmpflow_config.yaml | joint_limit_buffers: [.01, .01, .01, .01, .01, .01]
rmp_params:
cspace_target_rmp:
metric_scalar: 100.
position_gain: 200.
damping_gain: 100.
robust_position_term_thresh: .5
inertia: 1.
cspace_trajectory_rmp:
p_gain: 100.
d_gain: 10.
ff_gain: .25
weight: 50.
cspace_affine_rmp:
final_handover_time_std_dev: .25
weight: 2000.
joint_limit_rmp:
metric_scalar: 1000.
metric_length_scale: .01
metric_exploder_eps: 1e-3
metric_velocity_gate_length_scale: .01
accel_damper_gain: 200.
accel_potential_gain: 1.
accel_potential_exploder_length_scale: .1
accel_potential_exploder_eps: 1e-2
joint_velocity_cap_rmp:
max_velocity: 1.
velocity_damping_region: .3
damping_gain: 1000.0
metric_weight: 100.
target_rmp:
accel_p_gain: 60.
accel_d_gain: 85.
accel_norm_eps: .075
metric_alpha_length_scale: .05
min_metric_alpha: .01
max_metric_scalar: 10000
min_metric_scalar: 2500
proximity_metric_boost_scalar: 20.
proximity_metric_boost_length_scale: .02
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
axis_target_rmp:
accel_p_gain: 210.
accel_d_gain: 60.
metric_scalar: 10
proximity_metric_boost_scalar: 3000.
proximity_metric_boost_length_scale: .08
xi_estimator_gate_std_dev: 20000.
accept_user_weights: false
collision_rmp:
damping_gain: 50.
damping_std_dev: .04
damping_robustness_eps: 1e-2
damping_velocity_gate_length_scale: .01
repulsion_gain: 800.
repulsion_std_dev: .01
metric_modulation_radius: .5
metric_scalar: 10000.
metric_exploder_std_dev: .02
metric_exploder_eps: .001
damping_rmp:
accel_d_gain: 30.
metric_scalar: 50.
inertia: 100.
canonical_resolve:
max_acceleration_norm: 50.
projection_tolerance: .01
verbose: false
body_cylinders:
- name: base_link
pt1: [0,0,.7]
pt2: [0,0,0.]
radius: .23
body_collision_controllers:
- name: onrobot_rg2_base_link
radius: .05
- name: link5
radius: .12
| 2,324 | YAML | 28.0625 | 51 | 0.582186 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/path_planner_configs/franka/rrt/franka_planner_config.yaml | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
seed: 123456
step_size: 0.1
max_iterations: 4000
max_sampling: 10000
distance_metric_weights: [3.0, 2.0, 2.0, 1.5, 1.5, 1.0, 1.0]
task_space_frame_name: "panda_rightfingertip"
task_space_limits: [[-0.8, 0.9], [-0.8, 0.8], [0.0, 1.2]]
c_space_planning_params:
exploration_fraction: 0.5
task_space_planning_params:
x_target_zone_tolerance: [0.01, 0.01, 0.01]
x_target_final_tolerance: 1e-5
task_space_exploitation_fraction: 0.4
task_space_exploration_fraction: 0.1
| 900 | YAML | 38.173911 | 76 | 0.751111 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/PACKAGE-LICENSES/omni.isaac.motion_generation-LICENSE.md | Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/config/extension.toml | [core]
reloadable = true
order = 0
[package]
version = "4.5.6"
category = "Simulation"
title = "Isaac Sim Motion Generation"
description = "Extension that provides support for generating motion with Lula-based motion policies and an interface for writing arbitrary motion policies"
repository = ""
authors = ["NVIDIA"]
keywords = ["isaac", "motion generation", "lula", "motion policy"]
changelog = "docs/CHANGELOG.md"
readme = "docs/README.md"
icon = "data/icon.png"
[dependencies]
"omni.isaac.dynamic_control" = {}
"omni.isaac.motion_planning" = {} # Fixes issue where ROS was sourced first
"omni.isaac.lula" = {}
"omni.isaac.core" = {}
[[python.module]]
name = "omni.isaac.motion_generation"
[[python.module]]
name = "omni.isaac.motion_generation.tests"
| 760 | TOML | 26.17857 | 156 | 0.722368 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/kinematics_interface.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
from typing import Tuple, Optional, List
from .world_interface import WorldInterface
class KinematicsSolver(WorldInterface):
"""An limitted interface for computing robot kinematics that includes forward and inverse kinematics.
This interface ommits more advanced kinematics such as Jacobians, as they are not required for most use-cases.
This interface inherits from the WorldInterface to standardize the inputs to collision-aware IK solvers, but it is not necessary for
all implementations to implement the WorldInterface. See KinematicsSolver.supports_collision_avoidance()
"""
def __init__(self):
pass
def set_robot_base_pose(self, robot_positions: np.array, robot_orientation: np.array) -> None:
"""Update position of the robot base. This will be used to compute kinematics relative to the USD stage origin.
Args:
robot_positions (np.array): (3 x 1) translation vector describing the translation of the robot base relative to the USD stage origin.
The translation vector should be specified in the units of the USD stage
robot_orientation (np.array): (4 x 1) quaternion describing the orientation of the robot base relative to the USD stage global frame
"""
pass
def get_joint_names(self) -> List[str]:
"""Return a list containing the names of all joints in the given kinematic structure. The order of this list
determines the order in which the joint positions are expected in compute_forward_kinematics(joint_positions,...) and
the order in which they are returned in compute_inverse_kinematics()
Returns:
List[str]: Names of all joints in the robot
"""
return []
def get_all_frame_names(self) -> List[str]:
"""Return a list of all the frame names in the given kinematic structure
Returns:
List[str]: All frame names in the kinematic structure. Any of which can be used to compute forward or inverse kinematics.
"""
return []
def compute_forward_kinematics(
self, frame_name: str, joint_positions: np.array, position_only: Optional[bool] = False
) -> Tuple[np.array, np.array]:
""" Compute the position of a given frame in the robot relative to the USD stage global frame
Args:
frame_name (str): Name of robot frame on which to calculate forward kinematics
joint_positions (np.array): Joint positions for the joints returned by get_joint_names()
position_only (bool): If True, only the frame positions need to be calculated and the returned rotation may be left undefined.
Returns:
Tuple[np.array,np.array]:
frame_positions: (3x1) vector describing the translation of the frame relative to the USD stage origin
frame_rotation: (3x3) rotation matrix describing the rotation of the frame relative to the USD stage global frame
"""
return np.zeros(3), np.eye(3)
def compute_inverse_kinematics(
self,
frame_name: str,
target_positions: np.array,
target_orientation: Optional[np.array] = None,
warm_start: Optional[np.array] = None,
position_tolerance: Optional[float] = None,
orientation_tolerance: Optional[float] = None,
) -> Tuple[np.array, bool]:
"""Compute joint positions such that the specified robot frame will reach the desired translations and rotations
Args:
frame_name (str): name of the target frame for inverse kinematics
target_position (np.array): target translation of the target frame (in stage units) relative to the USD stage origin
target_orientation (np.array): target orientation of the target frame relative to the USD stage global frame. Defaults to None.
warm_start (np.array): a starting position that will be used when solving the IK problem. Defaults to None.
position_tolerance (float): l-2 norm of acceptable position error (in stage units) between the target and achieved translations. Defaults to None.
orientation tolerance (float): magnitude of rotation (in radians) separating the target orientation from the achieved orienatation.
orientation_tolerance is well defined for values between 0 and pi. Defaults to None.
Returns:
Tuple[np.array,bool]:
joint_positions: in the order specified by get_joint_names() which result in the target frame acheiving the desired position
success: True if the solver converged to a solution within the given tolerances
"""
return np.empty()
def supports_collision_avoidance(self) -> bool:
"""Returns a bool describing whether the inverse kinematics support collision avoidance. If the policy does not support collision
avoidance, none of the obstacle add/remove/enable/disable functions need to be implemented.
Returns:
bool: If True, the IK solver will avoid any obstacles that have been added
"""
return False
| 5,604 | Python | 50.422018 | 158 | 0.695575 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/trajectory.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
from typing import Tuple, List
class Trajectory:
"""Interface class for defining a continuous-time trajectory for a robot in Isaac Sim.
A Trajectory may be passed to an ArticulationTrajectory to have its continuous-time output discretized and converted
to a ArticulationActions.
"""
def __init__(self):
pass
@property
def start_time(self) -> float:
"""Return the start time of the trajectory.
Returns:
float: Start time of the trajectory.
"""
pass
@property
def end_time(self) -> float:
"""Return the end time of the trajectory
Returns:
float: End time of the trajectory
"""
pass
def get_active_joints(self) -> List[str]:
"""Active joints are directly controlled by this Trajectory
A Trajectory may be specified for only a subset of the joints in a robot Articulation. For example, it may include the DOFs in a robot
arm, but not in the gripper.
Returns:
List[str]: Names of active joints. The order of joints in this list determines the order in which a
Trajectory will return joint targets for the robot.
"""
return []
def get_joint_targets(self, time: float) -> Tuple[np.array, np.array]:
"""Return joint targets for the robot at the given time. The Trajectory interface assumes trajectories to
be represented continuously between a start time and end time. In instance of this class that internally generates discrete time
trajectories will need to implement some form of interpolation for times that have not been computed.
Args:
time (float): Time in trajectory at which to return joint targets.
Returns:
Tuple[np.array,np.array]:
joint position targets for the active robot joints\n
joint velocity targets for the active robot joints
"""
pass
| 2,435 | Python | 36.476923 | 143 | 0.676386 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/interface_config_loader.py | import os
import json
import carb
from omni.isaac.core.utils.extensions import get_extension_path_from_name
from typing import List
"""This InterfaceLoader makes it trivial to load a valid config for supported interface implementations
For example, RMPflow has a collection of robot-specific config files stored in the motion_generation extension.
This loader makes it simple to load RMPflow for the Franka robot using load_supported_motion_policy_config("Franka","RMPflow")
"""
def get_supported_robot_policy_pairs() -> dict:
"""Get a dictionary of MotionPolicy names that are supported for each given robot name
Returns:
supported_policy_names_by_robot (dict): dictionary mapping robot names (keys) to a list of supported MotionPolicy config files (values)
"""
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
policy_config_dir = os.path.join(mg_extension_path, "motion_policy_configs")
with open(os.path.join(policy_config_dir, "policy_map.json")) as policy_map:
policy_map = json.load(policy_map)
supported_policy_names_by_robot = dict()
for k, v in policy_map.items():
supported_policy_names_by_robot[k] = list(v.keys())
return supported_policy_names_by_robot
def get_supported_robots_with_lula_kinematics() -> List[str]:
# Currently just uses robots that have RmpFlow supported
robots = []
pairs = get_supported_robot_policy_pairs()
for k, v in pairs.items():
if "RMPflow" in v:
robots.append(k)
return robots
def get_supported_robot_path_planner_pairs() -> dict:
"""Get a dictionary of PathPlanner names that are supported for each given robot name
Returns:
supported_planner_names_by_robot (dict): dictionary mapping robot names (keys) to a list of supported PathPlanner config files (values)
"""
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
policy_config_dir = os.path.join(mg_extension_path, "path_planner_configs")
with open(os.path.join(policy_config_dir, "path_planner_map.json")) as planner_map:
planner_map = json.load(planner_map)
supported_planner_names_by_robot = dict()
for k, v in planner_map.items():
supported_planner_names_by_robot[k] = list(v.keys())
return supported_planner_names_by_robot
def load_supported_lula_kinematics_solver_config(robot_name: str, policy_config_dir=None) -> dict:
"""Load lula kinematics solver for a supported robot.
Use get_supported_robots_with_lula_kinematics() to get a list of robots with supported kinematics.
Args:
robot_name (str): name of robot
Returns:
solver_config (dict): a dictionary whose keyword arguments are sufficient to load the lula kinematics solver.
e.g. lula.LulaKinematicsSolver(**load_supported_lula_kinematics_solver_config("Franka"))
"""
policy_name = "RMPflow"
if policy_config_dir is None:
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
policy_config_dir = os.path.join(mg_extension_path, "motion_policy_configs")
with open(os.path.join(policy_config_dir, "policy_map.json")) as policy_map:
policy_map = json.load(policy_map)
if robot_name not in policy_map:
carb.log_error(
"Unsupported robot passed to InterfaceLoader. Use get_supported_robots_with_lula_kinematics() to get a list of robots with supported kinematics"
)
return None
if policy_name not in policy_map[robot_name]:
carb.log_error(
robot_name
+ " does not have supported lula kinematics. Use get_supported_robots_with_lula_kinematics() to get a list of robots with supported kinematics"
)
return None
config_path = os.path.join(policy_config_dir, policy_map[robot_name][policy_name])
rmp_config = _process_policy_config(config_path)
kinematics_config = dict()
kinematics_config["robot_description_path"] = rmp_config["robot_description_path"]
kinematics_config["urdf_path"] = rmp_config["urdf_path"]
return kinematics_config
def load_supported_motion_policy_config(robot_name: str, policy_name: str, policy_config_dir: str = None) -> dict:
"""Load a MotionPolicy object by specifying the robot name and policy name
For a dictionary mapping supported robots to supported policies on those robots,
use get_supported_robot_policy_pairs()
To use this loader for a new policy, a user may copy the config file structure found under /motion_policy_configs/
in the motion_generation extension, passing in a path to a directory containing a "policy_map.json"
Args:
robot_name (str): name of robot
policy_name (str): name of MotionPolicy
policy_config_dir (str): path to directory where a policy_map.json file is stored,
defaults to ".../omni.isaac.motion_generation/motion_policy_configs"
Returns:
policy_config (dict): a dictionary whose keyword arguments are sufficient to load the desired motion policy
e.g. lula.motion_policies.RmpFlow(**load_supported_motion_policy_config("Franka","RMPflow"))
"""
if policy_config_dir is None:
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
policy_config_dir = os.path.join(mg_extension_path, "motion_policy_configs")
with open(os.path.join(policy_config_dir, "policy_map.json")) as policy_map:
policy_map = json.load(policy_map)
if robot_name not in policy_map:
carb.log_error(
"Unsupported robot passed to InterfaceLoader. Use get_supported_robot_policy_pairs() to see supported robots and their corresponding supported policies"
)
return None
if policy_name not in policy_map[robot_name]:
carb.log_error(
'Unsupported policy name passed to InterfaceLoader for robot "'
+ robot_name
+ '". Use get_supported_robot_policy_pairs() to see supported robots and their corresponding supported policies'
)
return None
config_path = os.path.join(policy_config_dir, policy_map[robot_name][policy_name])
config = _process_policy_config(config_path)
return config
def load_supported_path_planner_config(robot_name: str, planner_name: str, policy_config_dir: str = None) -> dict:
if policy_config_dir is None:
mg_extension_path = get_extension_path_from_name("omni.isaac.motion_generation")
policy_config_dir = os.path.join(mg_extension_path, "path_planner_configs")
with open(os.path.join(policy_config_dir, "path_planner_map.json")) as policy_map:
policy_map = json.load(policy_map)
if robot_name not in policy_map:
carb.log_error(
"Unsupported robot passed to InterfaceLoader. Use get_supported_robot_policy_pairs() to see supported robots and their corresponding supported policies"
)
return None
if planner_name not in policy_map[robot_name]:
carb.log_error(
'Unsupported policy name passed to InterfaceLoader for robot "'
+ robot_name
+ '". Use get_supported_robot_policy_pairs() to see supported robots and their corresponding supported policies'
)
return None
config_path = os.path.join(policy_config_dir, policy_map[robot_name][planner_name])
config = _process_policy_config(config_path)
return config
def _process_policy_config(mg_config_file):
mp_config_dir = os.path.dirname(mg_config_file)
with open(mg_config_file) as config_file:
config = json.load(config_file)
rel_assets = config.get("relative_asset_paths", {})
for k, v in rel_assets.items():
config[k] = os.path.join(mp_config_dir, v)
del config["relative_asset_paths"]
return config
| 7,891 | Python | 42.60221 | 165 | 0.692941 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/__init__.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.motion_generation.articulation_motion_policy import ArticulationMotionPolicy
from omni.isaac.motion_generation.world_interface import WorldInterface
from omni.isaac.motion_generation.motion_policy_interface import MotionPolicy
from omni.isaac.motion_generation.lula.motion_policies import RmpFlow, RmpFlowSmoothed
from omni.isaac.motion_generation.lula.kinematics import LulaKinematicsSolver
from omni.isaac.motion_generation.articulation_kinematics_solver import ArticulationKinematicsSolver
from omni.isaac.motion_generation.kinematics_interface import KinematicsSolver
from omni.isaac.motion_generation.trajectory import Trajectory
from omni.isaac.motion_generation.articulation_trajectory import ArticulationTrajectory
from omni.isaac.motion_generation.lula.trajectory_generator import (
LulaCSpaceTrajectoryGenerator,
LulaTaskSpaceTrajectoryGenerator,
)
from omni.isaac.motion_generation.path_planning_interface import PathPlanner
from omni.isaac.motion_generation.path_planner_visualizer import PathPlannerVisualizer
from omni.isaac.motion_generation.motion_policy_controller import MotionPolicyController
from omni.isaac.motion_generation.wheel_base_pose_controller import WheelBasePoseController
| 1,657 | Python | 60.407405 | 100 | 0.858177 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/path_planner_visualizer.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
from .path_planning_interface import PathPlanner
from omni.isaac.core.articulations import Articulation, ArticulationSubset
from omni.isaac.core.utils.types import ArticulationAction
import numpy as np
import carb
from typing import List
class PathPlannerVisualizer:
"""A helper class for quickly visualizing the plans output by a PathPlanner.
The main utility of this class lies in the compute_plan_as_articulation_actions() function, which returns a sequence of
ArticulationActions that may be directly sent to the robot Articulation in order to visualize the planned path.
Args:
robot_articulation (Articulation): An Articulation object describing a single simulated robot.
path_planner (PathPlanner): A PathPlanner object that has been configured to compute plans for the robot
represented by the robot Articulation.
"""
def __init__(self, robot_articulation: Articulation, path_planner: PathPlanner) -> None:
self._robot_articulation = robot_articulation
self._planner = path_planner
self._articulation_controller = self._robot_articulation.get_articulation_controller()
self._active_joints_view = ArticulationSubset(robot_articulation, path_planner.get_active_joints())
self._watched_joints_view = ArticulationSubset(robot_articulation, path_planner.get_watched_joints())
def compute_plan_as_articulation_actions(self, max_cspace_dist: float = 0.05) -> List[ArticulationAction]:
"""Compute plan using a PathPlanner and linearly interpolate the result to enforce that the maximum
distance (l2 norm) between any two points is max_cspace_dist.
Args:
max_cspace_dist (float, optional): Maximum distance between adjacent points in the path. Defaults to 0.05.
Returns:
List[ArticulationAction]: Linearly interpolated path given as a sequence of ArticulationActions that can be
passed directly to the robot Articulation. This may rearrange and augment the plan output by the PathPlanner to
match the number of DOFs available for control in the robot Articulation.
"""
active_joint_positions = self._active_joints_view.get_joint_positions()
if active_joint_positions is None:
carb.log_error(
"Attempted to compute a path for an uninitialized robot Articulation. Cannot get joint positions"
)
watched_joint_positions = self._watched_joints_view.get_joint_positions()
path = self._planner.compute_path(active_joint_positions, watched_joint_positions)
if path is None:
return []
interpolated_path = self.interpolate_path(path, max_cspace_dist)
actions_np_array = self._active_joints_view.map_to_articulation_order(interpolated_path)
articulation_actions = [
ArticulationAction(joint_positions=actions_np_array[i]) for i in range(len(actions_np_array))
]
return articulation_actions
def interpolate_path(self, path: np.array, max_cspace_dist: float = 0.05) -> np.array:
"""Linearly interpolate a sparse path such that the maximum distance (l2 norm) between any two points is max_cspace_dist
Args:
path (np.array): Sparse cspace path with shape (N x num_dofs) where N is number of points in the path
max_cspace_dist (float, optional): _description_. Defaults to 0.05.
Returns:
np.array: Linearly interpolated path with shape (M x num_dofs)
"""
if path.shape[0] == 0:
return path
interpolated_path = []
for i in range(path.shape[0] - 1):
n_pts = int(np.ceil(np.amax(abs(path[i + 1] - path[i])) / max_cspace_dist))
interpolated_path.append(np.array(np.linspace(path[i], path[i + 1], num=n_pts, endpoint=False)))
interpolated_path.append(path[np.newaxis, -1, :])
interpolated_path = np.concatenate(interpolated_path)
return interpolated_path
def get_active_joints_subset(self) -> ArticulationSubset:
"""Get view into active joints
Returns:
ArticulationSubset: Returns robot states for active joints in an order compatible with the PathPlanner
"""
return self._active_joints_view
def get_watched_joints_subset(self) -> ArticulationSubset:
"""Get view into watched joints
Returns:
ArticulationSubset: Returns robot states for watched joints in an order compatible with the PathPlanner
"""
return self._watched_joints_view
def get_robot_articulation(self) -> Articulation:
"""Get the robot Articulation
Returns:
Articulation: Articulation object describing the robot.
"""
return self._robot_articulation
def get_path_planner(self) -> PathPlanner:
"""Get the PathPlanner that is being used to generate paths
Returns:
PathPlanner: An instance of the PathPlanner interface for generating sparse paths to a target pose
"""
return self._planner
| 5,572 | Python | 42.881889 | 128 | 0.690596 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/motion_policy_interface.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
from typing import Tuple, List
from omni.isaac.motion_generation.world_interface import WorldInterface
class MotionPolicy(WorldInterface):
"""Interface for implementing a MotionPolicy: a collision-aware algorithm for dynamically moving a robot to a target. The MotionPolicy interface inherits
from the WorldInterface class. A MotionPolicy can be passed to an ArticulationMotionPolicy to streamline moving the simulated robot.
"""
def __init__(self) -> None:
pass
def set_robot_base_pose(self, robot_translation: np.array, robot_orientation: np.array):
"""Update position of the robot base.
Args:
robot_translation (np.array): (3 x 1) translation vector describing the translation of the robot base relative to the USD stage origin.
The translation vector should be specified in the units of the USD stage
robot_orientation (np.array): (4 x 1) quaternion describing the orientation of the robot base relative to the USD stage global frame
"""
pass
def compute_joint_targets(
self,
active_joint_positions: np.array,
active_joint_velocities: np.array,
watched_joint_positions: np.array,
watched_joint_velocities: np.array,
frame_duration: float,
) -> Tuple[np.array, np.array]:
"""Compute position and velocity targets for the next frame given the current robot state.
Position and velocity targets are used in Isaac Sim to generate forces using the PD equation
kp*(joint_position_targets-joint_positions) + kd*(joint_velocity_targets-joint_velocities).
Args:
active_joint_positions (np.array): current positions of joints specified by get_active_joints()
active_joint_velocities (np.array): current velocities of joints specified by get_active_joints()
watched_joint_positions (np.array): current positions of joints specified by get_watched_joints()
watched_joint_velocities (np.array): current velocities of joints specified by get_watched_joints()
frame_duration (float): duration of the physics frame
Returns:
Tuple[np.array,np.array]:
joint position targets for the active robot joints for the next frame \n
joint velocity targets for the active robot joints for the next frame
"""
return active_joint_positions, np.zeros_like(active_joint_velocities)
def get_active_joints(self) -> List[str]:
"""Active joints are directly controlled by this MotionPolicy
Some articulated robot joints may be ignored by some policies. E.g., the gripper of the Franka arm is not used
to follow targets, and the RMPflow config files excludes the joints in the gripper from the list of articulated
joints.
Returns:
List[str]: names of active joints. The order of joints in this list determines the order in which a
MotionPolicy expects joint states to be specified in functions like compute_joint_targets(active_joint_positions,...)
"""
return []
def get_watched_joints(self) -> List[str]:
"""Watched joints are joints whose position/velocity matters to the MotionPolicy, but are not directly controlled.
e.g. A MotionPolicy may control a robot arm on a mobile robot. The joint states in the rest of the robot directly affect the position of the arm, but they are not actively controlled by this MotionPolicy
Returns:
List[str]: Names of joints that are being watched by this MotionPolicy. The order of joints in this list determines the order in which a
MotionPolicy expects joint states to be specified in functions like compute_joint_targets(...,watched_joint_positions,...)
"""
return []
def set_cspace_target(self, active_joint_targets: np.array) -> None:
"""Set configuration space target for the robot.
Args:
active_joint_target (np.array): Desired configuration for the robot as (m x 1) vector where m is the number of active
joints.
Returns:
None
"""
pass
def set_end_effector_target(self, target_translation=None, target_orientation=None) -> None:
"""Set end effector target.
Args:
target_translation (nd.array): Translation vector (3x1) for robot end effector.
Target translation should be specified in the same units as the USD stage, relative to the stage origin.
target_orientation (nd.array): Quaternion of desired rotation for robot end effector relative to USD stage global frame
Returns:
None
"""
pass
| 5,224 | Python | 48.761904 | 212 | 0.690084 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/articulation_motion_policy.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import torch
import carb
from .motion_policy_interface import MotionPolicy
from omni.isaac.core.articulations import Articulation, ArticulationSubset
from omni.isaac.core.utils.types import ArticulationAction
class ArticulationMotionPolicy:
"""Wrapper class for running MotionPolicy on simulated robots.
Args:
robot_articulation (Articulation): an initialized robot Articulation object
motion_policy (MotionPolicy): an instance of a class that implements the MotionPolicy interface
default_physics_dt (float): Default physics step size to use when computing actions. A MotionPolicy computes a target
position/velocity for the next frame of the simulation using the provided physics dt to know how far in the future that will be.
Isaac Sim can be run with a constant or variable physics framerate.
When not specified on an individual frame, the dt of the frame is assumed
to be the provided default value.
Returns:
None
"""
def __init__(
self, robot_articulation: Articulation, motion_policy: MotionPolicy, default_physics_dt: float = 1 / 60.0
) -> None:
self.physics_dt = default_physics_dt
self._robot_articulation = robot_articulation
self.motion_policy = motion_policy
self._articulation_controller = self._robot_articulation.get_articulation_controller()
self._active_joints_view = ArticulationSubset(robot_articulation, motion_policy.get_active_joints())
self._watched_joints_view = ArticulationSubset(robot_articulation, motion_policy.get_watched_joints())
self._default_physics_dt = default_physics_dt
def move(self, physics_dt: float = None) -> None:
"""Use underlying MotionPolicy to compute and apply joint targets to the robot over the next frame.
Args:
physics_dt (float): Physics dt to use on this frame to calculate the next action. This overrides
the default_physics_dt argument, but does not change the default on future calls.
Return:
None
"""
action = self.get_next_articulation_action(physics_dt=physics_dt)
self._articulation_controller.apply_action(action)
def get_next_articulation_action(self, physics_dt: float = None) -> ArticulationAction:
"""Use underlying MotionPolicy to compute joint targets for the robot over the next frame.
Args:
physics_dt (float): Physics dt to use on this frame to calculate the next action. This overrides
the default_physics_dt argument, but does not change the default on future calls.
Returns:
ArticulationAction: Desired position/velocity target for the robot in the next frame
"""
if physics_dt is None:
physics_dt = self._default_physics_dt
joint_positions, joint_velocities = (
self._active_joints_view.get_joint_positions(),
self._active_joints_view.get_joint_velocities(),
)
watched_joint_positions, watched_joint_velocities = (
self._watched_joints_view.get_joint_positions(),
self._watched_joints_view.get_joint_velocities(),
)
if joint_positions is None:
carb.log_error(
"Attempted to compute an action, but the robot Articulation has not been initialized. Cannot get joint positions or velocities."
)
# convert to numpy if torch tensor
if isinstance(joint_positions, torch.Tensor):
joint_positions = joint_positions.cpu().numpy()
if isinstance(joint_velocities, torch.Tensor):
joint_velocities = joint_velocities.cpu().numpy()
if isinstance(watched_joint_positions, torch.Tensor):
watched_joint_positions = watched_joint_positions.cpu().numpy()
if isinstance(watched_joint_velocities, torch.Tensor):
watched_joint_velocities = watched_joint_velocities.cpu().numpy()
position_targets, velocity_targets = self.motion_policy.compute_joint_targets(
joint_positions, joint_velocities, watched_joint_positions, watched_joint_velocities, physics_dt
)
return self._active_joints_view.make_articulation_action(position_targets, velocity_targets)
def get_active_joints_subset(self) -> ArticulationSubset:
"""Get view into active joints
Returns:
ArticulationSubset: returns robot states for active joints in an order compatible with the MotionPolicy
"""
return self._active_joints_view
def get_watched_joints_subset(self) -> ArticulationSubset:
"""Get view into watched joints
Returns:
ArticulationSubset: returns robot states for watched joints in an order compatible with the MotionPolicy
"""
return self._watched_joints_view
def get_robot_articulation(self) -> Articulation:
""" Get the underlying Articulation object representing the robot.
Returns:
Articulation: Articulation object representing the robot.
"""
return self._robot_articulation
def get_motion_policy(self) -> MotionPolicy:
"""Get MotionPolicy that is being used to compute ArticulationActions
Returns:
MotionPolicy: MotionPolicy being used to compute ArticulationActions
"""
return self.motion_policy
def get_default_physics_dt(self) -> float:
"""Get the default value of the physics dt that is used to compute actions when none is provided
Returns:
float: Default physics dt
"""
return self._default_physics_dt
def set_default_physics_dt(self, physics_dt: float) -> None:
"""Set the default value of the physics dt that is used to compute actions when none is provided
Args:
physics_dt (float): Default physics dt
Returns:
None
"""
self._default_physics_dt = physics_dt
| 6,492 | Python | 40.356688 | 145 | 0.677911 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/path_planning_interface.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
from typing import List
from omni.isaac.motion_generation.world_interface import WorldInterface
class PathPlanner(WorldInterface):
"""Interface for implementing a PathPlanner: An algorithm that outputs a series of configuration space waypoints, which
when linearly interpolated, produce a collision-free path from a starting c-space pose to a c-space or task-space target pose.
"""
def __init__(self) -> None:
pass
def set_robot_base_pose(self, robot_translation: np.array, robot_orientation: np.array):
"""Set the position of the robot base. Computed paths will assume that the robot base remains stationary.
Args:
robot_translation (np.array): (3 x 1) translation vector describing the translation of the robot base relative to the USD stage origin.
The translation vector should be specified in the units of the USD stage
robot_orientation (np.array): (4 x 1) quaternion describing the orientation of the robot base relative to the USD stage global frame
"""
pass
def compute_path(self, active_joint_positions: np.array, watched_joint_positions: np.array) -> np.array:
"""Compute a set of c-space waypoints, which when linearly interpolated,
produce a collision-free path from a starting c-space pose to a c-space or task-space target pose.
Args:
active_joint_positions (np.array): current positions of joints specified by get_active_joints()
watched_joint_positions (np.array): current positions of joints specified by get_watched_joints()
Returns:
np.array or None:
path: An (N x m) sequence of joint positions for the active joints in the robot where N is the path length and
m is the number of active joints in the robot. If no plan is found, or no target positions have been set, None is returned
"""
return active_joint_positions
def get_active_joints(self) -> List[str]:
"""Active joints are directly controlled by this PathPlanner
Some articulated robot joints may be ignored by some policies. E.g., the gripper of the Franka arm is not used
to follow targets, and the RMPflow config files excludes the joints in the gripper from the list of articulated
joints.
Returns:
List[str]: names of active joints. The order of joints in this list determines the order in which a
PathPlanner expects joint states to be specified in functions like compute_path(active_joint_positions,...)
"""
return []
def get_watched_joints(self) -> List[str]:
"""Watched joints are joints whose position matters to the PathPlanner, but are not directly controlled.
e.g. A robot may have a watched joint in the middle of its kinematic chain. Watched joints will be assumed
to remain watched during the rollout of a path.
Returns:
List[str]: Names of joints that are being watched by this PathPlanner. The order of joints in this list determines the order in which a
PathPlanner expects joint states to be specified in functions like compute_path(...,watched_joint_positions,...).
"""
return []
def set_cspace_target(self, active_joint_targets: np.array) -> None:
"""Set configuration space target for the robot.
Args:
active_joint_target (np.array): Desired configuration for the robot as (m x 1) vector where m is the number of active
joints.
Returns:
None
"""
pass
def set_end_effector_target(self, target_translation, target_orientation=None) -> None:
"""Set end effector target.
Args:
target_translation (nd.array): Translation vector (3x1) for robot end effector.
Target translation should be specified in the same units as the USD stage, relative to the stage origin.
target_orientation (nd.array): Quaternion of desired rotation for robot end effector relative to USD stage global frame
Returns:
None
"""
pass
| 4,640 | Python | 47.852631 | 148 | 0.685345 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/motion_policy_controller.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.core.controllers import BaseController
from omni.isaac.motion_generation import ArticulationMotionPolicy, MotionPolicy
from omni.isaac.core.utils.types import ArticulationAction
from typing import Optional
import omni.isaac.core.objects
from omni.isaac.core.utils.rotations import euler_angles_to_quat
import numpy as np
class MotionPolicyController(BaseController):
"""A Controller that steps using an arbitrary MotionPolicy
Args:
name (str): name of this controller
articulation_motion_policy (ArticulationMotionPolicy): a wrapper around a MotionPolicy for computing ArticulationActions that can be directly applied to the robot
"""
def __init__(self, name: str, articulation_motion_policy: ArticulationMotionPolicy) -> None:
BaseController.__init__(self, name)
self._articulation_motion_policy = articulation_motion_policy
self._motion_policy = self._articulation_motion_policy.get_motion_policy()
return
def forward(
self, target_end_effector_position: np.ndarray, target_end_effector_orientation: Optional[np.ndarray] = None
) -> ArticulationAction:
"""Compute an ArticulationAction representing the desired robot state for the next simulation frame
Args:
target_translation (nd.array): Translation vector (3x1) for robot end effector.
Target translation should be specified in the same units as the USD stage, relative to the stage origin.
target_orientation (Optional[np.ndarray], optional): Quaternion of desired rotation for robot end effector relative to USD stage global frame.
Target orientation defaults to None, which means that the robot may reach the target with any orientation.
Returns:
ArticulationAction: A wrapper object containing the desired next state for the robot
"""
self._motion_policy.set_end_effector_target(target_end_effector_position, target_end_effector_orientation)
self._motion_policy.update_world()
action = self._articulation_motion_policy.get_next_articulation_action()
return action
def add_obstacle(self, obstacle: omni.isaac.core.objects, static: bool = False) -> None:
"""Add an object from omni.isaac.core.objects as an obstacle to the motion_policy
Args:
obstacle (omni.isaac.core.objects): Dynamic, Visual, or Fixed object from omni.isaac.core.objects
static (bool): If True, the obstacle may be assumed by the MotionPolicy to remain stationary over time
"""
self._motion_policy.add_obstacle(obstacle, static=static)
return
def remove_obstacle(self, obstacle: omni.isaac.core.objects) -> None:
"""Remove and added obstacle from the motion_policy
Args:
obstacle (omni.isaac.core.objects): Object from omni.isaac.core.objects that has been added to the motion_policy
"""
self._motion_policy.remove_obstacle(obstacle)
return
def reset(self) -> None:
"""
"""
self._motion_policy.reset()
return
def get_articulation_motion_policy(self) -> ArticulationMotionPolicy:
"""Get ArticulationMotionPolicy that was passed to this class on initialization
Returns:
ArticulationMotionPolicy: a wrapper around a MotionPolicy for computing ArticulationActions that can be directly applied to the robot
"""
return self._articulation_motion_policy
def get_motion_policy(self) -> MotionPolicy:
"""Get MotionPolicy object that is being used to generate robot motions
Returns:
MotionPolicy: An instance of a MotionPolicy that is being used to compute robot motions
"""
return self._motion_policy
| 4,267 | Python | 43.458333 | 174 | 0.709632 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/wheel_base_pose_controller.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.core.controllers import BaseController
from omni.isaac.core.utils.types import ArticulationAction
from omni.isaac.core.utils.rotations import quat_to_euler_angles
import numpy as np
import math
class WheelBasePoseController(BaseController):
"""[summary]
Args:
name (str): [description]
open_loop_wheel_controller (BaseController): A controller that takes in a command of
[longitudinal velocity, steering angle] and returns the
ArticulationAction to be applied to the wheels if non holonomic.
and [longitudinal velocity, latitude velocity, steering angle]
if holonomic.
is_holonomic (bool, optional): [description]. Defaults to False.
"""
def __init__(self, name: str, open_loop_wheel_controller: BaseController, is_holonomic: bool = False) -> None:
super().__init__(name)
self._open_loop_wheel_controller = open_loop_wheel_controller
self._is_holonomic = is_holonomic
return
def forward(
self,
start_position: np.ndarray,
start_orientation: np.ndarray,
goal_position: np.ndarray,
lateral_velocity: float = 0.2,
yaw_velocity: float = 0.5,
heading_tol: float = 0.05,
position_tol: float = 0.04,
) -> ArticulationAction:
"""[summary]
Args:
start_position (np.ndarray): [description]
start_orientation (np.ndarray): [description]
goal_position (np.ndarray): [description]
lateral_velocity (float, optional): [description]. Defaults to 20.0.
yaw_velocity (float, optional): [description]. Defaults to 0.5.
heading_tol (float, optional): [description]. Defaults to 0.05.
position_tol (float, optional): [description]. Defaults to 4.0.
Returns:
ArticulationAction: [description]
"""
steering_yaw = math.atan2(
goal_position[1] - start_position[1], float(goal_position[0] - start_position[0] + 1e-5)
)
current_yaw_heading = quat_to_euler_angles(start_orientation)[-1]
yaw_error = steering_yaw - current_yaw_heading
if np.mean(np.abs(start_position[:2] - goal_position[:2])) < position_tol:
if self._is_holonomic:
command = [0.0, 0.0, 0.0]
else:
command = [0.0, 0.0]
elif abs(yaw_error) > heading_tol:
direction = 1
if yaw_error < 0:
direction = -1
if self._is_holonomic:
command = [0.0, 0.0, direction * yaw_velocity]
else:
command = [0.0, direction * yaw_velocity]
else:
if self._is_holonomic:
command = [lateral_velocity, 0.0, 0.0]
else:
command = [lateral_velocity, 0]
return self._open_loop_wheel_controller.forward(command)
def reset(self) -> None:
"""[summary]
"""
return
| 3,614 | Python | 40.079545 | 116 | 0.586608 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/articulation_kinematics_solver.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import carb
from omni.isaac.core.utils.types import ArticulationAction
from omni.isaac.core.articulations import Articulation, ArticulationSubset
from omni.isaac.motion_generation.kinematics_interface import KinematicsSolver
from typing import Optional, Tuple
import numpy as np
class ArticulationKinematicsSolver:
"""Wrapper class for computing robot kinematics in a way that is easily transferable to the simulated robot Articulation. A KinematicsSolver
computes FK and IK at any frame, possibly only using a subset of joints available on the simulated robot.
This wrapper simplifies computing the current position of the simulated robot's end effector, as well as wrapping an IK result in an ArticulationAction that is
recognized by the robot Articulation
Args:
robot_articulation (Articulation): Initialized robot Articulation object representing the simulated USD robot
kinematics_solver (KinematicsSolver): An instance of a class that implements the KinematicsSolver
end_effector_frame_name (str): The name of the robot's end effector frame. This frame must appear in kinematics_solver.get_all_frame_names()
"""
def __init__(
self, robot_articulation: Articulation, kinematics_solver: KinematicsSolver, end_effector_frame_name: str
):
self._robot_articulation = robot_articulation
self._kinematics_solver = kinematics_solver
self.set_end_effector_frame(end_effector_frame_name)
self._joints_view = ArticulationSubset(robot_articulation, kinematics_solver.get_joint_names())
return
def compute_end_effector_pose(self, position_only=False) -> Tuple[np.array, np.array]:
"""Compute the pose of the robot end effector using the simulated robot's current joint positions
Args:
position_only (bool): If True, only the frame positions need to be calculated. The returned rotation may be left undefined.
Returns:
Tuple[np.array,np.array]:
position: Translation vector describing the translation of the robot end effector relative to the USD global frame (in stage units)
rotation: (3x3) rotation matrix describing the rotation of the frame relative to the USD stage global frame
"""
joint_positions = self._joints_view.get_joint_positions()
if joint_positions is None:
carb.log_error(
"Attempted to compute forward kinematics for an uninitialized robot Articulation. Cannot get joint positions"
)
return self._kinematics_solver.compute_forward_kinematics(
self._ee_frame, joint_positions, position_only=position_only
)
def compute_inverse_kinematics(
self,
target_position: np.array,
target_orientation: Optional[np.array] = None,
position_tolerance: Optional[float] = None,
orientation_tolerance: Optional[float] = None,
) -> Tuple[ArticulationAction, bool]:
"""
Compute inverse kinematics for the end effector frame using the current robot position as a warm start. The result is returned
in an articulation action that can be directly applied to the robot.
Args:
target_position (np.array): target translation of the target frame (in stage units) relative to the USD stage origin
target_orientation (np.array): target orientation of the target frame relative to the USD stage global frame. Defaults to None.
position_tolerance (float): l-2 norm of acceptable position error (in stage units) between the target and achieved translations. Defaults to None.
orientation tolerance (float): magnitude of rotation (in radians) separating the target orientation from the achieved orienatation.
orientation_tolerance is well defined for values between 0 and pi. Defaults to None.
Returns:
Tuple[ArticulationAction, bool]:
ik_result: An ArticulationAction that can be applied to the robot to move the end effector frame to the desired position.
success: Solver converged successfully
"""
warm_start = self._joints_view.get_joint_positions()
if warm_start is None:
carb.log_error(
"Attempted to compute inverse kinematics for an uninitialized robot Articulation. Cannot get joint positions"
)
ik_result, succ = self._kinematics_solver.compute_inverse_kinematics(
self._ee_frame, target_position, target_orientation, warm_start, position_tolerance, orientation_tolerance
)
return ArticulationAction(joint_positions=self._joints_view.map_to_articulation_order(ik_result)), succ
def set_end_effector_frame(self, end_effector_frame_name: str) -> None:
"""Set the name for the end effector frame. If the frame is not recognized by the internal KinematicsSolver instance, an error will be thrown
Args:
end_effector_frame_name (str): Name of the robot end effector frame.
"""
if end_effector_frame_name not in self._kinematics_solver.get_all_frame_names():
carb.log_error(
"Frame name"
+ end_effector_frame_name
+ " not recognized by KinematicsSolver. Use KinematicsSolver.get_all_frame_names() to get a list of valid frames"
)
self._ee_frame = end_effector_frame_name
def get_end_effector_frame(self) -> str:
"""Get the end effector frame
Returns:
str: Name of the end effector frame
"""
return self._ee_frame
def get_joints_subset(self) -> ArticulationSubset:
"""
Returns:
ArticulationSubset: A wrapper class for querying USD robot joint states in the order expected by the kinematics solver
"""
return self._joints_view
def get_kinematics_solver(self) -> KinematicsSolver:
"""Get the underlying KinematicsSolver instance used by this class.
Returns:
KinematicsSolver: A class that can solve forward and inverse kinematics for a specified robot.
"""
return self._kinematics_solver
| 6,659 | Python | 49.075188 | 163 | 0.697402 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/world_interface.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import carb
from typing import List, Union, Optional
import omni.isaac.core.objects
from omni.isaac.core.objects import cuboid, sphere, capsule, cylinder, cone, ground_plane
class WorldInterface:
"""Interface for translating USD world to a generic world-aware algorithm such as a MotionPolicy
"""
def __init__(self) -> None:
pass
def update_world(self, updated_obstacles: Optional[List] = None) -> None:
"""Applies all necessary updates to the internal world representation.
Args:
updated_obstacles (list, optional): If provided, only the given obstacles will have their poses updated.
For motion policies that use obstacle poses relative to the robot base (e.g. Lula based policies),
this list will be ignored if the robot base has moved because all object poses will have changed
relative to the robot. Defaults to None.
Returns:
None
"""
pass
def add_obstacle(self, obstacle: omni.isaac.core.objects, static: Optional[bool] = False) -> bool:
"""Add an obstacle
Args:
obstacle (omni.isaac.core.objects): An obstacle from the package omni.isaac.core.obstacles
The type of the obstacle will be checked, and the appropriate add function will be called \n
static (Optional[bool]): When True, the obstacle will be assumed to remain stationary relative to the USD global frame over time
Returns:
success (bool): Returns True if the obstacle type is valid and the appropriate add function has been implemented
"""
if (
isinstance(obstacle, cuboid.DynamicCuboid)
or isinstance(obstacle, cuboid.VisualCuboid)
or isinstance(obstacle, cuboid.FixedCuboid)
):
return self.add_cuboid(obstacle, static=static)
elif isinstance(obstacle, cylinder.DynamicCylinder) or isinstance(obstacle, cylinder.VisualCylinder):
return self.add_cylinder(obstacle, static=static)
elif isinstance(obstacle, sphere.DynamicSphere) or isinstance(obstacle, sphere.VisualSphere):
return self.add_sphere(obstacle, static=static)
elif isinstance(obstacle, capsule.DynamicCapsule) or isinstance(obstacle, capsule.VisualCapsule):
return self.add_capsule(obstacle, static=static)
elif isinstance(obstacle, cone.DynamicCone) or isinstance(obstacle, cone.VisualCone):
return self.add_cone(obstacle, static=static)
elif isinstance(obstacle, ground_plane.GroundPlane):
return self.add_ground_plane(obstacle)
else:
carb.log_warning(
"Obstacle added with unsuported type: "
+ str(type(obstacle))
+ "\nObstacle should be from the package omni.isaac.core.objects"
)
return False
def add_cuboid(
self, cuboid: Union[cuboid.DynamicCuboid, cuboid.FixedCuboid, cuboid.VisualCuboid], static: bool = False
) -> bool:
"""Add a block obstacle.
Args:
cuboid (core.objects.cuboid): Wrapper object for handling rectangular prism Usd Prims.
static (bool, optional): If True, indicate that cuboid will never change pose, and may be ignored in internal
world updates. Defaults to False.
Returns:
bool: Return True if underlying WorldInterface has implemented add_cuboid()
"""
carb.log_warning("Function add_cuboid() has not been implemented for this WorldInterface")
return False
def add_sphere(self, sphere: Union[sphere.DynamicSphere, sphere.VisualSphere], static: bool = False) -> bool:
"""Add a sphere obstacle.
Args:
sphere (core.objects.sphere): Wrapper object for handling sphere Usd Prims.
static (bool, optional): If True, indicate that sphere will never change pose, and may be ignored in internal
world updates. Defaults to False.
Returns:
bool: Return True if underlying WorldInterface has implemented add_sphere()
"""
carb.log_warning("Function add_sphere() has not been implemented for this WorldInterface")
return False
def add_capsule(self, capsule: Union[capsule.DynamicCapsule, capsule.VisualCapsule], static: bool = False) -> bool:
"""Add a capsule obstacle.
Args:
capsule (core.objects.capsule): Wrapper object for handling capsule Usd Prims.
static (bool, optional): If True, indicate that capsule will never change pose, and may be ignored in internal
world updates. Defaults to False.
Returns:
bool: Return True if underlying WorldInterface has implemented add_capsule()
"""
carb.log_warning("Function add_capsule() has not been implemented for this WorldInterface")
return False
def add_cylinder(
self, cylinder: Union[cylinder.DynamicCylinder, cylinder.VisualCylinder], static: bool = False
) -> bool:
"""Add a cylinder obstacle.
Args:
cylinder (core.objects.cylinder): Wrapper object for handling rectangular prism Usd Prims.
static (bool, optional): If True, indicate that cuboid will never change pose, and may be ignored in internal
world updates. Defaults to False.
Returns:
bool: Return True if underlying WorldInterface has implemented add_cylinder()
"""
carb.log_warning("Function add_cylinder() has not been implemented for this WorldInterface")
return False
def add_cone(self, cone: Union[cone.DynamicCone, cone.VisualCone], static: bool = False) -> bool:
"""Add a cone obstacle.
Args:
cone (core.objects.cone): Wrapper object for handling cone Usd Prims.
static (bool, optional): If True, indicate that cone will never change pose, and may be ignored in internal
world updates. Defaults to False.
Returns:
bool: Return True if underlying WorldInterface has implemented add_cone()
"""
carb.log_warning("Function add_cone() has not been implemented for this WorldInterface")
return False
def add_ground_plane(self, ground_plane: ground_plane.GroundPlane) -> bool:
"""Add a ground_plane
Args:
ground_plane (core.objects.ground_plane.GroundPlane): Wrapper object for handling ground_plane Usd Prims.
Returns:
bool: Return True if underlying WorldInterface has implemented add_ground_plane()
"""
carb.log_warning("Function add_ground_plane() has not been implemented for this WorldInterface")
return False
def disable_obstacle(self, obstacle: omni.isaac.core.objects) -> bool:
"""Disable collision avoidance for obstacle.
Args:
obstacle (core.object): obstacle to be disabled.
Returns:
bool: Return True if obstacle was identified and successfully disabled.
"""
carb.log_warning("Function disable_obstacle() has not been implemented for this WorldInterface")
return False
def enable_obstacle(self, obstacle: omni.isaac.core.objects) -> bool:
"""Enable collision avoidance for obstacle.
Args:
obstacle (core.object): obstacle to be enabled.
Returns:
bool: Return True if obstacle was identified and successfully enabled.
"""
carb.log_warning("Function enable_obstacle() has not been implemented for this WorldInterface")
return False
def remove_obstacle(self, obstacle: omni.isaac.core.objects) -> bool:
"""Remove obstacle from collision avoidance. Obstacle cannot be re-enabled via enable_obstacle() after
removal.
Args:
obstacle (core.object): obstacle to be removed.
Returns:
bool: Return True if obstacle was identified and successfully removed.
"""
carb.log_warning("Function remove_obstacle() has not been implemented for this WorldInterface")
return False
def reset(self) -> None:
"""Reset all state inside the WorldInterface to its initial values
"""
pass
| 8,802 | Python | 41.941463 | 140 | 0.659396 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/articulation_trajectory.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
from .trajectory import Trajectory
from omni.isaac.core.articulations import Articulation, ArticulationSubset
from omni.isaac.core.utils.types import ArticulationAction
from typing import List
import carb
class ArticulationTrajectory:
"""Wrapper class which takes in a Trajectory object and converts the output to discrete ArticulationActions that may be sent to the provided robot Articulation.
Args:
robot_articulation (Articulation): Initialized robot Articulation object representing the simulated USD robot
trajectory (Trajectory): An instance of a class that implements the Trajectory interface.
physics_dt (float): Duration of a physics step in Isaac Sim (typically 1/60 s).
"""
def __init__(self, robot_articulation: Articulation, trajectory: Trajectory, physics_dt: float) -> None:
self._articulation = robot_articulation
self._trajectory = trajectory
self._physics_dt = physics_dt
self._active_joints_view = ArticulationSubset(robot_articulation, trajectory.get_active_joints())
def get_action_at_time(self, time: float) -> ArticulationAction:
"""Get an ArticulationAction that will send the robot to the desired position/velocity at a given time in the provided Trajectory.
Args:
time (float): Time between the start and end times in the provided Trajectory. If the time is out of bounds, an error will be thrown.
Returns:
ArticulationAction: ArticulationAction that may be passed directly to the robot Articulation to send it to the desired position/velocity at the given time.
"""
if time < self._trajectory.start_time:
carb.log_error(
f"Provided time {time} is before the start time {self._trajectory.start_time} of the Trajectory"
)
if time > self._trajectory.end_time:
carb.log_error(f"Provided time {time} is after the end time {self._trajectory.end_time} of the Trajectory")
position_target, velocity_target = self._trajectory.get_joint_targets(time)
position_action_np_array = self._active_joints_view.map_to_articulation_order(position_target)
velocity_action_np_array = self._active_joints_view.map_to_articulation_order(velocity_target)
return ArticulationAction(joint_positions=position_action_np_array, joint_velocities=velocity_action_np_array)
def get_action_sequence(self, timestep: float = None) -> List[ArticulationAction]:
"""Get a sequence of ArticulationActions which sample the entire Trajectory according to the provided timestep.
Args:
timestep (float, optional): Timestep used for sampling the provided Trajectory.
A vlue of 1/60, for example, returns ArticulationActions that represent the desired position/velocity of
the robot at 1/60 second intervals. I.e. a one second trajectory with timestep=1/60 would result in 60 ArticulationActions.
When not provided, the framerate of Isaac Sim is used. Defaults to None.
Returns:
List[ArticulationAction]: Sequence of ArticulationActions that may be passed to the robot Articulation to produce the desired trajectory.
"""
if timestep is None:
timestep = self._physics_dt
actions = []
for t in np.arange(self._trajectory.start_time, self._trajectory.end_time, timestep):
actions.append(self.get_action_at_time(t))
return actions
def get_trajectory_duration(self) -> float:
"""Returns the duration of the provided Trajectory
Returns:
float: Duration of the provided trajectory
"""
return self._trajectory.end_time - self._trajectory.start_time
def get_active_joints_subset(self) -> ArticulationSubset:
"""Get view into active joints
Returns:
ArticulationSubset: Returns robot states for active joints in an order compatible with the TrajectoryGenerator
"""
return self._active_joints_view
def get_robot_articulation(self) -> Articulation:
"""Get the robot Articulation
Returns:
Articulation: Articulation object describing the robot.
"""
return self._articulation
def get_trajectory(self) -> Trajectory:
return self._trajectory
| 4,831 | Python | 46.372549 | 167 | 0.704616 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/interface_helper.py | import lula
import numpy as np
from .world import LulaWorld
from typing import List, Tuple, Union, Optional
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices
from omni.isaac.core.utils.string import find_unique_string_name
from omni.isaac.core.utils.prims import is_prim_path_valid, delete_prim
from omni.isaac.core.utils.stage import get_stage_units
from omni.isaac.core.prims.xform_prim import XFormPrim
from omni.isaac.core import objects
from . import utils as lula_utils
class LulaInterfaceHelper(LulaWorld):
"""
Class containing functions common in Lula based algorithms. The main utility of this class is handling the tracking of the robot base
and returning basic robot information
"""
def __init__(self, robot_description: lula.RobotDescription):
LulaWorld.__init__(self)
self._robot_description = robot_description
self._kinematics = self._robot_description.kinematics()
self._robot_base_moved = False
self._robot_pos, self._robot_rot = np.zeros(3), np.eye(3)
self._meters_per_unit = get_stage_units()
def set_robot_base_pose(self, robot_position: np.array, robot_orientation: np.array) -> None:
"""Update position of the robot base. Until this function is called, Lula will assume the base pose
to be at the origin with identity rotation.
Args:
robot_position (np.array): (3 x 1) translation vector describing the translation of the robot base relative to the USD stage origin.
The translation vector should be specified in the units of the USD stage
robot_orientation (np.array): (4 x 1) quaternion describing the orientation of the robot base relative to the USD stage global frame
"""
# all object poses are relative to the position of the robot base
robot_position = robot_position * self._meters_per_unit
robot_rot = quats_to_rot_matrices(robot_orientation)
if np.any(self._robot_pos - robot_position) or np.any(self._robot_rot - robot_rot):
self._robot_base_moved = True
else:
self._robot_base_moved = False
self._robot_pos = robot_position
self._robot_rot = robot_rot
def get_active_joints(self):
return [
self._robot_description.c_space_coord_name(i) for i in range(self._robot_description.num_c_space_coords())
]
def get_watched_joints(self) -> List:
"""Lula does not currently support watching joint states that are not controllable
Returns:
(List): Always returns an empty list.
"""
return []
def get_end_effector_pose(self, active_joint_positions: np.array, frame_name: str) -> Tuple[np.array, np.array]:
"""Return pose of robot end effector given current joint positions.
The end effector position will be transformed into world coordinates based
on the believed position of the robot base. See set_robot_base_pose()
Args:
active_joint_positions (np.array): positions of the active joints in the robot
Returns:
Tuple[np.array,np.array]:
end_effector_translation: (3x1) translation vector for the robot end effector
relative to the USD stage origin \n
end_effector_rotation: (3x3) rotation matrix describing the orientation of the
robot end effector relative to the USD global frame \n
"""
# returns pose of end effector in world coordinates
pose = self._kinematics.pose(np.expand_dims(active_joint_positions, 1), frame_name)
translation = self._robot_rot @ (pose.translation) + self._robot_pos
rotation = self._robot_rot @ pose.rotation.matrix()
return translation / self._meters_per_unit, rotation
def update_world(self, updated_obstacles: Optional[List] = None):
LulaWorld.update_world(self, updated_obstacles, self._robot_pos, self._robot_rot, self._robot_base_moved)
self._robot_base_moved = False
def add_cuboid(
self,
cuboid: Union[objects.cuboid.DynamicCuboid, objects.cuboid.FixedCuboid, objects.cuboid.VisualCuboid],
static: Optional[bool] = False,
):
return LulaWorld.add_cuboid(self, cuboid, static, self._robot_pos, self._robot_rot)
def add_sphere(
self, sphere: Union[objects.sphere.DynamicSphere, objects.sphere.VisualSphere], static: bool = False
):
return LulaWorld.add_sphere(self, sphere, static, self._robot_pos, self._robot_rot)
def add_capsule(
self, capsule: Union[objects.capsule.DynamicCapsule, objects.capsule.VisualCapsule], static: bool = False
):
return LulaWorld.add_capsule(self, capsule, static, self._robot_pos, self._robot_rot)
def reset(self):
LulaWorld.reset(self)
self._robot_base_moved = False
self._robot_pos, self._robot_rot = np.zeros(3), np.eye(3)
def _get_prim_pose_rel_robot_base(self, prim):
# returns the position of a prim relative to the position of the robot
return lula_utils.get_prim_pose_in_meters_rel_robot_base(
prim, self._meters_per_unit, self._robot_pos, self._robot_rot
)
def _get_pose_rel_robot_base(self, trans, rot):
return lula_utils.get_pose_rel_robot_base(trans, rot, self._robot_pos, self._robot_rot)
| 5,404 | Python | 42.943089 | 144 | 0.672835 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/trajectory_generator.py | # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
import carb
from typing import Tuple, List, Union
from ..trajectory import Trajectory
from .kinematics import LulaKinematicsSolver
from .utils import get_pose3
import lula
class LulaTrajectory(Trajectory):
"""Instance of Trajectory interface class for handling lula.Trajectory objects
Args:
trajectory (lula.Trajectory): C-space trajectory defined continuously
"""
def __init__(self, trajectory, active_joints):
self.trajectory = trajectory
self.active_joints = active_joints
@property
def start_time(self) -> float:
__doc__ = Trajectory.start_time.__doc__
return self.trajectory.domain().lower
@property
def end_time(self) -> float:
__doc__ = Trajectory.end_time.__doc__
return self.trajectory.domain().upper
def get_active_joints(self) -> List[str]:
__doc__ = Trajectory.get_active_joints.__doc__
return self.active_joints
def get_joint_targets(self, time) -> Tuple[np.array, np.array]:
__doc__ = Trajectory.get_joint_targets.__doc__
if time > self.end_time or time < self.start_time:
carb.log_error("Could not compute joint targets because the provided time is out of bounds")
return self.trajectory.eval(time, 0), self.trajectory.eval(time, 1)
class LulaCSpaceTrajectoryGenerator:
"""LulaCSpaceTrajectoryGenerator is a class for generating time-optimal trajectories that connect a series of
provided c-space waypoints.
Args:
robot_description_path (str): path to a robot description yaml file
urdf_path (str): path to robot urdf
"""
def __init__(self, robot_description_path: str, urdf_path: str) -> None:
self._robot_description = lula.load_robot(robot_description_path, urdf_path)
self._lula_kinematics = self._robot_description.kinematics()
self._kinematics_solver = LulaKinematicsSolver(robot_description_path, urdf_path, self._robot_description)
self._c_space_trajectory_generator = None
self._task_space_trajectory_generator = None
self._c_space_trajectory_generator = lula.create_c_space_trajectory_generator(self._lula_kinematics)
def compute_c_space_trajectory(self, waypoint_positions: np.array) -> LulaTrajectory:
"""Produce a trajectory from a set of provided c_space waypoint positions. The resulting trajectory
will use spline-based interpolation to connect the waypoints with an initial and final velocity of 0. The trajectory is time-optimal:
i.e. either the velocity, acceleration, or jerk limits are saturated at any given time to produce as trajectory with as short a duration as possible.
Args:
waypoint_positions (np.array): Set of c-space coordinates cooresponding to the output of get_active_joints().
The expected shape is (N x k) where N is the number of waypoints and k is the number of active joints.
Returns:
LulaTrajectory: Instance of the Trajectory class which specifies continuous joint_targets for the active joints over a span of time.
"""
if waypoint_positions.shape[0] < 2:
carb.log_error("LulaTrajectoryGenerator must be passed at least two waypoints")
if waypoint_positions.shape[1] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"LulaTrajectoryGenerator was passed a set of waypoints with invalid shape: {waypoint_positions.shape}."
+ f" Expecting shape ({waypoint_positions.shape[0]}, {self._lula_kinematics.num_c_space_coords()})."
+ " Make sure that the provided waypoint_positions corresponds to the output of get_active_joints()."
)
trajectory = self._c_space_trajectory_generator.generate_trajectory(waypoint_positions.astype(np.float64))
if trajectory is None:
carb.log_warn(
"LulaTrajectoryGenerator could not generate a trajectory connecting the given waypoints. Returning None"
)
return
return LulaTrajectory(trajectory, self.get_active_joints())
def get_active_joints(self) -> List[str]:
"""Return the list of joints by name that are considered to be controllable by the TrajectoryGenerator.
All inputs and outputs of the LulaTrajectoryGenerator correspond to the joints specified by get_active_joints().
Returns:
List[str]: List of joints that are used to generate the desired trajectory.
"""
return self._kinematics_solver.get_joint_names()
def set_c_space_position_limits(self, lower_position_limits: np.array, upper_position_limits: np.array) -> None:
"""Set the lower and upper position limits of the active joints to be used when generating a trajectory.
Args:
lower_position_limits (np.array): Lower position limits of active joints.
upper_position_limits (np.array): Upper position limits of active joints.
"""
if lower_position_limits.shape[0] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"Provided lower position limits have an incorrect shape: {lower_position_limits.shape}\n"
+ f"Expected shape: ({self._lula_kinematics.num_c_space_coords()},)"
+ " Make sure that the provided position limits corresponds to the output of get_active_joints()."
)
if upper_position_limits.shape[0] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"Provided upper position limits have an incorrect shape: {upper_position_limits.shape}\n"
+ f"Expected shape: ({self._lula_kinematics.num_c_space_coords()},)"
+ " Make sure that the provided position limits corresponds to the output of get_active_joints()."
)
c_space_position_lower_limits = lower_position_limits.astype(np.float64)
c_space_position_upper_limits = upper_position_limits.astype(np.float64)
self._c_space_trajectory_generator.set_position_limits(
c_space_position_lower_limits, c_space_position_upper_limits
)
def set_c_space_velocity_limits(self, velocity_limits: np.array) -> None:
"""Set the velocity limits of the active joints to be used when generating a trajectory.
Args:
velocity_limits (np.array): Velocity limits of active joints.
"""
if velocity_limits.shape[0] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"Provided velocity limits have an incorrect shape: {velocity_limits.shape}\n"
+ f"Expected shape: ({self._lula_kinematics.num_c_space_coords()},)"
+ " Make sure that the provided velocity limits corresponds to the output of get_active_joints()."
)
c_space_velocity_limits = velocity_limits.astype(np.float64)
self._c_space_trajectory_generator.set_velocity_limits(c_space_velocity_limits)
def set_c_space_acceleration_limits(self, acceleration_limits: np.array) -> None:
"""Set the acceleration limits of the active joints to be used when generating a trajectory.
Args:
acceleration_limits (np.array): Acceleration limits of active joints.
"""
if acceleration_limits.shape[0] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"Provided acceleration limits have an incorrect shape: {acceleration_limits.shape}\n"
+ f"Expected shape: ({self._lula_kinematics.num_c_space_coords()},)"
+ " Make sure that the provided acceleration limits corresponds to the output of get_active_joints()."
)
c_space_acceleration_limits = acceleration_limits.astype(np.float64)
self._c_space_trajectory_generator.set_acceleration_limits(c_space_acceleration_limits)
def set_c_space_jerk_limits(self, jerk_limits: np.array) -> None:
"""Set the jerk limits of the active joints to be used when generating a trajectory.
Args:
jerk_limits (np.array): Jerk limits of active joints.
"""
if jerk_limits.shape[0] != self._lula_kinematics.num_c_space_coords():
carb.log_error(
f"Provided jerk limits have an incorrect shape: {jerk_limits.shape}\n"
+ f"Expected shape: ({self._lula_kinematics.num_c_space_coords()},)"
+ " Make sure that the provided jerk limits corresponds to the output of get_active_joints()."
)
c_space_jerk_limits = jerk_limits.astype(np.float64)
self._c_space_trajectory_generator.set_jerk_limits(c_space_jerk_limits)
def set_solver_param(self, param_name: str, param_val: Union[int, float, str]):
"""Set solver parameters for the cspace trajectory generator. A complete list of
parameters is provided in this docstring.
'max_segment_iterations': (int)
In general, a trajectory is locally time-optimal if at least one derivative for one of the
c-space coordinates is fully saturated, with no derivative limits for any of the c-space
coordinates exceeded.
This time-optimality can be enforced for each `CubicSpline` segment or for each
`PiecewiseCubicSpline` as a whole. The former will, in general, generate trajectories with
smaller spans, but will require more expensive iterations (and thus more time) to converge.
The latter will, in general, require less iterations (and thus less time) to converge, but
the generated trajectories will tend to have longer spans.
When attempting to find a time-optimal trajectory, the (more expensive) per-segment method
will first be attempted for `max_per_segment_iterations`. Then, if not yet converged, the
method acting on the entire spline will be attempted for `max_aggregate_iterations`.
To maximize speed, `max_segment_iterations` should be relatively low (or even zero to remove
this search completely). To maximize time-optimality of the generated trajectory,
`max_segment_iterations` should be relatively high.
The sum of `max_segment_iterations` and `max_aggregate_iterations` must be at least 1
'max_aggragate_iterations': (int)
See max_segment_iterations
'convergence_dt': (float)
The search for optimal time values will terminate if the maximum change to any time value
during a given iteration is less than the `convergence_dt`.
`convergence_dt` must be positive.
'max_dilation_iterations': (int)
After the segment-wise and/or aggregate time-optimal search has converged or reached maximum
iterations, the resulting set of splines will be tested to see if any derivative limits are
exceeded.
If any derivative limits are exceeded, the splines will be iteratively scaled in time to
reduce the maximum achieved derivative. This process will repeat until no derivative limits
are exceeded (success) or `max_dilation_iterations_` are reached (failure).
For a well-tuned set of solver parameters, very few dilation steps should be required
(often none will be required or a single iteration is sufficient to bring a slightly
over-saturated trajectory within the derivative limits).
'dilation_dt': (float)
For the iterative dilation step described in `setMaxDilationIterations()` documentation, the
`dilation_dt` is the "epsilon" value added to the span of the trajectory that exceeds
derivative limits.
`dilation_dt` must be positive.
'min_time_span': (float)
Specify the minimum allowable time span between adjacent waypoints/endpoints.
`min_time_span` must be positive.
This is most likely to affect the time span between the endpoints and "free-position" points
that are used to enable acceleration bound constraints. If no jerk limit is provided, these free-position points may
tend to become arbitrarily close in position and time to the endpoints. This `min_time_span`
prevents this time span from approaching zero.
In general, a jerk limit is recommended for preventing abrupt changes in acceleration rather
than relying on the `min_time_span` for this purpose.
'time_split_method': (string)
Often waypoints for a trajectory may specify positions without providing time values for when
these waypoint position should be attained. In this case, we can use the distance between
waypoints to assign time values for each waypoint.
Assuming a unitary time domain s.t. t_0 = 0 and t_N = 1, we can assign the intermediate time
values according to:
t_k = t_(k-1) + (d_k / d),
where d = sum(d_k) for k = [0, N-1] and N is the number of points.
Many options exist for the computing the distance metric d_k, with common options described
below (and implemented in `ComputeTimeValues()`.
See Eqn 4.37 in "Trajectory Planning for Automatic Machines and Robots" (2008) by
Biagiotti & Melchiorri for more detailed motivations.
Valid distribution choices are given below:
'uniform':
For a "uniform distribution" w.r.t time, the positions are ignored and d_k can simply be
computed as:
d_k = 1 / (N - 1)
resulting in uniform time intervals between all points.
'chord_length':
For a "chord length distribution", the time intervals between waypoints are proportional to
the Euclidean distance between waypoints:
d_k = \|q_(k+1) - q_k\|
where q represents the position of the waypoint.
'centripetal':
For a "centripetal distribution", the time intervals between waypoints are proportional to the
square root of the Euclidean distance between waypoints:
d_k = \|q_(k+1) - q_k\|^(1/2)
where q represents the position of the waypoint.
Args:
param_name (str): Parameter name from the above list of parameters
param_val (Union[int, float, str]): Value to which the given parameter will be set
"""
self._c_space_trajectory_generator.set_solver_param(param_name, param_val)
class LulaTaskSpaceTrajectoryGenerator:
get_active_joints = LulaCSpaceTrajectoryGenerator.get_active_joints
set_c_space_position_limits = LulaCSpaceTrajectoryGenerator.set_c_space_position_limits
set_c_space_velocity_limits = LulaCSpaceTrajectoryGenerator.set_c_space_velocity_limits
set_c_space_acceleration_limits = LulaCSpaceTrajectoryGenerator.set_c_space_acceleration_limits
set_c_space_jerk_limits = LulaCSpaceTrajectoryGenerator.set_c_space_jerk_limits
set_c_space_trajectory_generator_solver_param = LulaCSpaceTrajectoryGenerator.set_solver_param
def __init__(self, robot_description_path: str, urdf_path: str) -> None:
self._robot_description = lula.load_robot(robot_description_path, urdf_path)
self._lula_kinematics = self._robot_description.kinematics()
self._kinematics_solver = LulaKinematicsSolver(robot_description_path, urdf_path, self._robot_description)
self._c_space_trajectory_generator = None
self._task_space_trajectory_generator = None
self._c_space_trajectory_generator = lula.create_c_space_trajectory_generator(self._lula_kinematics)
self._path_conversion_config = lula.TaskSpacePathConversionConfig()
def get_all_frame_names(self) -> List[str]:
"""Return a list of all frames in the robot URDF that may be used to follow a trajectory
Returns:
List[str]: List of all frame names in the robot URDF
"""
return self._lula_kinematics.frame_names()
def compute_task_space_trajectory_from_points(
self, positions: np.array, orientations: np.array, frame_name: str
) -> LulaTrajectory:
"""Return a LulaTrajectory that connects the provided positions and orientations at the specified frame in the robot.
Args:
positions (np.array): Taskspace positions that the robot end effector should pass through with shape (N x 3) where N is the number of provided positions.
Positions is assumed to be in meters.
orientations (np.array): Taskspace quaternion orientations that the robot end effector should pass through with shape (N x 4) where N is the number of provided
orientations. The length of this argument must match the length of the positions argument.
frame_name (str): Name of the end effector frame in the robot URDF.
Returns:
LulaTrajectory: Instance of the omni.isaac.motion_generation.Trajectory class. If no trajectory could be generated, None is returned.
"""
if positions.shape[0] != orientations.shape[0]:
carb.log_error(
"Provided positions must have the same number of rows as provided orientations: one for each point in the task_space."
)
return None
path_spec = lula.create_task_space_path_spec(get_pose3(positions[0], rot_quat=orientations[0]))
for i in range(1, len(positions)):
path_spec.add_linear_path(get_pose3(positions[i], rot_quat=orientations[i]))
return self.compute_task_space_trajectory_from_path_spec(path_spec, frame_name)
def compute_task_space_trajectory_from_path_spec(
self, task_space_path_spec: lula.TaskSpacePathSpec, frame_name: str
) -> LulaTrajectory:
"""Return a LulaTrajectory that follows the path specified by the provided TaskSpacePathSpec
Args:
task_space_path_spec (lula.TaskSpacePathSpec): An object describing a taskspace path
frame_name (str): Name of the end effector frame
Returns:
LulaTrajectory: Instance of the omni.isaac.motion_generation.Trajectory class. If no trajectory could be generated, None is returned.
"""
c_space_path = lula.convert_task_space_path_spec_to_c_space(
task_space_path_spec, self._lula_kinematics, frame_name, self._path_conversion_config
)
if c_space_path is None:
return None
trajectory = self._c_space_trajectory_generator.generate_trajectory(c_space_path.waypoints())
return LulaTrajectory(trajectory, self.get_active_joints())
def get_path_conversion_config(self) -> lula.TaskSpacePathConversionConfig:
"""Get a reference to the config object that lula uses to convert task-space paths to c-space paths.
The values of the returned TaskSpacePathConversionConfig object can be modified directly to affect lula task-space path conversions.
See help(lula.TaskSpacePathConversionConfig) for a detailed description of the editable parameters.
Returns:
lula.TaskSpacePathConversionConfig: Configuration class for converting from task-space paths to c-space paths.
"""
return self._path_conversion_config
| 20,057 | Python | 49.523929 | 171 | 0.672184 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/__init__.py | from .motion_policies import RmpFlow
from .kinematics import LulaKinematicsSolver
from .trajectory_generator import LulaCSpaceTrajectoryGenerator, LulaTaskSpaceTrajectoryGenerator, LulaTrajectory
from .path_planners import RRT
| 227 | Python | 44.599991 | 113 | 0.881057 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/path_planners.py | #
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
import carb
from typing import List, Union
import lula
from ..path_planning_interface import PathPlanner
from .interface_helper import LulaInterfaceHelper
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices
from omni.isaac.core import objects
class RRT(LulaInterfaceHelper, PathPlanner):
"""RRT is a stochastic algorithm for quickly finding a feasible path in cspace to move a robot from a starting pose to a target pose.
This class implements the PathPlanner interface, as well as exposing RRT-specific parameters.
Args:
robot_description_path (str): path to a robot description yaml file
urdf_path (str): path to robot urdf
rrt_config_path (str): path to an rrt parameter yaml file
end_effector_frame_name (str): name of the robot end effector frame (must be present in the robot urdf)
"""
def __init__(self, robot_description_path: str, urdf_path: str, rrt_config_path: str, end_effector_frame_name: str):
robot_description = lula.load_robot(robot_description_path, urdf_path)
self.end_effector_frame_name = end_effector_frame_name
LulaInterfaceHelper.__init__(self, robot_description)
world_view = self._world.add_world_view()
self.rrt_config_path = rrt_config_path
self._rrt = lula.create_motion_planner(self.rrt_config_path, self._robot_description, world_view)
self._rrt.set_param("task_space_frame_name", self.end_effector_frame_name)
self._seed = 123456
self._plan = None
self._cspace_target = None
self._taskspace_target_position = None
self._taskspace_target_rotation = None
def compute_path(self, active_joint_positions, watched_joint_positions) -> np.array:
__doc__ = PathPlanner.compute_path.__doc__
active_joint_positions = active_joint_positions.astype(np.float64)
if self._taskspace_target_position is None and self._cspace_target is not None:
self._generate_plan_to_cspace_target(active_joint_positions)
elif self._taskspace_target_position is None:
self._plan = None
else:
self._generate_plan_to_taskspace_target(active_joint_positions)
return self._plan
def set_robot_base_pose(self, robot_position: np.array, robot_orientation: np.array) -> None:
__doc__ = LulaInterfaceHelper.set_robot_base_pose.__doc__
return LulaInterfaceHelper.set_robot_base_pose(self, robot_position, robot_orientation)
def set_cspace_target(self, active_joint_targets: np.array) -> None:
__doc__ = PathPlanner.set_cspace_target.__doc__
self._cspace_target = active_joint_targets
self._taskspace_target_position = None
self._taskspace_target_rotation = None
def set_end_effector_target(self, target_translation, target_orientation=None) -> None:
__doc__ = PathPlanner.set_end_effector_target.__doc__
if target_translation is not None:
self._taskspace_target_position = (target_translation * self._meters_per_unit).astype(np.float64)
else:
self._taskspace_target_position = None
if target_orientation is not None:
target_rotation = quats_to_rot_matrices(target_orientation)
else:
target_rotation = None
self._taskspace_target_rotation = target_rotation
self._cspace_target = None
if self._taskspace_target_rotation is not None:
carb.log_warn(
"Lula's RRT implementation does not currently support orientation targets. The generated plan will ignore the orientation target"
)
def get_active_joints(self) -> List:
__doc__ = PathPlanner.get_active_joints.__doc__
return LulaInterfaceHelper.get_active_joints(self)
def get_watched_joints(self) -> List:
return LulaInterfaceHelper.get_watched_joints(self)
def add_obstacle(self, obstacle: objects, static: bool = False) -> bool:
__doc__ = PathPlanner.add_obstacle.__doc__
return PathPlanner.add_obstacle(self, obstacle, static)
def add_cuboid(
self,
cuboid: Union[objects.cuboid.DynamicCuboid, objects.cuboid.FixedCuboid, objects.cuboid.VisualCuboid],
static: bool = False,
) -> bool:
return LulaInterfaceHelper.add_cuboid(self, cuboid, static)
def add_sphere(
self, sphere: Union[objects.sphere.DynamicSphere, objects.sphere.VisualSphere], static: bool = False
) -> bool:
return LulaInterfaceHelper.add_sphere(self, sphere, static)
def add_capsule(
self, capsule: Union[objects.capsule.DynamicCapsule, objects.capsule.VisualCapsule], static: bool = False
) -> bool:
return LulaInterfaceHelper.add_capsule(self, capsule, static)
def add_ground_plane(self, ground_plane: objects.ground_plane.GroundPlane) -> bool:
return LulaInterfaceHelper.add_ground_plane(self, ground_plane)
def disable_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.disable_obstacle(self, obstacle)
def enable_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.enable_obstacle(self, obstacle)
def remove_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.remove_obstacle(self, obstacle)
def update_world(self, updated_obstacles: List = None) -> None:
LulaInterfaceHelper.update_world(self, updated_obstacles)
self._rrt.update_world_view()
def reset(self) -> None:
LulaInterfaceHelper.reset(self)
self._rrt = lula.create_motion_planner(
self.rrt_config_path, self._robot_description, self._world.add_world_view()
)
self._rrt.set_param("task_space_frame_name", self.end_effector_frame_name)
self._seed = 123456
def set_max_iterations(self, max_iter: int) -> None:
"""Set the maximum number of iterations of RRT before a failure is returned
Args:
max_iter (int): Maximum number of iterations of RRT before a failure is returned.
The time it takes to return a failure scales quadratically with max_iter
"""
self._rrt.set_param("max_iterations", max_iter)
def set_random_seed(self, random_seed: int) -> None:
"""Set the random seed that RRT uses to generate a solution
Args:
random_seed (int): Used to initialize random sampling. random_seed must be positive.
"""
self._seed = random_seed
def set_param(self, param_name: str, value: Union[np.array, float, int, str]) -> bool:
"""Set a parameter for the RRT algorithm. The parameters and their appropriate values are enumerated below:
`seed` (int):
-Used to initialize random sampling.
-`seed` must be positive.
-This parameter may also be set through the set_random_seed() function
`step_size` (float):
-Step size for tree extension.
-It is assumed that a straight path connecting two valid c-space configurations with
separation distance <= `step_size` is a valid edge, where separation distance is defined
as the L2-norm of the difference between the two configurations.
-`step_size` must be positive.
`max_iterations` (int)
- Maximum number of iterations of tree extensions that will be attempted.
- If `max_iterations` is reached without finding a valid path, the `Results` will
indicate `path_found` is `false` and `path` will be an empty vector.
- `max_iterations` must be positive.
`distance_metric_weights` (np.array[np.float64[num_dof,]])
- When selecting a node for tree extension, the closest node is defined using a weighted, squared L2-norm:
distance = (q0 - q1)^T * W * (q0 - q1)
where q0 and q1 represent two configurations and W is a diagonal matrix formed from
`distance_metric_weights`.
- The length of the `distance_metric_weights` must be equal to the number of c-space
coordinates for the robot and each weight must be positive.
`task_space_frame_name` (string)
- Indicate the name (from URDF) of the frame to be used for task space planning.
- With current implementation, setting a `task_space_frame_name` that is not found in the
kinematics will throw an exception rather than failing gracefully.
`task_space_limits` (np.array[np.float64[3,2]])
- Task space limits define a bounding box used for sampling task space when planning
a path to a task space target.
- The specified `task_space_limits` should be a (3 x 2) matrix. Rows correspond to the xyz
dimensions of the bounding box, and columns 0 and 1 correspond to the lower and upper limit repectively.
- Each upper limit must be >= the corresponding lower limit.
`c_space_planning_params/exploration_fraction` (float)
- The c-space planner uses RRT-Connect to try to find a path to a c-space target.
- RRT-Connect attempts to iteratively extend two trees (one from the initial configuration and one from the target configuration)
until the two trees can be connected. The
configuration to which a tree is extended can be either a random sample
(i.e., exploration) or a node on the tree to which connection is desired
(i.e., exploitation). The `exploration_fraction` controls the fraction of steps that are
exploration steps. It is generally recommended to set `exploration_fraction` in range
[0.5, 1), where 1 corresponds to a single initial exploitation step followed by only
exploration steps. Values of between [0, 0.5) correspond to more exploitation than
exploration and are not recommended. If a value outside range [0, 1] is provided, a
warning is logged and the value is clamped to range [0, 1].
- A default value of 0.5 is recommended as a starting value for initial testing with a given
system.
`task_space_planning_params/x_target_zone_tolerance` (np.array[np.float64[3,]])
- A configuration has reached the task space target when task space position, x(i), is in
the range x_target(i) +/- x_target_zone_tolerance(i).
- It is assumed that a valid configuration within the target tolerance can be moved directly
to the target configuration using Jacobian transpose control.
- In general, it is recommended that the target zone bounding box have dimensions close to
the `step_size`.
`task_space_planning_params/x_target_final_tolerance` (float)
- Once a path is found that terminates within `x_target_zone_tolerance`, a numeric solver is
used to find a configuration space solution corresponding to the task space target. This
solver terminates when the L2-norm of the corresponding task space position is within
`x_target_final_tolerance` of the target.
- Note: This solver assumes that if a c-space configuration within `x_target_zone_tolerance`
is found then this c-space configuration can be extended towards the task space target
using the Jacobian transpose method. If this assumption is NOT met, the returned path will
not reach the task space target within the `x_target_final_tolerance` and an error is
logged.
- The recommended default value is 1e-5, but in general this value should be set to a
positive value that is considered "good enough" precision for the specific system.
`task_space_planning_params/task_space_exploitation_fraction` (float)
- Fraction of iterations for which tree is extended towards target position in task space.
- Must be in range [0, 1]. Additionally, the sum of `task_space_exploitation_fraction` and
`task_space_exploration_fraction` must be <= 1.
- A default value of 0.4 is recommended as a starting value for initial testing with a given
system.
`task_space_planning_params/task_space_exploration_fraction` (float)
- Fraction of iterations for which tree is extended towards random position in task space.
- Must be in range [0, 1]. Additionally, the sum of `task_space_exploitation_fraction` and
`task_space_exploration_fraction` must be <= 1.
- A default value of 0.1 is recommended as a starting value for initial testing with a given
system.
The remaining fraction beyond `task_space_exploitation_fraction` and
`task_space_exploration_fraction` is a `c_space_exploration_fraction` that is
implicitly defined as:
1 - (`task_space_exploitation_fraction` + `task_space_exploration_fraction`)
In general, easier path searches will take less time with higher exploitation fraction
while more difficult searches will waste time if the exploitation fraction is too high
and benefit from greater combined exploration fraction.
Args:
param_name (str): Name of parameter
value (Union[np.ndarray[np.float64],float,int,str]): value of parameter
Returns:
bool: True if the parameter was set successfully
"""
if param_name == "seed":
self.set_random_seed(value)
return
if param_name == "task_space_limits":
value = [self._rrt.Limit(row[0], row[1]) for row in value]
return self._rrt.set_param(param_name, value)
def _generate_plan_to_cspace_target(self, joint_positions):
if self._cspace_target is None:
self._plan = None
return
plan = self._rrt.plan_to_cspace_target(joint_positions, self._cspace_target)
if plan.path_found:
self._plan = np.array(plan.path)
else:
self._plan = None
def _generate_plan_to_taskspace_target(self, joint_positions):
if self._taskspace_target_position is None:
self._plan = None
return
trans_rel, _ = LulaInterfaceHelper._get_pose_rel_robot_base(self, self._taskspace_target_position, None)
self._rrt.set_param("seed", self._seed)
plan = self._rrt.plan_to_task_space_target(joint_positions, trans_rel, generate_interpolated_path=False)
if plan.path_found:
self._plan = np.array(plan.path)
else:
self._plan = None
| 15,356 | Python | 47.907643 | 146 | 0.660328 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/kinematics.py | from ...motion_generation.kinematics_interface import KinematicsSolver
from .interface_helper import LulaInterfaceHelper
import lula
import numpy as np
from typing import Tuple, List, Optional
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices
from omni.isaac.core.utils.stage import get_stage_units
from . import utils as lula_utils
class LulaKinematicsSolver(KinematicsSolver):
"""A Lula-based implementaion of the KinematicsSolver interface. Lula uses a URDF file describing the robot and
a custom yaml file that specifies the cspace of the robot and other parameters.
This class provides functions beyond the specified interface for getting and setting solver parameters.
Args:
robot_description_path (str): path to a robot description yaml file describing the cspace of the robot and other relevant parameters
urdf_path (str): path to a URDF file describing the robot
robot_description (Optional[lula.RobotDescription]): An initialized lula.RobotDescription object. Other Lula-based classes such as RmpFlow may use
a lula.RobotDescription object that they have already created to initialize a LulaKinematicsSolver. When specified, the provided file paths are unused.
Defaults to None.
"""
def __init__(
self, robot_description_path: str, urdf_path: str, robot_description: Optional[lula.RobotDescription] = None
):
# Other Lula classes may initialize a KinematicsSolver using a pre-existing lula robot_description
if robot_description is None:
self._robot_description = lula.load_robot(robot_description_path, urdf_path)
else:
self._robot_description = robot_description
self._kinematics = self._robot_description.kinematics()
self._ik_config = lula.CyclicCoordDescentIkConfig()
LulaInterfaceHelper.__init__(self, self._robot_description) # for tracking robot base
self._meters_per_unit = get_stage_units()
self._default_orientation_tolerance = self._lula_orientation_tol_to_rad_tol(
self._ik_config.orientation_tolerance
)
self._default_position_tolerance = self._ik_config.position_tolerance
self._default_orientation_weight = self._ik_config.orientation_weight
self._default_max_iter = self._ik_config.max_iterations_per_descent
self._default_descent_termination_delta = self._ik_config.descent_termination_delta
self._default_cspace_seeds = []
def set_robot_base_pose(self, robot_position: np.array, robot_orientation: np.array) -> None:
LulaInterfaceHelper.set_robot_base_pose(self, robot_position, robot_orientation)
def get_joint_names(self) -> List[str]:
return LulaInterfaceHelper.get_active_joints(self)
def get_all_frame_names(self) -> List[str]:
return self._kinematics.frame_names()
def compute_forward_kinematics(
self, frame_name: str, joint_positions: np.array, position_only: Optional[bool] = False
) -> Tuple[np.array, np.array]:
""" Compute the position of a given frame in the robot relative to the USD stage global frame
Args:
frame_name (str): Name of robot frame on which to calculate forward kinematics
joint_positions (np.array): Joint positions for the joints returned by get_joint_names()
position_only (bool): Lula Kinematics ignore this flag and always computes both position and orientation
Returns:
Tuple[np.array,np.array]:
frame_positions: (3x1) vector describing the translation of the frame relative to the USD stage origin
frame_rotation: (3x3) rotation matrix describing the rotation of the frame relative to the USD stage global frame
"""
return LulaInterfaceHelper.get_end_effector_pose(self, joint_positions, frame_name)
def compute_inverse_kinematics(
self,
frame_name: str,
target_position: np.array,
target_orientation: np.array = None,
warm_start: np.array = None,
position_tolerance: float = None,
orientation_tolerance: float = None,
) -> Tuple[np.array, bool]:
"""Compute joint positions such that the specified robot frame will reach the desired translations and rotations.
Lula Kinematics interpret the orientation tolerance as being the maximum rotation separating any standard axes.
e.g. For a tolerance of .1: The X axes, Y axes, and Z axes of the rotation matrices may independently be as far as .1 radians apart
Default values for position and orientation tolerances may be seen and changed with setter and getter functions.
Args:
frame_name (str): name of the target frame for inverse kinematics
target_position (np.array): target translation of the target frame (in stage units) relative to the USD stage origin
target_orientation (np.array): target orientation of the target frame relative to the USD stage global frame. Defaults to None.
warm_start (np.array): a starting position that will be used when solving the IK problem. If default cspace seeds have been set,
the warm start will be given priority, but the default seeds will still be used. Defaults to None.
position_tolerance (float): l-2 norm of acceptable position error (in stage units) between the target and achieved translations. Defaults to None.
orientation tolerance (float): magnitude of rotation (in radians) separating the target orientation from the achieved orienatation.
orientation_tolerance is well defined for values between 0 and pi. Defaults to None.
Returns:
Tuple[np.array,bool]:
joint_positions: in the order specified by get_joint_names() which result in the target frame acheiving the desired position
success: True if the solver converged to a solution within the given tolerances
"""
if position_tolerance is None:
self._ik_config.position_tolerance = self._default_position_tolerance
else:
self._ik_config.position_tolerance = position_tolerance * self._meters_per_unit
if orientation_tolerance is None:
self._ik_config.orientation_tolerance = self._rad_tol_to_lula_orientation_tol(
self._default_orientation_tolerance
)
else:
self._ik_config.orientation_tolerance = self._rad_tol_to_lula_orientation_tol(orientation_tolerance)
if target_orientation is None:
target_orientation = np.array([1, 0, 0, 0])
self._ik_config.orientation_tolerance = 2.0
self._ik_config.orientation_weight = 0.0
else:
self._ik_config.orientation_weight = self._default_orientation_weight
rot = quats_to_rot_matrices(target_orientation).astype(np.float64)
pos = target_position.astype(np.float64) * self._meters_per_unit
pos, rot = LulaInterfaceHelper._get_pose_rel_robot_base(self, pos, rot)
target_pose = lula_utils.get_pose3(pos, rot)
if warm_start is not None:
seeds = [warm_start]
seeds.extend(self._default_cspace_seeds)
self._ik_config.cspace_seeds = seeds
else:
self._ik_config.cspace_seeds = self._default_cspace_seeds
results = lula.compute_ik_ccd(self._kinematics, target_pose, frame_name, self._ik_config)
return results.cspace_position, results.success
def supports_collision_avoidance(self) -> bool:
"""Lula Inverse Kinematics do not support collision avoidance with USD obstacles
Returns:
bool: Always False
"""
return False
def set_orientation_weight(self, weight: float) -> None:
"""Orientation weight describes a ratio of importance betwee hitting the position and orientation target.
A weight of 0 implies that the solver cares only about the orientation target. When no orientation target is given
to compute_inverse_kinematics(), a weight of 0 is automatically used over the default.
Args:
weight (float): Ratio describing the relative importance of the orientation target vs. the position target when solving IK
"""
self._default_orientation_weight = weight
def set_default_orientation_tolerance(self, tolerance: float) -> None:
"""Default orientation tolerance to be used when calculating IK when none is specified
Args:
tolerance (float): magnitude of rotation (in radians) separating the target orientation from the achieved orienatation.
orientation_tolerance is well defined for values between 0 and pi.
"""
self._default_orientation_tolerance = tolerance
def set_default_position_tolerance(self, tolerance: float) -> None:
"""Default position tolerance to be used when calculating IK when none is specified
Args:
tolerance (float): l-2 norm of acceptable position error (in stage units) between the target and achieved translations
"""
self._default_position_tolerance = tolerance * self._meters_per_unit
def set_max_iterations(self, max_iterations: int) -> None:
"""Set the maximum number of iterations that the IK solver will attempt before giving up
Args:
max_iterations (int): maximum number of iterations that the IK solver will attempt before giving up
"""
self._ik_config.max_iterations_per_descent = max_iterations
def set_descent_termination_delta(self, delta: float) -> None:
"""Set the minimum delta between two solutions at which the IK solver may terminate due to the solution not improving anymore
Args:
delta (float): minimum delta between two solutions at which the IK solver may terminate due to the solution not improving anymore
"""
self._ik_config.descent_termination_delta
def set_default_cspace_seeds(self, seeds: np.array) -> None:
"""Set a list of cspace seeds that the solver may use as starting points for solutions
Args:
seeds (np.array): An N x num_dof list of cspace seeds
"""
self._default_cspace_seeds = seeds
def get_orientation_weight(self) -> float:
"""Orientation weight describes a ratio of importance betwee hitting the position and orientation target.
A weight of 0 implies that the solver cares only about the orientation target. When no orientation target is given
to compute_inverse_kinematics(), a weight of 0 is automatically used over the default.
Returns:
float: Ratio describing the relative importance of the orientation target vs. the position target when solving IK
"""
return self._default_orientation_weight
def get_default_orientation_tolerance(self) -> float:
"""Get the default orientation tolerance to be used when calculating IK when none is specified
Returns:
float: magnitude of rotation (in radians) separating the target orientation from the achieved orienatation.
orientation_tolerance is well defined for values between 0 and pi.
"""
return self._default_orientation_tolerance
def get_default_position_tolerance(self) -> float:
"""Get the default position tolerance to be used when calculating IK when none is specified
Returns:
float: l-2 norm of acceptable position error (in stage units) between the target and achieved translations
"""
return self._default_position_tolerance / self._meters_per_unit
def get_max_iterations(self) -> int:
"""Get the maximum number of iterations that the IK solver will attempt before giving up
Returns:
int: maximum number of iterations that the IK solver will attempt before giving up
"""
return self._ik_config.max_iterations_per_descent
def get_descent_termination_delta(self) -> float:
"""Get the minimum delta between two solutions at which the IK solver may terminate due to the solution not improving anymore
Returns:
float: minimum delta between two solutions at which the IK solver may terminate due to the solution not improving anymore
"""
return self._ik_config.descent_termination_delta
def get_default_cspace_seeds(self) -> List[np.array]:
"""Get a list of cspace seeds that the solver may use as starting points for solutions
Returns:
List[np.array]: An N x num_dof list of cspace seeds
"""
return self._default_cspace_seeds
def get_cspace_position_limits(self) -> Tuple[np.array, np.array]:
"""Get the default upper and lower joint limits of the active joints.
Returns:
Tuple[np.array, np.array]:
default_lower_joint_position_limits : Default lower position limits of active joints
default_upper_joint_position_limits : Default upper position limits of active joints
"""
num_coords = self._kinematics.num_c_space_coords()
lower = []
upper = []
for i in range(num_coords):
limits = self._kinematics.c_space_coord_limits(i)
lower.append(limits.lower)
upper.append(limits.upper)
c_space_position_upper_limits = np.array(upper, dtype=np.float64)
c_space_position_lower_limits = np.array(lower, dtype=np.float64)
return c_space_position_lower_limits, c_space_position_upper_limits
def get_cspace_velocity_limits(self) -> np.array:
"""Get the default velocity limits of the active joints
Returns:
np.array: Default velocity limits of the active joints
"""
num_coords = self._kinematics.num_c_space_coords()
c_space_velocity_limits = np.array(
[self._kinematics.c_space_coord_velocity_limit(i) for i in range(num_coords)], dtype=np.float64
)
return c_space_velocity_limits
def get_cspace_acceleration_limits(self) -> np.array:
"""Get the default acceleration limits of the active joints.
Default acceleration limits are read from the robot_description YAML file.
Returns:
np.array: Default acceleration limits of the active joints
"""
num_coords = self._kinematics.num_c_space_coords()
if self._kinematics.has_c_space_acceleration_limits():
c_space_acceleration_limits = np.array(
[self._kinematics.c_space_coord_acceleration_limit(i) for i in range(num_coords)], dtype=np.float64
)
else:
c_space_acceleration_limits = None
return c_space_acceleration_limits
def get_cspace_jerk_limits(self) -> np.array:
"""Get the default jerk limits of the active joints.
Default jerk limits are read from the robot_description YAML file.
Returns:
np.array: Default jerk limits of the active joints.
"""
num_coords = self._kinematics.num_c_space_coords()
if self._kinematics.has_c_space_jerk_limits():
c_space_jerk_limits = np.array(
[self._kinematics.c_space_coord_jerk_limit(i) for i in range(num_coords)], dtype=np.float64
)
else:
c_space_jerk_limits = None
return c_space_jerk_limits
def _lula_orientation_tol_to_rad_tol(self, tol):
# convert from lula IK orientation tolerance to radian magnitude tolerance
# This function is the inverse of _rad_tol_to_lula_orientation_tol
return np.arccos(1 - tol ** 2 / 2)
def _rad_tol_to_lula_orientation_tol(self, tol):
# convert from radian magnitude tolerance to lula IK orientation tolerance
# Orientation tolerance in Lula is defined as the maximum l2-norm between rotation matrix columns paired by index.
# e.g. rotating pi rad about the z axis maps to a norm of 2.0 when comparing the x columns
return np.linalg.norm(np.subtract([1, 0], [np.cos(tol), np.sin(tol)]))
| 16,298 | Python | 45.971181 | 164 | 0.675359 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/utils.py | import lula
from omni.isaac.core.prims.xform_prim import XFormPrim
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices
def get_prim_pose_in_meters(prim: XFormPrim, meters_per_unit: float):
pos, quat_rot = prim.get_world_pose()
rot = quats_to_rot_matrices(quat_rot)
pos *= meters_per_unit
return pos, rot
def get_prim_pose_in_meters_rel_robot_base(prim, meters_per_unit, robot_pos, robot_rot):
# returns the position of a prim relative to the position of the robot
trans, rot = get_prim_pose_in_meters(prim, meters_per_unit)
return get_pose_rel_robot_base(trans, rot, robot_pos, robot_rot)
def get_pose_rel_robot_base(trans, rot, robot_pos, robot_rot):
inv_rob_rot = robot_rot.T
if trans is not None:
trans_rel = inv_rob_rot @ (trans - robot_pos)
else:
trans_rel = None
if rot is not None:
rot_rel = inv_rob_rot @ rot
else:
rot_rel = None
return trans_rel, rot_rel
def get_pose3(trans=None, rot_mat=None, rot_quat=None) -> lula.Pose3:
"""
Get lula.Pose3 type representing a transformation.
rot_mat will take precedence over rot_quat if both are supplied
"""
if trans is None and rot_mat is None and rot_quat is None:
return lula.Pose3()
if trans is None:
if rot_mat is not None:
return lula.Pose3.from_rotation(lula.Rotation3(rot_mat))
else:
return lula.Pose3.from_rotation(lula.Rotation3(*rot_quat))
if rot_mat is None and rot_quat is None:
return lula.Pose3.from_translation(trans)
if rot_mat is not None:
return lula.Pose3(lula.Rotation3(rot_mat), trans)
else:
return lula.Pose3(lula.Rotation3(*rot_quat), trans)
| 1,742 | Python | 29.578947 | 88 | 0.663031 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/world.py | import lula
import carb
import numpy as np
from typing import List, Union, Optional
from omni.isaac.motion_generation.world_interface import WorldInterface
from omni.isaac.core import objects
from omni.isaac.core.utils.string import find_unique_string_name
from omni.isaac.core.utils.prims import is_prim_path_valid, delete_prim
from omni.isaac.core.utils.stage import get_stage_units
from .utils import get_prim_pose_in_meters_rel_robot_base, get_pose3
class LulaWorld(WorldInterface):
def __init__(self):
self._world = lula.create_world()
self._dynamic_obstacles = dict()
self._static_obstacles = dict()
self._meters_per_unit = get_stage_units()
# maintain a map of core.objects.ground_plane to ground-like cuboids that lula made to support the ground plane add function
self._ground_plane_map = dict()
def update_world(
self,
updated_obstacles: Optional[List] = None,
robot_pos: Optional[np.array] = np.zeros(3),
robot_rot: Optional[np.array] = np.eye(3),
robot_base_moved: bool = False,
) -> None:
"""Update the internal world state of Lula.
This function automatically tracks the positions of obstacles that have been added with add_obstacle()
Args:
updated_obstacles (List[core.objects], optional): Obstacles that have been added by add_obstacle() that need to be updated.
If not specified, all non-static obstacle positions will be updated.
If specified, only the obstacles that have been listed will have their positions updated
"""
if updated_obstacles is None or robot_base_moved:
# assume that all obstacle poses need to be updated
updated_obstacles = self._dynamic_obstacles.keys()
for obstacle_prim in updated_obstacles:
obstacle_handle = self._dynamic_obstacles[obstacle_prim]
trans, rot = get_prim_pose_in_meters_rel_robot_base(
obstacle_prim, self._meters_per_unit, robot_pos, robot_rot
)
pose = get_pose3(trans, rot)
self._world.set_pose(obstacle_handle, pose)
if robot_base_moved:
# update static obstacles
for (obstacle_prim, obstacle_handle) in self._static_obstacles.items():
trans, rot = get_prim_pose_in_meters_rel_robot_base(
obstacle_prim, self._meters_per_unit, robot_pos, robot_rot
)
pose = get_pose3(trans, rot)
self._world.set_pose(obstacle_handle, pose)
def add_cuboid(
self,
cuboid: Union[objects.cuboid.DynamicCuboid, objects.cuboid.FixedCuboid, objects.cuboid.VisualCuboid],
static: Optional[bool] = False,
robot_pos: Optional[np.array] = np.zeros(3),
robot_rot: Optional[np.array] = np.eye(3),
):
"""Add a block obstacle.
Args:
cuboid (core.objects.cuboid): Wrapper object for handling rectangular prism Usd Prims.
static (bool, optional): If True, indicate that cuboid will never change pose, and may be ignored in internal
world updates. Since Lula specifies object positions relative to the robot's frame
of reference, static obstacles will have their positions queried any time that
set_robot_base_pose() is called. Defaults to False.
Returns:
bool: Always True, indicating that this adder has been implemented
"""
if cuboid in self._static_obstacles or cuboid in self._dynamic_obstacles:
carb.log_warn(
"A cuboid was added twice to a Lula based MotionPolicy. This has no effect beyond adding the cuboid once."
)
return False
side_lengths = cuboid.get_size() * cuboid.get_local_scale() * self._meters_per_unit
trans, rot = get_prim_pose_in_meters_rel_robot_base(cuboid, self._meters_per_unit, robot_pos, robot_rot)
lula_cuboid = lula.create_obstacle(lula.Obstacle.Type.CUBE)
lula_cuboid.set_attribute(lula.Obstacle.Attribute.SIDE_LENGTHS, side_lengths.astype(np.float64))
lula_cuboid_pose = get_pose3(trans, rot)
world_view = self._world.add_world_view()
lula_cuboid_handle = self._world.add_obstacle(lula_cuboid, lula_cuboid_pose)
world_view.update()
if static:
self._static_obstacles[cuboid] = lula_cuboid_handle
else:
self._dynamic_obstacles[cuboid] = lula_cuboid_handle
return True
def add_sphere(
self,
sphere: Union[objects.sphere.DynamicSphere, objects.sphere.VisualSphere],
static: bool = False,
robot_pos: Optional[np.array] = np.zeros(3),
robot_rot: Optional[np.array] = np.eye(3),
) -> bool:
"""Add a sphere obstacle.
Args:
sphere (core.objects.sphere): Wrapper object for handling sphere Usd Prims.
static (bool, optional): If True, indicate that sphere will never change pose, and may be ignored in internal
world updates. Since Lula specifies object positions relative to the robot's frame
of reference, static obstacles will have their positions queried any time that
set_robot_base_pose() is called. Defaults to False.
Returns:
bool: Always True, indicating that this adder has been implemented
"""
if sphere in self._static_obstacles or sphere in self._dynamic_obstacles:
carb.log_warn(
"A sphere was added twice to a Lula based MotionPolicy. This has no effect beyond adding the sphere once."
)
return False
radius = sphere.get_radius() * self._meters_per_unit
trans, rot = get_prim_pose_in_meters_rel_robot_base(sphere, self._meters_per_unit, robot_pos, robot_rot)
lula_sphere = lula.create_obstacle(lula.Obstacle.Type.SPHERE)
lula_sphere.set_attribute(lula.Obstacle.Attribute.RADIUS, radius)
lula_sphere_pose = get_pose3(trans, rot)
lula_sphere_handle = self._world.add_obstacle(lula_sphere, lula_sphere_pose)
if static:
self._static_obstacles[sphere] = lula_sphere_handle
else:
self._dynamic_obstacles[sphere] = lula_sphere_handle
return True
def add_capsule(
self,
capsule: Union[objects.capsule.DynamicCapsule, objects.capsule.VisualCapsule],
static: bool = False,
robot_pos: Optional[np.array] = np.zeros(3),
robot_rot: Optional[np.array] = np.eye(3),
) -> bool:
"""Add a capsule obstacle.
Args:
capsule (core.objects.capsule): Wrapper object for handling capsule Usd Prims.
static (bool, optional): If True, indicate that capsule will never change pose, and may be ignored in internal
world updates. Since Lula specifies object positions relative to the robot's frame
of reference, static obstacles will have their positions queried any time that
set_robot_base_pose() is called. Defaults to False.
Returns:
bool: Always True, indicating that this function has been implemented
"""
# As of Lula 0.5.0, what Lula calls a "cylinder" is actually a capsule (i.e., the surface
# defined by the set of all points a fixed distance from a line segment). This will be
# corrected in a future release of Lula.
if capsule in self._static_obstacles or capsule in self._dynamic_obstacles:
carb.log_warn(
"A capsule was added twice to a Lula based MotionPolicy. This has no effect beyond adding the capsule once."
)
return False
radius = capsule.get_radius() * self._meters_per_unit
height = capsule.get_height() * self._meters_per_unit
trans, rot = get_prim_pose_in_meters_rel_robot_base(capsule, self._meters_per_unit, robot_pos, robot_rot)
lula_capsule = lula.create_obstacle(lula.Obstacle.Type.CYLINDER)
lula_capsule.set_attribute(lula.Obstacle.Attribute.RADIUS, radius)
lula_capsule.set_attribute(lula.Obstacle.Attribute.HEIGHT, height)
lula_capsule_pose = get_pose3(trans, rot)
lula_capsule_handle = self._world.add_obstacle(lula_capsule, lula_capsule_pose)
if static:
self._static_obstacles[capsule] = lula_capsule_handle
else:
self._dynamic_obstacles[capsule] = lula_capsule_handle
return True
def add_ground_plane(
self, ground_plane: objects.ground_plane.GroundPlane, plane_width: Optional[float] = 50.0
) -> bool:
"""Add a ground_plane.
Lula does not support ground planes directly, and instead internally creates a cuboid with an
expansive face (dimensions 200x200 stage units) coplanar to the ground_plane.
Args:
ground_plane (core.objects.ground_plane.GroundPlane): Wrapper object for handling ground_plane Usd Prims.
plane_width (Optional[float]): The width of the ground plane (in meters) that Lula creates to constrain this robot. Defaults to 50.0 m
Returns:
bool: Always True, indicating that this adder has been implemented
"""
if ground_plane in self._ground_plane_map:
carb.log_warn(
"A ground plane was added twice to a Lula based MotionPolicy. This has no effect beyond adding the ground plane once."
)
return False
plane_width = plane_width / self._meters_per_unit
# ignore the ground plane and make a block instead, as lula doesn't support ground planes
prim_path = find_unique_string_name("/lula/ground_plane", lambda x: not is_prim_path_valid(x))
ground_width = 0.001 # meters
lula_ground_plane_cuboid = objects.cuboid.VisualCuboid(
prim_path, size=1.0, scale=np.array([plane_width, plane_width, ground_width / self._meters_per_unit])
)
lula_ground_plane_translation = ground_plane.get_world_pose()[0] - (
np.array([0, 0, ground_width / 2]) / self._meters_per_unit
)
lula_ground_plane_cuboid.set_world_pose(lula_ground_plane_translation)
lula_ground_plane_cuboid.set_visibility(False)
self._ground_plane_map[ground_plane] = lula_ground_plane_cuboid
self.add_cuboid(lula_ground_plane_cuboid, static=True)
return True
def disable_obstacle(self, obstacle: objects) -> bool:
"""Disable collision avoidance for obstacle.
Args:
obstacle (core.objects): obstacle to be disabled.
Returns:
bool: Return True if obstacle was identified and successfully disabled.
"""
if obstacle in self._dynamic_obstacles:
obstacle_handle = self._dynamic_obstacles[obstacle]
elif obstacle in self._static_obstacles:
obstacle_handle = self._static_obstacles[obstacle]
elif obstacle in self._ground_plane_map:
obstacle_handle = self._static_obstacles[self._ground_plane_map[obstacle]]
else:
return False
self._world.disable_obstacle(obstacle_handle)
return True
def enable_obstacle(self, obstacle: objects) -> bool:
"""Enable collision avoidance for obstacle.
Args:
obstacle (core.objects): obstacle to be enabled.
Returns:
bool: Return True if obstacle was identified and successfully enabled.
"""
if obstacle in self._dynamic_obstacles:
obstacle_handle = self._dynamic_obstacles[obstacle]
elif obstacle in self._static_obstacles:
obstacle_handle = self._static_obstacles[obstacle]
elif obstacle in self._ground_plane_map:
obstacle_handle = self._static_obstacles[self._ground_plane_map[obstacle]]
else:
return False
self._world.enable_obstacle(obstacle_handle)
return True
def remove_obstacle(self, obstacle: objects) -> bool:
"""Remove obstacle from collision avoidance. Obstacle cannot be re-enabled via enable_obstacle() after
removal.
Args:
obstacle (core.objects): obstacle to be removed.
Returns:
bool: Return True if obstacle was identified and successfully removed.
"""
if obstacle in self._dynamic_obstacles:
obstacle_handle = self._dynamic_obstacles[obstacle]
del self._dynamic_obstacles[obstacle]
elif obstacle in self._static_obstacles:
obstacle_handle = self._static_obstacles[obstacle]
del self._static_obstacles[obstacle]
elif obstacle in self._ground_plane_map:
lula_ground_plane_cuboid = self._ground_plane_map[obstacle]
obstacle_handle = self._static_obstacles[lula_ground_plane_cuboid]
delete_prim(lula_ground_plane_cuboid.prim_path)
del self._static_obstacles[lula_ground_plane_cuboid]
del self._ground_plane_map[obstacle]
else:
return False
self._world.remove_obstacle(obstacle_handle)
return True
def reset(self) -> None:
"""reset the world to its initial state
"""
self._world = lula.create_world()
self._dynamic_obstacles = dict()
self._static_obstacles = dict()
for lula_ground_plane_cuboid in self._ground_plane_map.values():
delete_prim(lula_ground_plane_cuboid.prim_path)
self._ground_plane_map = dict()
| 13,702 | Python | 42.640127 | 147 | 0.638593 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/lula/motion_policies.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import numpy as np
import time
from typing import Tuple, List, Union
import lula
import carb
from ..motion_policy_interface import MotionPolicy
from .interface_helper import LulaInterfaceHelper
from .kinematics import LulaKinematicsSolver
from omni.isaac.core.utils.string import find_unique_string_name
from omni.isaac.core.utils.prims import is_prim_path_valid, delete_prim
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices, rot_matrices_to_quats
from omni.isaac.core.utils.math import normalized
from omni.isaac.core import objects
from pxr import Sdf
class RmpFlow(LulaInterfaceHelper, MotionPolicy):
"""
RMPflow is a real-time, reactive motion policy that smoothly guides a robot to task space targets while avoiding dynamic obstacles.
This class implements the MotionPolicy interface, as well as providing a number of RmpFlow-specific functions such as visualizing
the believed robot position and changing internal settings.
Args:
robot_description_path (str): Path to a robot description yaml file
urdf_path (str): Path to robot urdf
rmpflow_config_path (str): Path to an rmpflow parameter yaml file
end_effector_frame_name (str): Name of the robot end effector frame (must be present in the robot urdf)
maximum_substep_size (float): Maximum substep size [sec] that RmpFlow will use when internally integrating between steps of a simulation. For stability and performance,
RmpFlow rolls out the robot actions at a higher framerate than Isaac Sim. For example, while Isaac Sim may be running at 60 Hz, RmpFlow can be set to take internal
steps that are no larger than 1/300 seconds. In this case, RmpFlow will perform 5 sub-steps every time it returns an action to the 60 Hz simulation.
In general, the maximum_substep_size argument should be at most 1/200. Choosing a very small maximum_substep_size such as 1/1000 is unnecessary, as the resulting actions will not
significantly differ from a choice of 1/500, but it will internally require twice the steps to compute.
ignore_robot_state_updates (bool): Defaults to False.
If False: RmpFlow will set the internal robot state to match the arguments to compute_joint_targets(). When paired with ArticulationMotionPolicy, this means that RMPflow uses the simulated robot's state at every frame.
If True: RmpFlow will roll out the robot state internally after it is initially specified in the first call to compute_joint_targets().
"""
def __init__(
self,
robot_description_path: str,
urdf_path: str,
rmpflow_config_path: str,
end_effector_frame_name: str,
maximum_substep_size: float,
ignore_robot_state_updates=False,
) -> None:
self.maximum_substep_size = maximum_substep_size
if maximum_substep_size <= 0:
carb.log_error("maximum_substep_size argument must be positive.")
self.ignore_robot_state_updates = ignore_robot_state_updates
self.end_effector_frame_name = end_effector_frame_name
MotionPolicy.__init__(self)
robot_description = lula.load_robot(robot_description_path, urdf_path)
LulaInterfaceHelper.__init__(self, robot_description)
self._rmpflow_config_path = rmpflow_config_path
# Create RMPflow configuration.
rmpflow_config = lula.create_rmpflow_config(
rmpflow_config_path, self._robot_description, self.end_effector_frame_name, self._world.add_world_view()
)
# Create RMPflow policy.
self._policy = lula.create_rmpflow(rmpflow_config)
self._robot_joint_positions = None
self._robot_joint_velocities = None
self._end_effector_position_target = None
self._end_effector_rotation_target = None
self._collision_spheres = []
self._ee_visual = None
def set_ignore_state_updates(self, ignore_robot_state_updates) -> None:
"""An RmpFlow specific method; set an internal flag in RmpFlow: ignore_robot_state_updates
Args:
ignore_robot_state_updates (bool):
If False:
RmpFlow will set the internal robot state to match the arguments to compute_joint_targets().
When paired with ArticulationMotionPolicy, this means that RMPflow uses the simulated robot's state at every frame.
If True:
RmpFlow will roll out the robot state internally after it is initially specified in the first call to compute_joint_targets().
The caller may override this flag and directly change the internal robot state with RmpFlow.set_internal_robot_joint_states().
"""
self.ignore_robot_state_updates = ignore_robot_state_updates
def set_cspace_target(self, active_joint_targets) -> None:
"""Set a cspace target for RmpFlow. RmpFlow always has a cspace target, and setting a new cspace target does not override a position target.
RmpFlow uses the cspace target to help resolve null space behavior when a position target can be acheived in a variety of ways.
If the end effector target is explicitly set to None, RmpFlow will move the robot to the cspace target
Args:
active_joint_targets (np.array): cspace position target for active joints in the robot
"""
self._policy.set_cspace_attractor(active_joint_targets.astype(np.float64))
def update_world(self, updated_obstacles: List = None) -> None:
LulaInterfaceHelper.update_world(self, updated_obstacles)
self._policy.update_world_view()
def compute_joint_targets(
self,
active_joint_positions: np.array,
active_joint_velocities: np.array,
watched_joint_positions: np.array,
watched_joint_velocities: np.array,
frame_duration: float,
) -> Tuple[np.array, np.array]:
"""Compute robot joint targets for the next frame based on the current robot position.
RmpFlow will ignore active joint positions and velocities if it has been set to ignore_robot_state_updates
RmpFlow does not currently support watching joints that it is not actively controlling.
Args:
active_joint_positions (np.array): current positions of joints specified by get_active_joints()
active_joint_velocities (np.array): current velocities of joints specified by get_active_joints()
watched_joint_positions (np.array): current positions of joints specified by get_watched_joints()
This will always be empty for RmpFlow.
watched_joint_velocities (np.array): current velocities of joints specified by get_watched_joints()
This will always be empty for RmpFlow.
frame_duration (float): duration of the physics frame
Returns:
Tuple[np.array,np.array]:
active_joint_position_targets : Position targets for the robot in the next frame
active_joint_velocity_targets : Velocity targets for the robot in the next frame
"""
self._update_robot_joint_states(active_joint_positions, active_joint_velocities, frame_duration)
return self._robot_joint_positions, self._robot_joint_velocities
def visualize_collision_spheres(self) -> None:
"""An RmpFlow specific debugging method. This function creates visible sphere prims that match the locations and radii
of the collision spheres that RmpFlow uses to prevent robot collisions. Once created, RmpFlow will update the sphere locations
whenever its internal robot state changes. This can be used alongside RmpFlow.ignore_robot_state_updates(True) to validate RmpFlow's
internal representation of the robot as well as help tune the PD gains on the simulated robot; i.e. the simulated robot should
match the positions of the RmpFlow collision spheres over time.
Visualizing collision spheres as prims on the stage is likely to significantly slow down the framerate of the simulation. This function should only be used for debugging purposes
"""
if len(self._collision_spheres) == 0:
self._create_collision_sphere_prims(True)
else:
with Sdf.ChangeBlock():
for sphere in self._collision_spheres:
sphere.set_visibility(True)
def visualize_end_effector_position(self) -> None:
"""An RmpFlow specific debugging method. This function creates a visible cube whose translation and orientation match where RmpFlow
believes the robot end effector to be. Once created, RmpFlow will update the position of the cube whenever its internal robot state changes.
"""
if self._ee_visual is None:
self._create_ee_visual(True)
else:
self._ee_visual.set_visibility(True)
def stop_visualizing_collision_spheres(self) -> None:
"""An RmpFlow specific debugging method. This function removes the collision sphere prims created by either RmpFlow.visualize_collision_spheres() or
RmpFlow.get_collision_spheres_as_prims(). Rather than making the prims invisible, they are deleted from the stage to increase performance
"""
self.delete_collision_sphere_prims()
self._collision_spheres = []
def stop_visualizing_end_effector(self) -> None:
"""An RmpFlow specific debugging method. This function removes the end effector prim that can be created by visualize_end_effector_position() or
get_end_effector_position_as_prim()
"""
self.delete_end_effector_prim()
def get_collision_spheres_as_prims(self) -> List:
"""An RmpFlow specific debugging method. This function is similar to RmpFlow.visualize_collision_spheres(). If the collision spheres have already been added to the stage as prims,
they will be returned. If the collision spheres have not been added to the stage as prims, they will be created and returned. If created in this function, the spheres will be invisible
until RmpFlow.visualize_collision_spheres() is called.
Visualizing collision spheres on the stage is likely to significantly slow down the framerate of the simulation. This function should only be used for debugging purposes
Returns:
collision_spheres (List[core.objects.sphere.VisualSphere]): List of prims representing RmpFlow's internal collision spheres
"""
if len(self._collision_spheres) == 0:
self._create_collision_sphere_prims(False)
return self._collision_spheres
def get_end_effector_as_prim(self) -> objects.cuboid.VisualCuboid:
"""An RmpFlow specific debugging method. This function is similar to RmpFlow.visualize_end_effector_position(). If the end effector has already been visualized as a prim,
it will be returned. If the end effector is not being visualized, a cuboid will be created and returned. If created in this function, the end effector will be invisible
until RmpFlow.visualize_end_effector_position() is called.
Returns:
end_effector_prim (objects.cuboid.VisualCuboid): Cuboid whose translation and orientation match RmpFlow's believed robot end effector position.
"""
if self._ee_visual is not None:
return self._ee_visual
self._create_ee_visual(False)
return self._ee_visual
def delete_collision_sphere_prims(self) -> None:
"""An RmpFlow specific debugging method. This function deletes any prims that have been created by RmpFlow to visualize its internal collision spheres
"""
for sphere in self._collision_spheres:
delete_prim(sphere.prim_path)
self._collision_spheres = []
def delete_end_effector_prim(self) -> None:
"""An RmpFlow specific debugging method. If RmpFlow is maintaining a prim for its believed end effector position, this function will delete the prim.
"""
if self._ee_visual is not None:
delete_prim(self._ee_visual.prim_path)
self._ee_visual = None
def reset(self) -> None:
"""Reset RmpFlow to its initial state
"""
LulaInterfaceHelper.reset(self)
rmpflow_config = lula.create_rmpflow_config(
self._rmpflow_config_path,
self._robot_description,
self.end_effector_frame_name,
self._world.add_world_view(),
)
self._policy = lula.create_rmpflow(rmpflow_config)
self._robot_joint_positions = None
self._robot_joint_velocities = None
self._end_effector_position_target = None
self._end_effector_rotation_target = None
self.configure_visualize = False
self.delete_collision_sphere_prims()
self.delete_end_effector_prim()
self._collision_spheres = []
self._ee_visual = None
def set_internal_robot_joint_states(
self,
active_joint_positions: np.array,
active_joint_velocities: np.array,
watched_joint_positions: np.array,
watched_joint_velocities: np.array,
) -> None:
"""An RmpFlow specific method; this function overwrites the robot state regardless of the ignore_robot_state_updates flag.
RmpFlow does not currently support watching joints that it is not actively controlling.
Args:
active_joint_positions (np.array): current positions of joints specified by get_active_joints()
active_joint_velocities (np.array): current velocities of joints specified by get_active_joints()
watched_joint_positions (np.array): current positions of joints specified by get_watched_joints().
This will always be empty for RmpFlow.
watched_joint_velocities (np.array): current velocities of joints specified by get_watched_joints()
This will always be empty for RmpFlow.
"""
self._robot_joint_positions = active_joint_positions
self._robot_joint_velocities = active_joint_velocities
self._update_visuals()
return
def get_internal_robot_joint_states(self) -> Tuple[np.array, np.array, np.array, np.array]:
"""An RmpFlow specific method; this function returns the internal robot state that is believed by RmpFlow
Returns:
Tuple[np.array,np.array,np.array,np.array]:
active_joint_positions: believed positions of active joints
active_joint_velocities: believed velocities of active joints
watched_joint_positions: believed positions of watched robot joints. This will always be empty for RmpFlow.
watched_joint_velocities: believed velocities of watched robot joints. This will always be empty for RmpFlow.
"""
return self._robot_joint_positions, self._robot_joint_velocities, np.empty(0), np.empty(0)
def get_default_cspace_position_target(self):
"""An RmpFlow specific method; this function returns the default cspace position specified in the
Lula robot_description YAML file
Returns:
np.array: Default cspace position target used by RMPflow when none is specified.
"""
return self._robot_description.default_c_space_configuration()
def get_active_joints(self) -> List[str]:
"""Returns a list of joint names that RmpFlow is controlling.
Some articulated robot joints may be ignored by some policies. E.g., the gripper of the Franka arm is not used
to follow targets, and the RmpFlow config files excludes the joints in the gripper from the list of active
joints.
Returns:
active_joints (List[str]): Names of active joints.
The order of the joints in this list matches the order that the joints are expected
in functions like RmpFlow.compute_joint_targets(active_joint_positions, active_joint_velocities,...)
"""
return LulaInterfaceHelper.get_active_joints(self)
def get_watched_joints(self) -> List[str]:
"""Currently, RmpFlow is not capable of watching joint states that are not being directly controlled (active joints)
If RmpFlow is controlling a robot arm at the end of an externally controlled body, set_robot_base_pose() can be used to make RmpFlow aware of the robot position
This means that RmpFlow is not currently able to support controlling a set of DOFs in a robot that are not sequentially linked to each other or are not connected
via fixed transforms to the end effector.
Returns:
watched_joints (List[str]): Empty list
"""
return []
def get_end_effector_pose(self, active_joint_positions: np.array) -> Tuple[np.array, np.array]:
return LulaInterfaceHelper.get_end_effector_pose(self, active_joint_positions, self.end_effector_frame_name)
def get_kinematics_solver(self) -> LulaKinematicsSolver:
"""Return a LulaKinematicsSolver that uses the same robot description as RmpFlow. The robot base pose of the LulaKinematicsSolver
will be set to the same base pose as RmpFlow, but the two objects must then have their base poses updated separately.
Returns:
LulaKinematicsSolver: Kinematics solver using the same cspace as RmpFlow
"""
solver = LulaKinematicsSolver(None, None, robot_description=self._robot_description)
solver.set_robot_base_pose(self._robot_pos / self._meters_per_unit, rot_matrices_to_quats(self._robot_rot))
return solver
def set_end_effector_target(self, target_position=None, target_orientation=None) -> None:
__doc__ = MotionPolicy.set_end_effector_target.__doc__
if target_orientation is not None:
target_rotation = quats_to_rot_matrices(target_orientation)
else:
target_rotation = None
if target_position is not None:
self._end_effector_position_target = target_position * self._meters_per_unit
else:
self._end_effector_position_target = None
self._end_effector_rotation_target = target_rotation
self._set_end_effector_target()
def set_robot_base_pose(self, robot_position: np.array, robot_orientation: np.array) -> None:
LulaInterfaceHelper.set_robot_base_pose(self, robot_position, robot_orientation)
self._set_end_effector_target()
def add_obstacle(self, obstacle: objects, static: bool = False) -> bool:
__doc__ = MotionPolicy.add_obstacle.__doc__
return MotionPolicy.add_obstacle(self, obstacle, static)
def add_cuboid(
self,
cuboid: Union[objects.cuboid.DynamicCuboid, objects.cuboid.FixedCuboid, objects.cuboid.VisualCuboid],
static: bool = False,
) -> bool:
return LulaInterfaceHelper.add_cuboid(self, cuboid, static)
def add_sphere(
self, sphere: Union[objects.sphere.DynamicSphere, objects.sphere.VisualSphere], static: bool = False
) -> bool:
return LulaInterfaceHelper.add_sphere(self, sphere, static)
def add_capsule(
self, capsule: Union[objects.capsule.DynamicCapsule, objects.capsule.VisualCapsule], static: bool = False
) -> bool:
return LulaInterfaceHelper.add_capsule(self, capsule, static)
def add_ground_plane(self, ground_plane: objects.ground_plane.GroundPlane) -> bool:
return LulaInterfaceHelper.add_ground_plane(self, ground_plane)
def disable_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.disable_obstacle(self, obstacle)
def enable_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.enable_obstacle(self, obstacle)
def remove_obstacle(self, obstacle: objects) -> bool:
return LulaInterfaceHelper.remove_obstacle(self, obstacle)
def _set_end_effector_target(self):
target_position = self._end_effector_position_target
target_rotation = self._end_effector_rotation_target
if target_position is None and target_rotation is None:
self._policy.clear_end_effector_position_attractor()
self._policy.clear_end_effector_orientation_attractor()
return
trans, rot = LulaInterfaceHelper._get_pose_rel_robot_base(self, target_position, target_rotation)
if trans is not None:
self._policy.set_end_effector_position_attractor(trans)
else:
self._policy.clear_end_effector_position_attractor()
if rot is not None:
self._policy.set_end_effector_orientation_attractor(lula.Rotation3(rot))
else:
self._policy.clear_end_effector_orientation_attractor()
def _create_ee_visual(self, is_visible):
if self._robot_joint_positions is None:
joint_positions = np.zeros(self._robot_description.num_c_space_coords())
else:
joint_positions = self._robot_joint_positions
ee_pos, rot_mat = self.get_end_effector_pose(joint_positions)
prim_path = find_unique_string_name("/lula/end_effector", lambda x: not is_prim_path_valid(x))
self._ee_visual = objects.cuboid.VisualCuboid(prim_path, size=0.1 / self._meters_per_unit)
self._ee_visual.set_world_pose(position=ee_pos, orientation=rot_matrices_to_quats(rot_mat))
self._ee_visual.set_visibility(is_visible)
def _create_collision_sphere_prims(self, is_visible):
if self._robot_joint_positions is None:
joint_positions = self._robot_description.default_c_space_configuration()
else:
joint_positions = self._robot_joint_positions.astype(np.float64)
sphere_poses = self._policy.collision_sphere_positions(joint_positions)
sphere_radii = self._policy.collision_sphere_radii()
for i, (sphere_pose, sphere_rad) in enumerate(zip(sphere_poses, sphere_radii)):
prim_path = find_unique_string_name("/lula/collision_sphere" + str(i), lambda x: not is_prim_path_valid(x))
self._collision_spheres.append(
objects.sphere.VisualSphere(prim_path, radius=sphere_rad / self._meters_per_unit)
)
with Sdf.ChangeBlock():
for sphere, sphere_pose in zip(self._collision_spheres, sphere_poses):
sphere.set_world_pose(sphere_pose / self._meters_per_unit)
sphere.set_visibility(is_visible)
def _update_collision_sphere_prims(self):
if len(self._collision_spheres) == 0:
return
joint_positions = self._robot_joint_positions.astype(np.float64)
sphere_poses = self._policy.collision_sphere_positions(joint_positions)
for col_sphere, new_pose in zip(self._collision_spheres, sphere_poses):
col_sphere.set_world_pose(position=new_pose / self._meters_per_unit)
def _update_end_effector_prim(self):
if self._ee_visual is None:
return
ee_pos, rot_mat = self.get_end_effector_pose(self._robot_joint_positions)
self._ee_visual.set_world_pose(ee_pos, rot_matrices_to_quats(rot_mat))
def _update_visuals(self):
with Sdf.ChangeBlock():
self._update_collision_sphere_prims()
self._update_end_effector_prim()
def _update_robot_joint_states(self, joint_positions, joint_velocities, frame_duration):
if (
self._robot_joint_positions is None
or self._robot_joint_velocities is None
or not self.ignore_robot_state_updates
):
self._robot_joint_positions, self._robot_joint_velocities = self._euler_integration(
joint_positions, joint_velocities, frame_duration
)
else:
self._robot_joint_positions, self._robot_joint_velocities = self._euler_integration(
self._robot_joint_positions, self._robot_joint_velocities, frame_duration
)
self._update_visuals()
def _euler_integration(self, joint_positions, joint_velocities, frame_duration):
num_steps = np.ceil(frame_duration / self.maximum_substep_size).astype(int)
policy_timestep = frame_duration / num_steps
for i in range(num_steps):
joint_accel = self._evaluate_acceleration(joint_positions, joint_velocities)
joint_positions += policy_timestep * joint_velocities
joint_velocities += policy_timestep * joint_accel
return joint_positions, joint_velocities
def _evaluate_acceleration(self, joint_positions, joint_velocities):
joint_positions = joint_positions.astype(np.float64)
joint_velocities = joint_velocities.astype(np.float64)
joint_accel = np.zeros_like(joint_positions)
self._policy.eval_accel(joint_positions, joint_velocities, joint_accel)
return joint_accel
class RmpFlowSmoothed(RmpFlow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.desired_speed_scalar = 1.0
self.speed_scalar = 1.0
self.time_at_last_jerk_reduction = None
self.qdd = None
# Params
self.min_time_between_jerk_reductions = 0.5
self.min_speed_scalar = 0.2
self.use_big_jerk_speed_scaling = True
self.big_jerk_limit = 10.0
self.use_medium_jerk_truncation = True
self.max_medium_jerk = 7.0
self.speed_scalar_alpha_blend = 0.985 # Used for real world experiments.
self.verbose = False
def _eval_speed_scaled_accel(self, joint_positions, joint_velocities):
qdd_eval = self._evaluate_acceleration(joint_positions, joint_velocities / (self.speed_scalar))
qdd_eval *= self.speed_scalar ** 2
return qdd_eval
def _euler_integration(self, joint_positions, joint_velocities, frame_duration):
num_steps = np.ceil(frame_duration / self.maximum_substep_size).astype(int)
step_dt = frame_duration / num_steps
q = joint_positions
qd = joint_velocities
# Jerk monitoring and reduction is intended to handle jerk in physical robots. It's
# important then to use real wall-clock time when monitoring it.
now = time.time()
for i in range(num_steps):
if self.qdd is None:
self.qdd = self._eval_speed_scaled_accel(q, qd)
continue
jerk_reduction_performed = False
# Reduces the speed down to a minimum if a big jerk is experience.
if self.use_big_jerk_speed_scaling:
is_first = True
while True:
qdd_eval = self._eval_speed_scaled_accel(q, qd)
# Just go through this once. We simply want to make sure qdd_eval is evaluated
# again after the reduction.
if not is_first:
break
# Don't do jerk reductions too frequently.
if (
self.time_at_last_jerk_reduction is not None
and (now - self.time_at_last_jerk_reduction) < self.min_time_between_jerk_reductions
):
break
jerk = np.linalg.norm(qdd_eval - self.qdd)
if jerk > self.big_jerk_limit:
self.speed_scalar = self.min_speed_scalar
if self.verbose:
print("<jerk reduction> new speed scalar = %f" % self.speed_scalar)
jerk_reduction_performed = True
is_first = False
# Truncate the jerks. This addresses transient jerks.
if self.use_medium_jerk_truncation:
qdd_eval = self._eval_speed_scaled_accel(q, qd)
jerk = np.linalg.norm(qdd_eval - self.qdd)
if jerk > self.max_medium_jerk:
if self.verbose:
print("<jerk truncation>")
jerk_truncation_performed = True
v = normalized(qdd_eval - self.qdd)
qdd_eval = self.qdd + self.max_medium_jerk * v
if jerk_reduction_performed:
self.time_at_last_jerk_reduction = now
self.qdd = qdd_eval
a = self.speed_scalar_alpha_blend
self.speed_scalar = a * self.speed_scalar + (1.0 - a) * self.desired_speed_scalar
q += step_dt * qd
qd += step_dt * self.qdd
return q, qd
| 29,180 | Python | 46.681372 | 231 | 0.664599 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/tests/test_motion_policy.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import omni.kit.test
import carb
import asyncio
from pxr import Gf
# Import extension python module we are testing with absolute import path, as if we are external user (other extension)
from omni.isaac.motion_generation import ArticulationMotionPolicy, interface_config_loader
from omni.isaac.motion_generation.lula.motion_policies import RmpFlow
from omni.isaac.core.utils import distance_metrics
from omni.isaac.core.utils.stage import (
open_stage_async,
update_stage_async,
add_reference_to_stage,
create_new_stage_async,
)
from omni.isaac.core.utils.rotations import gf_quat_to_np_array, quat_to_rot_matrix
from omni.isaac.core.utils.prims import is_prim_path_valid, delete_prim
import omni.isaac.core.objects as objects
from omni.isaac.core.prims.xform_prim import XFormPrim
from omni.isaac.core.robots.robot import Robot
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.world import World
import os
import json
import numpy as np
# Having a test class derived from omni.kit.test.AsyncTestCase declared on the root of module will
# make it auto-discoverable by omni.kit.test
class TestMotionPolicy(omni.kit.test.AsyncTestCase):
# Before running each test
async def setUp(self):
self._physics_dt = 1 / 60 # duration of physics frame in seconds
self._timeline = omni.timeline.get_timeline_interface()
ext_manager = omni.kit.app.get_app().get_extension_manager()
ext_id = ext_manager.get_enabled_extension_id("omni.isaac.motion_generation")
self._articulation_policy_extension_path = ext_manager.get_extension_path(ext_id)
self._polciy_config_dir = os.path.join(self._articulation_policy_extension_path, "motion_policy_configs")
self.assertTrue(os.path.exists(os.path.join(self._polciy_config_dir, "policy_map.json")))
with open(os.path.join(self._polciy_config_dir, "policy_map.json")) as policy_map:
self._policy_map = json.load(policy_map)
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
await create_new_stage_async()
await update_stage_async()
pass
# After running each test
async def tearDown(self):
self._timeline.stop()
while omni.usd.get_context().get_stage_loading_status()[2] > 0:
print("tearDown, assets still loading, waiting to finish...")
await asyncio.sleep(1.0)
await update_stage_async()
self._articulation_policy = None
await update_stage_async()
World.clear_instance()
pass
async def _set_determinism_settings(self, robot):
World()
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
robot.disable_gravity()
robot.set_solver_position_iteration_count(64)
robot.set_solver_velocity_iteration_count(64)
async def test_rmpflow_cspace_target(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
default_target = self._motion_policy.get_default_cspace_position_target()
active_joints_subset = self._articulation_policy.get_active_joints_subset()
# Can reach just a cspace target
for i in range(180):
action = self._articulation_policy.get_next_articulation_action()
self._robot.get_articulation_controller().apply_action(action)
await update_stage_async()
if np.allclose(default_target, active_joints_subset.get_joint_positions(), atol=0.1):
break
self.assertTrue(
np.allclose(default_target, active_joints_subset.get_joint_positions(), atol=0.1),
f"{default_target} vs {active_joints_subset.get_joint_positions()}: Could not reach default cspace target in 300 frames!",
)
ee_target_position = np.array([0.5, 0, 0.5])
self._motion_policy.set_end_effector_target(ee_target_position)
new_target = np.array([1.0, 0, 1.0, -0.3, 0, 0.2, 0])
self._motion_policy.set_cspace_target(new_target)
# Check cspace attractor doesn't override the ee target
for i in range(180):
action = self._articulation_policy.get_next_articulation_action()
self._robot.get_articulation_controller().apply_action(action)
await update_stage_async()
ee_pose = self._motion_policy.get_end_effector_pose(active_joints_subset.get_joint_positions())[0]
if np.linalg.norm(ee_target_position - ee_pose) < 0.01:
break
ee_pose = self._motion_policy.get_end_effector_pose(active_joints_subset.get_joint_positions())[0]
self.assertTrue(
np.linalg.norm(ee_target_position - ee_pose) < 0.01,
f"Could not reach taskspace target target in 240 frames! {np.linalg.norm(ee_target_position - ee_pose)}",
)
self._motion_policy.set_end_effector_target(None)
# New cspace target is still active; check that robot reaches it
for i in range(250):
action = self._articulation_policy.get_next_articulation_action()
self._robot.get_articulation_controller().apply_action(action)
await update_stage_async()
if np.allclose(new_target, active_joints_subset.get_joint_positions(), atol=0.1):
break
self.assertTrue(
np.allclose(new_target, active_joints_subset.get_joint_positions(), atol=0.1),
f"Could not reach new cspace target in 250 frames! {new_target} != {active_joints_subset.get_joint_positions()}",
)
self.assertTrue(
np.allclose(self._motion_policy.get_default_cspace_position_target(), default_target),
f"{self._motion_policy.get_default_cspace_position_target()} != {default_target}",
)
async def test_rmpflow_cobotta_900(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Denso/cobotta_pro_900.usd"
robot_name = "Cobotta_Pro_900"
robot_prim_path = "/cobotta_pro_900"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_cobotta_1300(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Denso/cobotta_pro_1300.usd"
robot_name = "Cobotta_Pro_1300"
robot_prim_path = "/cobotta_pro_1300"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_ur3(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur3/ur3.usd"
robot_name = "UR3"
robot_prim_path = "/ur3"
await self._simple_robot_rmpflow_test(
usd_path, robot_prim_path, robot_name, target_pos=np.array([0.3, 0.3, 0.5])
)
async def test_rmpflow_ur3e(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur3e/ur3e.usd"
robot_name = "UR3e"
robot_prim_path = "/ur3e"
await self._simple_robot_rmpflow_test(
usd_path, robot_prim_path, robot_name, target_pos=np.array([0.3, 0.3, 0.5])
)
async def test_rmpflow_ur5(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur5/ur5.usd"
robot_name = "UR5"
robot_prim_path = "/ur5"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_ur5e(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur5e/ur5e.usd"
robot_name = "UR5e"
robot_prim_path = "/ur5e"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_ur10(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur10/ur10.usd"
robot_name = "UR10"
robot_prim_path = "/ur10"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_ur10e(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur10e/ur10e.usd"
robot_name = "UR10e"
robot_prim_path = "/ur10e"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_ur16e(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/UniversalRobots/ur16e/ur16e.usd"
robot_name = "UR16e"
robot_prim_path = "/ur16e"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_rizon4(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Flexiv/Rizon4/flexiv_rizon4.usd"
robot_name = "Rizon4"
robot_prim_path = "/A02L_MP"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_rs007l(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Kawasaki/RS007L/rs007l_onrobot_rg2.usd"
robot_name = "RS007L"
robot_prim_path = "/khi_rs007l"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_rs007n(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Kawasaki/RS007N/rs007n_onrobot_rg2.usd"
robot_name = "RS007N"
robot_prim_path = "/khi_rs007n"
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name)
async def test_rmpflow_rs013n(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Kawasaki/RS013N/rs013n_onrobot_rg2.usd"
robot_name = "RS013N"
robot_prim_path = "/khi_rs013n"
obstacle_position = np.array([0.8, 0.3, 0.8])
target_position = np.array([0.85, 0.1, 0.55])
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name, target_position, obstacle_position)
async def test_rmpflow_rs025n(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Kawasaki/RS025N/rs025n_onrobot_rg2.usd"
robot_name = "RS025N"
robot_prim_path = "/khi_rs025n"
obstacle_position = np.array([0.8, 0.3, 0.8])
target_position = np.array([0.85, 0.1, 0.55])
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name, target_position, obstacle_position)
async def test_rmpflow_rs080n(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Kawasaki/RS080N/rs080n_onrobot_rg2.usd"
robot_name = "RS080N"
robot_prim_path = "/khi_rs080n"
obstacle_position = np.array([0.8, 0.3, 0.8])
target_position = np.array([0.85, 0.1, 0.55])
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name, target_position, obstacle_position)
async def test_rmpflow_festo_cobot(self):
assets_root_path = get_assets_root_path()
usd_path = assets_root_path + "/Isaac/Robots/Festo/FestoCobot/festo_cobot.usd"
robot_name = "FestoCobot"
robot_prim_path = "/bettina"
obstacle_position = np.array([0.8, 0.3, 0.8])
target_position = np.array([0.78, 0.1, 0.55])
await self._simple_robot_rmpflow_test(usd_path, robot_prim_path, robot_name, target_position, obstacle_position)
async def _simple_robot_rmpflow_test(
self,
usd_path,
prim_path,
robot_name,
target_pos=np.array([0.6, 0.3, 0.5]),
obstacle_pos=np.array([0.3, 0.1, 0.5]),
):
(result, error) = await open_stage_async(usd_path)
rmp_config = interface_config_loader.load_supported_motion_policy_config(robot_name, "RMPflow")
self._motion_policy = RmpFlow(**rmp_config)
robot_prim_path = prim_path
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
timeout = 10
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
pass
async def test_rmpflow_visualization_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
self._motion_policy = rmp_flow_motion_policy
robot_prim_path = "/panda"
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
self._motion_policy.set_end_effector_target(np.array([0.4, 0.2, 0.4]))
self._motion_policy.visualize_collision_spheres()
self._motion_policy.visualize_end_effector_position()
test_sphere = self._motion_policy.get_collision_spheres_as_prims()[-1]
test_ee_visual = self._motion_policy.get_end_effector_as_prim()
panda_hand_prim = XFormPrim("/panda/panda_hand")
self._articulation_policy.move()
for _ in range(100):
sphere_pos, _ = test_sphere.get_world_pose()
ee_pos, _ = test_ee_visual.get_world_pose()
hand_pose, _ = panda_hand_prim.get_world_pose()
self.assertTrue(
abs(np.linalg.norm(sphere_pos - ee_pos) - 0.09014) < 0.001,
f"End effector visualization is not consistent with sphere visualization: {np.linalg.norm(sphere_pos - ee_pos)}",
)
self.assertTrue(
abs(np.linalg.norm(hand_pose - ee_pos) - 0.10) < 0.01,
f"Simulated robot moved too far from RMP belief robot: {np.linalg.norm(hand_pose - ee_pos)}",
)
self._motion_policy.update_world()
self._articulation_policy.move()
await update_stage_async()
self._motion_policy.delete_collision_sphere_prims()
self._motion_policy.delete_end_effector_prim()
self.assertTrue(not is_prim_path_valid("/lula/end_effector"))
self.assertTrue(not is_prim_path_valid("/lula/collision_sphere0"))
self._motion_policy.set_end_effector_target(np.array([0.8, 0.2, 0.8]))
test_sphere = self._motion_policy.get_collision_spheres_as_prims()[-1]
test_ee_visual = self._motion_policy.get_end_effector_as_prim()
# self._articulation_policy.move()
await update_stage_async()
for _ in range(100):
sphere_pos, _ = test_sphere.get_world_pose()
ee_pos, _ = test_ee_visual.get_world_pose()
hand_pose, _ = panda_hand_prim.get_world_pose()
self.assertTrue(
abs(np.linalg.norm(sphere_pos - ee_pos) - 0.09014) < 0.001,
f"End effector visualization is not consistent with sphere visualization: {np.linalg.norm(sphere_pos - ee_pos) }",
)
self.assertTrue(
abs(np.linalg.norm(hand_pose - ee_pos) - 0.10) < 0.01,
f"Simulated robot moved too far from RMP belief robot: {np.linalg.norm(hand_pose - ee_pos)}",
)
self._motion_policy.update_world()
self._articulation_policy.move()
await update_stage_async()
self._motion_policy.reset()
self.assertTrue(not is_prim_path_valid("/lula/end_effector"))
self.assertTrue(not is_prim_path_valid("/lula/collision_sphere0"))
async def test_rmpflow_obstacle_adders(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
# These obstacle types are supported by RmpFlow
obstacles = [
objects.cuboid.VisualCuboid("/visual_cube"),
objects.cuboid.DynamicCuboid("/dynamic_cube"),
objects.cuboid.FixedCuboid("/fixed_cube"),
objects.sphere.VisualSphere("/visual_sphere"),
objects.sphere.DynamicSphere("/dynamic_sphere"),
objects.capsule.VisualCapsule("/visual_capsule"),
objects.capsule.DynamicCapsule("/dynamic_capsule"),
objects.ground_plane.GroundPlane("/ground_plane"),
]
# check that all the supported world update functions return successfully without error
for obstacle in obstacles:
self.assertTrue(self._motion_policy.add_obstacle(obstacle))
self.assertTrue(self._motion_policy.disable_obstacle(obstacle))
self.assertTrue(self._motion_policy.enable_obstacle(obstacle))
self.assertTrue(self._motion_policy.remove_obstacle(obstacle))
# make sure lula cleaned up after removing ground plane : Lula creates a wide, flat cuboid to mimic the ground because it doesn't support ground planes directly
self.assertFalse(is_prim_path_valid("/lula/ground_plane"))
for obstacle in obstacles:
self.assertTrue(self._motion_policy.add_obstacle(obstacle))
for obstacle in obstacles:
# obstacle already in there
self.assertFalse(self._motion_policy.add_obstacle(obstacle))
self._motion_policy.reset()
for obstacle in obstacles:
# obstacles should have been deleted in reset
self.assertFalse(self._motion_policy.disable_obstacle(obstacle))
self.assertFalse(self._motion_policy.enable_obstacle(obstacle))
self.assertFalse(self._motion_policy.remove_obstacle(obstacle))
self.assertFalse(is_prim_path_valid("/lula/ground_plane"))
async def test_articulation_motion_policy_init_order(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
self._motion_policy = rmp_flow_motion_policy
self._robot = Robot(robot_prim_path)
# Make sure that initializing this before robot is initialized doesn't cause any issues
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
self._timeline.play()
await update_stage_async()
self._robot.initialize()
await self.reset_robot(self._robot)
action = self._articulation_policy.get_next_articulation_action()
pass
async def test_rmpflow_on_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
rmp_flow_motion_policy.set_ignore_state_updates(False)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
ground_truths = {
"no_target": np.array(
[
-0.004417035728693008,
-0.2752424478530884,
0.0009353954228572547,
0.032967355102300644,
0.0001806323998607695,
-0.43320316076278687,
0.004497386049479246,
None,
None,
]
),
"target_no_obstacle": np.array(
[
0.2209184467792511,
-0.27475225925445557,
0.2051529437303543,
0.014692924916744232,
-0.0313996896147728,
-0.43752315640449524,
0.00518844835460186,
None,
None,
]
),
"target_with_obstacle": np.array(
[
-0.016765182837843895,
-0.2309315949678421,
-0.2107730507850647,
-0.06896218657493591,
-0.15911254286766052,
-0.16595730185508728,
-0.004891209304332733,
None,
None,
]
),
"target_pos": np.array([0.40, 0.20, 0.40]),
"obs_pos": np.array([0.3, 0.20, 0.50]),
}
await self.verify_policy_outputs(self._robot, ground_truths, dbg=False)
timeout = 10
await self.reset_robot(self._robot)
target_pos = np.array([0.5, 0.0, 0.5])
obstacle_pos = np.array([0.5, 0.0, 0.65])
await self.verify_robot_convergence(
target_pos, timeout, target_orient=np.array([0.0, 0.0, 0.0, 1.0]), obs_pos=obstacle_pos
)
self._robot.set_world_pose(np.array([0.1, 0.6, 0]))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(1.0, 0.0, 0.0), -15).GetQuat())
self._robot.set_world_pose(np.array([0.1, 0, 0.1]), orientation=gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(0.1, 0.0, 1.0), 45).GetQuat())
trans = np.array([0.1, -0.5, 0.0])
self._robot.set_world_pose(trans, gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
pass
async def test_rmpflow_on_franka_ignore_state(self):
# Perform an internal rollout of robot state, ignoring simulated robot state updates
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
rmp_flow_motion_policy.set_ignore_state_updates(True)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
"""
verify_policy_outputs() is not used here because
1: The policy would not pass because it rolls out robot state internally rather than seeing
that the robot is not moving, so the outputs become inconsistent.
2: It is sufficient to confirm that the world state is updated correctly in
test_rmpflow_on_franka_velocity_control().
"""
await self.reset_robot(self._robot)
timeout = 10
target_pos = np.array([0.5, 0.0, 0.5])
obstacle_pos = np.array([0.5, 0.0, 0.65])
await self.verify_robot_convergence(
target_pos, timeout, target_orient=np.array([0.0, 0.0, 0.0, 1.0]), obs_pos=obstacle_pos
)
self._robot.set_world_pose(np.array([0.1, 0.6, 0]))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(1.0, 0.0, 0.0), -15).GetQuat())
self._robot.set_world_pose(np.array([0.1, 0, 0.1]), orientation=gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(0.1, 0.0, 1.0), 45).GetQuat())
trans = np.array([0.1, -0.5, 0.0])
self._robot.set_world_pose(trans, gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
pass
async def test_rmpflow_static_obstacles_franka(self):
# Perform an internal rollout of robot state, ignoring simulated robot state updates
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_prim_path = "/panda"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
rmp_flow_motion_policy.set_ignore_state_updates(True)
self._motion_policy = rmp_flow_motion_policy
robot_prim_path = "/panda"
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
timeout = 10
target_pos = np.array([0.5, 0.0, 0.5])
obstacle_pos = np.array([0.5, 0.0, 0.65])
await self.verify_robot_convergence(
target_pos, timeout, target_orient=np.array([0.0, 0.0, 0.0, 1.0]), obs_pos=obstacle_pos, static=True
)
self._robot.set_world_pose(np.array([0.1, 0.6, 0]))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos, static=True)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(1.0, 0.0, 0.0), -15).GetQuat())
self._robot.set_world_pose(np.array([0.1, 0, 0.1]), orientation=gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos, static=True)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(0.1, 0.0, 1.0), 45).GetQuat())
trans = np.array([0.1, -0.5, 0.0])
self._robot.set_world_pose(trans, gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos, static=True)
async def test_rmpflow_on_ur10(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/UR10/ur10.usd"
robot_prim_path = "/ur10"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("UR10", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
rmp_flow_motion_policy.set_ignore_state_updates(False)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
ground_truths = {
"no_target": np.array([-0.07558637, -0.035313368, -0.14294432, -0.24767338, 0.25070193, 2.879336e-10]),
"target_no_obstacle": np.array(
[-0.43079016, 0.18957902, 0.33274212, 0.46673688, -0.36309126, 6.501429e-10]
),
"target_with_obstacle": np.array(
[-0.41054526, 0.08853104, 0.3780922, 0.47682625, -0.37121844, 6.5079464e-10]
),
"target_pos": np.array([0.5, 0.0, 0.0]),
"obs_pos": np.array([0.50, 0.0, -0.20]),
}
await self.verify_policy_outputs(self._robot, ground_truths, dbg=False)
await self.reset_robot(self._robot)
timeout = 10
target_pos = np.array([0.5, 0.0, 0.7])
obstacle_pos = np.array([0.8, 0.1, 0.8])
await self.verify_robot_convergence(
target_pos, timeout, target_orient=np.array([0.0, 0.0, 0.0, 1.0]), obs_pos=obstacle_pos
)
self._robot.set_world_pose(np.array([0.1, 0.7, 0]))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(1.0, 0.0, 0.0), -15).GetQuat())
self._robot.set_world_pose(np.array([0.1, 0, 0.1]), gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(0.2, 0.0, 1.0), 90).GetQuat())
trans = np.array([0.1, -0.5, 0.0])
self._robot.set_world_pose(trans, gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
pass
async def test_rmpflow_on_ur10_ignore_state(self):
# Perform an internal rollout of robot state, ignoring simulated robot state updates
usd_path = get_assets_root_path() + "/Isaac/Robots/UR10/ur10.usd"
robot_prim_path = "/ur10"
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
rmp_flow_motion_policy_config = interface_config_loader.load_supported_motion_policy_config("UR10", "RMPflow")
rmp_flow_motion_policy = RmpFlow(**rmp_flow_motion_policy_config)
rmp_flow_motion_policy.set_ignore_state_updates(True)
self._motion_policy = rmp_flow_motion_policy
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
self._articulation_policy = ArticulationMotionPolicy(self._robot, self._motion_policy, self._physics_dt)
"""
verify_policy_outputs() is not used here because
1: The policy would not pass because it rolls out robot state internally rather than seeing
that the robot is not moving, so the outputs become inconsistent.
2: It is sufficient to confirm that the world state is updated correctly in
test_rmpflow_on_franka_velocity_control().
"""
await self.reset_robot(self._robot)
timeout = 10
target_pos = np.array([0.5, 0.0, 0.7])
obstacle_pos = np.array([0.8, 0.1, 0.8])
await self.verify_robot_convergence(
target_pos, timeout, target_orient=np.array([0.0, 0.0, 0.0, 1.0]), obs_pos=obstacle_pos
)
self._robot.set_world_pose(np.array([0.1, 0.7, 0]))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(1.0, 0.0, 0.0), -15).GetQuat())
self._robot.set_world_pose(np.array([0.1, 0, 0.1]), gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
rot_quat = Gf.Quatf(Gf.Rotation(Gf.Vec3d(0.2, 0.0, 1.0), 90).GetQuat())
trans = np.array([0.1, -0.5, 0.0])
self._robot.set_world_pose(trans, gf_quat_to_np_array(rot_quat))
await update_stage_async()
await self.verify_robot_convergence(target_pos, timeout, obs_pos=obstacle_pos)
pass
async def reached_end_effector_target(self, target_trans, target_orient, trans_thresh=0.02, rot_thresh=0.1):
ee_trans, ee_rot = self._motion_policy.get_end_effector_pose(
self._articulation_policy.get_active_joints_subset().get_joint_positions()
) # TODO this only works for RMPflow, and will be updated in upcoming MR before there are non-RMPflow tests
if target_orient is not None:
target_rot = quat_to_rot_matrix(target_orient)
else:
target_rot = None
if target_rot is None and target_trans is None:
return True
elif target_rot is None:
trans_dist = distance_metrics.weighted_translational_distance(ee_trans, target_trans)
return trans_dist < trans_thresh
elif target_trans is None:
rot_dist = distance_metrics.rotational_distance_angle(ee_rot, target_rot)
return rot_dist < rot_thresh
else:
trans_dist = distance_metrics.weighted_translational_distance(ee_trans, target_trans)
rot_dist = distance_metrics.rotational_distance_angle(ee_rot, target_rot)
return trans_dist < trans_thresh and rot_dist < rot_thresh
async def add_block(self, path, offset, size=np.array([0.01, 0.01, 0.01]), collidable=True):
if collidable:
cuboid = objects.cuboid.FixedCuboid(path, scale=size, size=1.0)
await update_stage_async()
else:
cuboid = objects.cuboid.VisualCuboid(path, scale=size, size=1.0)
await update_stage_async()
cuboid.set_world_pose(offset, np.array([1.0, 0, 0, 0]))
await update_stage_async()
return cuboid
async def assertAlmostEqual(self, a, b, msg=""):
# overriding method because it doesn't support iterables
a = np.array(a)
b = np.array(b)
self.assertFalse(np.any(abs((a[a != np.array(None)] - b[b != np.array(None)])) > 1e-3), msg)
pass
async def simulate_until_target_reached(self, timeout, target_trans, target_orient=None):
for frame in range(int(1 / self._physics_dt * timeout)):
self._motion_policy.update_world()
self._articulation_policy.move()
await omni.kit.app.get_app().next_update_async()
if await self.reached_end_effector_target(target_trans, target_orient=target_orient):
return True, frame * self._physics_dt
return False, timeout
async def reset_robot(self, robot):
"""
To make motion_generation outputs more deterministic, this method may be used to
teleport the robot to specified position targets, setting velocity to 0
This prevents changes in dynamic_control from affecting motion_generation tests
"""
robot.post_reset()
await self._set_determinism_settings(robot)
await update_stage_async()
pass
async def verify_policy_outputs(self, robot, ground_truths, dbg=False):
"""
The ground truths are obtained by running this method in dbg mode
when certain that motion_generation is working as intended.
If position_control is True, motion_generation is expected to be using position targets
In dbg mode, the returned velocity target values will be printed
and no assertions will be checked.
"""
# outputs of mg in different scenarios
no_target_truth = ground_truths["no_target"]
target_no_obs_truth = ground_truths["target_no_obstacle"]
target_obs_truth = ground_truths["target_with_obstacle"]
# where to put the target and obstacle
target_pos = ground_truths["target_pos"]
obs_pos = ground_truths["obs_pos"]
target_cube = await self.add_block("/scene/target", target_pos, size=0.05 * np.ones(3), collidable=False)
await update_stage_async()
obs = await self.add_block("/scene/obstacle", obs_pos, size=0.1 * np.ones(3))
await update_stage_async()
await self.reset_robot(robot)
await update_stage_async()
self._motion_policy.set_end_effector_target(None)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nNo target:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
no_target_truth, mg_velocity_targets, f"{no_target_truth} != {mg_velocity_targets}"
)
# Just the target
self._motion_policy.set_end_effector_target(target_pos)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nWith target:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
target_no_obs_truth, mg_velocity_targets, f"{target_no_obs_truth} != {mg_velocity_targets}"
)
# Add the obstacle
self._motion_policy.add_obstacle(obs)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nWith target and obstacle:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
target_obs_truth, mg_velocity_targets, f"{target_obs_truth} != {mg_velocity_targets}"
)
# Disable the obstacle: check that it matches no obstacle at all
self._motion_policy.disable_obstacle(obs)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nWith target and disabled obstacle:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
target_no_obs_truth, mg_velocity_targets, f"{target_no_obs_truth} != {mg_velocity_targets}"
)
# Enable the obstacle: check consistency
self._motion_policy.enable_obstacle(obs)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nWith target and enabled obstacle:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
target_obs_truth, mg_velocity_targets, f"{target_obs_truth} != {mg_velocity_targets}"
)
# Delete the obstacle: check consistency
self._motion_policy.remove_obstacle(obs)
self._motion_policy.update_world()
action = self._articulation_policy.get_next_articulation_action()
mg_velocity_targets = action.joint_velocities
if dbg:
print("\nWith target and deleted obstacle:")
for target in mg_velocity_targets:
print(target, end=",")
print()
else:
await self.assertAlmostEqual(
target_no_obs_truth, mg_velocity_targets, f"{target_no_obs_truth} != {mg_velocity_targets}"
)
delete_prim(obs.prim_path)
delete_prim(target_cube.prim_path)
return
async def verify_robot_convergence(self, target_pos, timeout, target_orient=None, obs_pos=None, static=False):
# Assert that the robot can reach the target within a given timeout
target = await self.add_block("/scene/target", target_pos, size=0.05 * np.ones(3), collidable=False)
self._motion_policy.set_robot_base_pose(*self._robot.get_world_pose())
await omni.kit.app.get_app().next_update_async()
obs_prim = None
if obs_pos is not None:
cuboid = await self.add_block("/scene/obstacle", obs_pos, size=0.1 * np.array([2.0, 3.0, 1.0]))
await update_stage_async()
self._motion_policy.add_obstacle(cuboid, static=static)
self._motion_policy.set_end_effector_target(target_pos, target_orient)
success, time_to_target = await self.simulate_until_target_reached(
timeout, target_pos, target_orient=target_orient
)
if not success:
self.assertTrue(False)
if obs_prim is not None:
self._motion_policy.remove_obstacle(cuboid)
return
| 44,785 | Python | 41.211122 | 168 | 0.627844 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/tests/test_path_planner.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
import omni.kit.test
import carb
import asyncio
# Import extension python module we are testing with absolute import path, as if we are external user (other extension)
from omni.isaac.motion_generation import (
PathPlannerVisualizer,
interface_config_loader,
LulaKinematicsSolver,
ArticulationKinematicsSolver,
)
from omni.isaac.motion_generation.lula.path_planners import RRT
from omni.isaac.core.utils.stage import (
open_stage_async,
add_reference_to_stage,
create_new_stage_async,
update_stage_async,
)
from omni.isaac.core.objects import FixedCuboid, VisualCuboid
from omni.isaac.core.objects.ground_plane import GroundPlane
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.robots import Robot
from omni.isaac.core.utils.numpy.rotations import euler_angles_to_quats
from omni.isaac.core.prims import GeometryPrimView
from omni.isaac.core.utils.viewports import set_camera_view
from omni.isaac.core.world import World
import os
import json
import numpy as np
# Having a test class derived from omni.kit.test.AsyncTestCase declared on the root of module will
# make it auto-discoverable by omni.kit.test
class TestPathPlanner(omni.kit.test.AsyncTestCase):
# Before running each test
async def setUp(self):
self._physics_dt = 1 / 60 # duration of physics frame in seconds
self._timeline = omni.timeline.get_timeline_interface()
ext_manager = omni.kit.app.get_app().get_extension_manager()
ext_id = ext_manager.get_enabled_extension_id("omni.isaac.motion_generation")
self._articulation_policy_extension_path = ext_manager.get_extension_path(ext_id)
self._polciy_config_dir = os.path.join(self._articulation_policy_extension_path, "motion_policy_configs")
self.assertTrue(
os.path.exists(os.path.join(self._polciy_config_dir, "policy_map.json")),
f'{os.path.join(self._polciy_config_dir, "policy_map.json")}',
)
with open(os.path.join(self._polciy_config_dir, "policy_map.json")) as policy_map:
self._policy_map = json.load(policy_map)
await update_stage_async()
robot_prim_path = "/panda"
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
await create_new_stage_async()
await update_stage_async()
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
set_camera_view(
eye=[0.7 * 2.95, 0.7 * 3.3, 0.7 * 5.5], target=[0, 0, 0], camera_prim_path="/OmniverseKit_Persp"
)
rrt_config = interface_config_loader.load_supported_path_planner_config("Franka", "RRT")
rrt = RRT(**rrt_config)
# rrt.set_random_seed(1234569)
rrt.set_max_iterations(10000)
rrt.set_param("step_size", 0.01)
self._planner = rrt
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self.reset_robot(self._robot)
gripper_geoms = GeometryPrimView("/panda/panda_.*finger/geometry", collisions=np.ones(2))
gripper_geoms.disable_collision()
hand_geom = GeometryPrimView("/panda/panda_hand/geometry", collisions=np.ones(1))
hand_geom.disable_collision()
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config("Franka")
self._kinematics_solver = LulaKinematicsSolver(**kinematics_config)
self._articulation_kinematics_solver = ArticulationKinematicsSolver(
self._robot, self._kinematics_solver, "right_gripper"
)
self._planner_visualizer = PathPlannerVisualizer(self._robot, self._planner)
self.PRINT_GOLDEN_VALUES = False
self.TEST_FOR_DETERMINISM = (
False
) # Right now RRT paths are not deterministic across different machines. Later this will be fixed, and determinism will be tested
# After running each test
async def tearDown(self):
self._timeline.stop()
while omni.usd.get_context().get_stage_loading_status()[2] > 0:
print("tearDown, assets still loading, waiting to finish...")
await asyncio.sleep(1.0)
await update_stage_async()
self._articulation_policy = None
await update_stage_async()
World.clear_instance()
pass
async def _set_determinism_settings(self, robot):
World()
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
robot.disable_gravity()
robot.set_solver_position_iteration_count(64)
robot.set_solver_velocity_iteration_count(64)
async def reset_robot(self, robot):
"""
To make motion_generation outputs more deterministic, this method may be used to
teleport the robot to specified position targets, setting velocity to 0
This prevents changes in dynamic_control from affecting motion_generation tests
"""
robot.post_reset()
await self._set_determinism_settings(robot)
await update_stage_async()
pass
async def test_set_params(self):
self._planner.set_param("seed", 5)
self._planner.set_param("step_size", 0.001)
self._planner.set_param("max_iterations", 1000)
self._planner.set_param("distance_metric_weights", np.ones(7, dtype=np.float64) * 0.8)
self._planner.set_param("task_space_frame_name", "panda_hand")
self._planner.set_param("task_space_limits", np.array([[-1, 1], [-1, 1], [0, 1]], dtype=np.float64))
self._planner.set_param("c_space_planning_params/exploration_fraction", 0.6)
self._planner.set_param(
"task_space_planning_params/x_target_zone_tolerance", np.ones(3, dtype=np.float64) * 0.02
)
self._planner.set_param("task_space_planning_params/x_target_final_tolerance", 1e-4)
self._planner.set_param("task_space_planning_params/task_space_exploitation_fraction", 0.5)
self._planner.set_param("task_space_planning_params/task_space_exploration_fraction", 0.2)
self._planner.reset()
async def test_rrt_franka(self):
target_pose = np.array([-0.4, 0.3, 0.5])
self._planner.set_end_effector_target(target_pose)
# Check that this doesn't mess anything up
self._planner.set_cspace_target(np.zeros(7)) # Should just be overridden
self._planner.set_end_effector_target(target_pose)
left_barrier = FixedCuboid(
"/obstacles/left_barrier", size=1.0, scale=np.array([0.01, 0.5, 1]), position=np.array([0, 0.45, 0.5])
)
right_barrier = FixedCuboid(
"/obstacles/right_barrier", size=1.0, scale=np.array([0.04, 0.5, 0.5]), position=np.array([0, -0.45, 0.35])
)
back_barrier = FixedCuboid(
"/obstacles/back_barrier", size=1.0, scale=np.array([0.5, 0.01, 1]), position=np.array([-0.45, 0, 1])
)
top_barrier = FixedCuboid(
"/obstacles/top_barrier", size=1.0, scale=np.array([0.25, 0.25, 0.01]), position=np.array([0, 0, 1.2])
)
ground_plane = GroundPlane("/ground")
target_prim = VisualCuboid(
"/target", size=1.0, scale=np.full((3,), 0.05), position=target_pose, color=np.array([1, 0, 0])
)
self._planner.add_obstacle(left_barrier)
self._planner.add_obstacle(right_barrier)
self._planner.add_obstacle(back_barrier)
self._planner.add_obstacle(top_barrier)
self._planner.add_obstacle(ground_plane)
self._planner.update_world()
# Generate waypoints no more than .5 radians (l1 norm) from each other
actions = self._planner_visualizer.compute_plan_as_articulation_actions(max_cspace_dist=0.3)
if self.PRINT_GOLDEN_VALUES:
print("Number of actions: ", len(actions))
print("Final action: ", end="")
[print(actions[-1].joint_positions[i], ",", end="") for i in range(len(actions[-1].joint_positions))]
LOGGED_PATH_LEN = 11
LOGGED_FINAL_POSITION = np.array(
[
-2.2235743574338285,
1.2670535347824194,
-1.5803078127051602,
-2.044557783811974,
-0.889700828512457,
1.6705503159953106,
0.41399271401981974,
None,
None,
]
)
if self.TEST_FOR_DETERMINISM:
self.assertTrue(
len(actions) == LOGGED_PATH_LEN,
"Logged plan has length " + str(LOGGED_PATH_LEN) + "; this plan has length " + str(len(actions)),
)
await self.assertAlmostEqual(
LOGGED_FINAL_POSITION,
actions[-1].joint_positions,
f"The final position in the path doesn't match the logged position: {LOGGED_FINAL_POSITION} != {actions[-1].joint_positions}",
)
else:
self.assertTrue(len(actions) > 0, f"{len(actions)}")
await self.follow_plan(actions, target_pose)
async def test_rrt_franka_moving_base(self):
target_pose = np.array([1.4, -0.1, 0.5])
self._planner.set_end_effector_target(target_pose)
robot_base_position = np.array([1, 0, 0.2])
robot_base_orientation = euler_angles_to_quats(np.array([0.1, 0, 0.3]))
barrier = FixedCuboid(
"/obstacles/barrier", size=1.0, scale=np.array([0.01, 0.5, 1]), position=np.array([1.2, -0.3, 0.5])
)
target_prim = VisualCuboid(
"/target", size=1.0, scale=np.full((3,), 0.05), position=target_pose, color=np.array([1, 0, 0])
)
self._planner.add_obstacle(barrier)
self._planner.set_robot_base_pose(robot_base_position, robot_base_orientation)
self._kinematics_solver.set_robot_base_pose(robot_base_position, robot_base_orientation)
self._robot.set_world_pose(robot_base_position, robot_base_orientation)
self._planner.update_world()
# Generate waypoints no more than .5 radians (l1 norm) from each other
actions = self._planner_visualizer.compute_plan_as_articulation_actions(max_cspace_dist=0.5)
if self.PRINT_GOLDEN_VALUES:
print("Number of actions: ", len(actions))
print("Final action: ", end="")
[print(actions[-1].joint_positions[i], ",", end="") for i in range(len(actions[-1].joint_positions))]
LOGGED_PATH_LEN = 6
LOGGED_FINAL_POSITION = np.array(
[
-1.287984743737736,
-1.194971983321831,
1.3341467119855843,
-3.0448501997009876,
0.229684493139643,
3.1069385805619922,
-1.3131528226307583,
None,
None,
]
)
if self.TEST_FOR_DETERMINISM:
self.assertTrue(
len(actions) == LOGGED_PATH_LEN,
"Logged plan has length " + str(LOGGED_PATH_LEN) + "; this plan has length " + str(len(actions)),
)
await self.assertAlmostEqual(
LOGGED_FINAL_POSITION,
actions[-1].joint_positions,
f"The final position in the path doesn't match the logged position: {LOGGED_FINAL_POSITION} != {actions[-1].joint_positions}",
)
else:
self.assertTrue(len(actions) > 0, f"{len(actions)}")
await self.follow_plan(actions, target_pose)
async def test_rrt_franka_cspace_target(self):
cspace_target = np.array(
[
-2.2235743574338285,
1.2670535347824194,
-1.5803078127051602,
-2.044557783811974,
-0.889700828512457,
1.6705503159953106,
0.41399271401981974,
]
)
target_pose = np.array([-0.4, 0.3, 0.5])
self._planner.set_cspace_target(cspace_target)
# Check that this doesn't mess anything up
self._planner.set_end_effector_target(np.zeros(3)) # Should just be overridden
self._planner.set_cspace_target(cspace_target)
left_barrier = FixedCuboid(
"/obstacles/left_barrier", size=1.0, scale=np.array([0.01, 0.5, 1]), position=np.array([0, 0.45, 0.5])
)
right_barrier = FixedCuboid(
"/obstacles/right_barrier", size=1.0, scale=np.array([0.04, 0.5, 0.5]), position=np.array([0, -0.45, 0.35])
)
back_barrier = FixedCuboid(
"/obstacles/back_barrier", size=1.0, scale=np.array([0.5, 0.01, 1]), position=np.array([-0.45, 0, 1])
)
top_barrier = FixedCuboid(
"/obstacles/top_barrier", size=1.0, scale=np.array([0.25, 0.25, 0.01]), position=np.array([0, 0, 1.2])
)
ground_plane = GroundPlane("/ground", z_position=-0.0305)
target_prim = VisualCuboid(
"/target", size=1.0, scale=np.full((3,), 0.05), position=target_pose, color=np.array([1, 0, 0])
)
self._planner.add_obstacle(left_barrier)
self._planner.add_obstacle(right_barrier)
self._planner.add_obstacle(back_barrier)
self._planner.add_obstacle(top_barrier)
self._planner.add_obstacle(ground_plane)
self._planner.update_world()
# Generate waypoints no more than .5 radians (l1 norm) from each other
actions = self._planner_visualizer.compute_plan_as_articulation_actions(max_cspace_dist=0.3)
if self.PRINT_GOLDEN_VALUES:
print("Number of actions: ", len(actions))
print("Final action: ", end="")
[print(actions[-1].joint_positions[i], ",", end="") for i in range(len(actions[-1].joint_positions))]
LOGGED_PATH_LEN = 11
LOGGED_FINAL_POSITION = np.array(
[
-2.2235743574338285,
1.2670535347824194,
-1.5803078127051602,
-2.044557783811974,
-0.889700828512457,
1.6705503159953106,
0.41399271401981974,
None,
None,
]
)
if self.TEST_FOR_DETERMINISM:
self.assertTrue(
len(actions) == LOGGED_PATH_LEN,
"Logged plan has length " + str(LOGGED_PATH_LEN) + "; this plan has length " + str(len(actions)),
)
await self.assertAlmostEqual(
LOGGED_FINAL_POSITION,
actions[-1].joint_positions,
f"The final position in the path doesn't match the logged position: {LOGGED_FINAL_POSITION} != {actions[-1].joint_positions}",
)
else:
self.assertTrue(len(actions) > 0, f"{len(actions)}")
await self.follow_plan(actions, target_pose)
async def follow_plan(self, actions, target_pose, max_frames_per_waypoint=120):
for frame in range(len(actions)):
self._robot.get_articulation_controller().apply_action(actions[frame])
# Spend 30 frames getting to each waypoint
for i in range(max_frames_per_waypoint):
await omni.kit.app.get_app().next_update_async()
diff = self._robot.get_joint_positions() - actions[frame].joint_positions
# print(np.around(diff.astype(np.float),decimals=3))
# print(np.amax(abs(diff)))
if np.linalg.norm(diff) < 0.01:
break
# Check that the robot hit the waypoint
diff = self._robot.get_joint_positions() - actions[frame].joint_positions
self.assertTrue(np.linalg.norm(diff) < 0.05, f"np.linalg.norm(diff) = {np.linalg.norm(diff)}")
for i in range(20): # extra time to converge very tightly at final position
await omni.kit.app.get_app().next_update_async()
# Check the the end effector position reached the target
ee_position = self._articulation_kinematics_solver.compute_end_effector_pose()[0]
self.assertTrue(
np.linalg.norm(ee_position - target_pose) < 0.01,
"Not close enough to target with distance: " + str(np.linalg.norm(ee_position - target_pose)),
)
async def assertAlmostEqual(self, a, b, dbg_msg=""):
# overriding method because it doesn't support iterables
a = np.array(a)
b = np.array(b)
self.assertFalse(np.any(abs((a[a != np.array(None)] - b[b != np.array(None)])) > 1e-3), dbg_msg)
pass
| 17,364 | Python | 41.046005 | 142 | 0.61138 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/tests/__init__.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from .test_motion_policy import *
from .test_kinematics import *
from .test_path_planner import *
from .test_trajectory_generator import *
| 568 | Python | 39.642854 | 76 | 0.799296 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/tests/test_trajectory_generator.py | # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
from omni.isaac.motion_generation.articulation_kinematics_solver import ArticulationKinematicsSolver
from omni.isaac.motion_generation.articulation_trajectory import ArticulationTrajectory
from omni.isaac.motion_generation.lula.trajectory_generator import (
LulaCSpaceTrajectoryGenerator,
LulaTaskSpaceTrajectoryGenerator,
)
import omni.kit.test
import carb
import asyncio
# Import extension python module we are testing with absolute import path, as if we are external user (other extension)
from omni.isaac.motion_generation import interface_config_loader
from omni.isaac.motion_generation.lula import LulaKinematicsSolver
import lula
from omni.isaac.core.utils.stage import update_stage_async, add_reference_to_stage, create_new_stage_async
from omni.isaac.core.robots.robot import Robot
from omni.isaac.core.objects.cuboid import VisualCuboid
from omni.isaac.core.utils.numpy.rotations import rotvecs_to_quats, quats_to_rot_matrices, rot_matrices_to_quats
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.prims import delete_prim
from omni.isaac.core.world import World
import os
import json
import numpy as np
# Having a test class derived from omni.kit.test.AsyncTestCase declared on the root of module will
# make it auto-discoverable by omni.kit.test
class TestTrajectoryGenerator(omni.kit.test.AsyncTestCase):
# Before running each test
async def setUp(self):
self._physics_dt = 1 / 60 # duration of physics frame in seconds
self._timeline = omni.timeline.get_timeline_interface()
ext_manager = omni.kit.app.get_app().get_extension_manager()
ext_id = ext_manager.get_enabled_extension_id("omni.isaac.motion_generation")
self._mg_extension_path = ext_manager.get_extension_path(ext_id)
self._polciy_config_dir = os.path.join(self._mg_extension_path, "motion_policy_configs")
self.assertTrue(os.path.exists(os.path.join(self._polciy_config_dir, "policy_map.json")))
with open(os.path.join(self._polciy_config_dir, "policy_map.json")) as policy_map:
self._policy_map = json.load(policy_map)
await create_new_stage_async()
await update_stage_async()
pass
async def _set_determinism_settings(self, robot):
World()
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
robot.disable_gravity()
robot.set_solver_position_iteration_count(64)
robot.set_solver_velocity_iteration_count(64)
# After running each test
async def tearDown(self):
self._timeline.stop()
while omni.usd.get_context().get_stage_loading_status()[2] > 0:
print("tearDown, assets still loading, waiting to finish...")
await asyncio.sleep(1.0)
await update_stage_async()
self._mg = None
await update_stage_async()
World.clear_instance()
pass
async def test_lula_c_space_traj_gen_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_name = "Franka"
robot_prim_path = "/panda"
ee_frame = "panda_rightfinger"
task_space_traj = np.array([[0.5, 0, 0.5], [0.3, -0.3, 0.3], [-0.3, -0.3, 0.6], [0, 0, 0.7]])
orientation_target = rotvecs_to_quats(np.array([np.pi, 0, 0]))
await self._test_lula_c_space_traj_gen(
usd_path, robot_name, robot_prim_path, ee_frame, task_space_traj, orientation_target
)
task_space_traj = np.array([[0.5, 0, 0.5], [0, 0.5, 0.5], [-0.5, 0, 0.5]])
await self._test_lula_c_space_traj_gen(
usd_path, robot_name, robot_prim_path, ee_frame, task_space_traj, orientation_target
)
async def test_lula_c_space_traj_gen_cobotta(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Denso/cobotta_pro_900.usd"
robot_name = "Cobotta_Pro_900"
robot_prim_path = "/cobotta_pro_900"
ee_frame = "gripper_center"
task_space_traj = np.array([[0.5, 0, 0.5], [0.3, -0.3, 0.3], [-0.3, -0.3, 0.6]])
orientation_target = rotvecs_to_quats(np.array([np.pi, 0, 0]))
await self._test_lula_c_space_traj_gen(
usd_path, robot_name, robot_prim_path, ee_frame, task_space_traj, orientation_target
)
async def _test_lula_c_space_traj_gen(
self, usd_path, robot_name, robot_prim_path, ee_frame, task_space_targets, orientation_target
):
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._kinematics_solver = LulaKinematicsSolver(**kinematics_config)
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
for i, target_pos in enumerate(task_space_targets):
VisualCuboid(f"/targets/target_{i}", position=target_pos, size=0.05)
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self._set_determinism_settings(self._robot)
iks = []
ik = None
for target_pos in task_space_targets:
ik, succ = self._kinematics_solver.compute_inverse_kinematics(
ee_frame, target_pos, target_orientation=orientation_target, warm_start=ik
)
if not succ:
carb.log_error(f"Could not compute ik for given task_space position {target_pos}")
iks.append(ik)
iks = np.array(iks)
self._trajectory_generator = LulaCSpaceTrajectoryGenerator(
kinematics_config["robot_description_path"], kinematics_config["urdf_path"]
)
self._art_kinematics = ArticulationKinematicsSolver(self._robot, self._kinematics_solver, ee_frame)
trajectory = self._trajectory_generator.compute_c_space_trajectory(iks)
self.assertFalse(trajectory is None)
self._art_trajectory = ArticulationTrajectory(self._robot, trajectory, self._physics_dt)
art_traj = self._art_trajectory.get_action_sequence()
initial_positions = art_traj[0].joint_positions
initial_positions[initial_positions == None] = 0
self._robot.set_joint_positions(initial_positions)
self._robot.set_joint_velocities(np.zeros_like(initial_positions))
await update_stage_async()
target_dists = np.ones(len(task_space_targets))
for action in art_traj:
await update_stage_async()
self._robot.apply_action(action)
robot_pos = self._art_kinematics.compute_end_effector_pose()[0]
diff = np.linalg.norm(task_space_targets - robot_pos, axis=1)
mask = target_dists > diff
target_dists[mask] = diff[mask]
delete_prim("/targets")
self.assertTrue(
np.all(target_dists < 0.01), f"Did not hit every task_space target: Distance to targets = {target_dists}"
)
async def test_set_c_space_trajectory_solver_config_settings(self):
robot_name = "Franka"
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._trajectory_generator = LulaCSpaceTrajectoryGenerator(
kinematics_config["robot_description_path"], kinematics_config["urdf_path"]
)
lula_kinematics = LulaKinematicsSolver(**kinematics_config)
self._trajectory_generator.set_c_space_position_limits(*lula_kinematics.get_cspace_position_limits())
self._trajectory_generator.set_c_space_velocity_limits(lula_kinematics.get_cspace_velocity_limits())
self._trajectory_generator.set_c_space_acceleration_limits(lula_kinematics.get_cspace_acceleration_limits())
self._trajectory_generator.set_c_space_jerk_limits(lula_kinematics.get_cspace_jerk_limits())
self._trajectory_generator.set_solver_param("max_segment_iterations", 10)
self._trajectory_generator.set_solver_param("max_aggregate_iterations", 10)
self._trajectory_generator.set_solver_param("convergence_dt", 0.5)
self._trajectory_generator.set_solver_param("max_dilation_iterations", 5)
self._trajectory_generator.set_solver_param("min_time_span", 0.5)
self._trajectory_generator.set_solver_param("time_split_method", "uniform")
self._trajectory_generator.set_solver_param("time_split_method", "chord_length")
self._trajectory_generator.set_solver_param("time_split_method", "centripetal")
async def test_lula_task_space_traj_gen_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_name = "Franka"
robot_prim_path = "/panda"
ee_frame = "panda_hand"
pos_targets = np.array([[0.5, 0, 0.5], [0.3, -0.3, 0.3], [-0.3, -0.3, 0.6], [0, 0, 0.7]])
orient_targets = np.tile(rotvecs_to_quats(np.array([np.pi, 0, 0])), (len(pos_targets), 1))
await self._test_lula_task_space_trajectory_generator(
usd_path, robot_name, robot_prim_path, ee_frame, pos_targets, orient_targets
)
async def test_lula_task_space_traj_gen_ur10(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/UR10/ur10.usd"
robot_name = "UR10"
robot_prim_path = "/ur10"
ee_frame = "ee_link"
path, pos_targets, orient_targets = await self._build_rect_path()
await self._test_lula_task_space_trajectory_generator(
usd_path, robot_name, robot_prim_path, ee_frame, pos_targets, orient_targets, path
)
path, pos_targets, orient_targets = await self._build_circle_path_with_rotations()
await self._test_lula_task_space_trajectory_generator(
usd_path, robot_name, robot_prim_path, ee_frame, pos_targets, orient_targets, path
)
async def test_lula_task_space_traj_gen_cobotta(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Denso/cobotta_pro_900.usd"
robot_name = "Cobotta_Pro_900"
robot_prim_path = "/cobotta_pro_900"
ee_frame = "gripper_center"
path, pos_targets, orient_targets = await self._build_rect_path()
await self._test_lula_task_space_trajectory_generator(
usd_path, robot_name, robot_prim_path, ee_frame, pos_targets, orient_targets, path
)
path, pos_targets, orient_targets = await self._build_circle_path_with_rotations()
await self._test_lula_task_space_trajectory_generator(
usd_path, robot_name, robot_prim_path, ee_frame, pos_targets, orient_targets, path
)
async def _build_rect_path(self, rot_vec=np.array([np.pi, 0, 0])):
rect_path = np.array([[0.3, -0.3, 0.1], [0.3, 0.3, 0.1], [0.3, 0.3, 0.5], [0.3, -0.3, 0.5], [0.3, -0.3, 0.1]])
builder = lula.create_task_space_path_spec(
lula.Pose3(lula.Rotation3(np.linalg.norm(rot_vec), rot_vec / np.linalg.norm(rot_vec)), rect_path[0])
)
builder.add_translation(rect_path[1])
builder.add_translation(rect_path[2])
builder.add_translation(rect_path[3])
builder.add_translation(rect_path[4])
path = builder
position_targets = np.array(
[[0.3, -0.3, 0.1], [0.3, 0.3, 0.1], [0.3, 0.3, 0.5], [0.3, -0.3, 0.5], [0.3, -0.3, 0.1]]
)
orientation_targets = rotvecs_to_quats(np.tile(rot_vec, (len(position_targets), 1)))
return path, position_targets, orientation_targets
async def _build_circle_path_with_rotations(self):
builder = lula.create_task_space_path_spec(
lula.Pose3(lula.Rotation3(np.pi, np.array([1, 0, 0])), np.array([0.3, 0.2, 0.3]))
)
builder.add_three_point_arc(np.array([0.3, -0.2, 0.3]), np.array([0.3, 0, 0.6]), True)
builder.add_three_point_arc(np.array([0.3, 0.2, 0.3]), np.array([0.3, 0, 0]), True)
builder.add_rotation(lula.Rotation3(np.pi / 2, np.array([1, 0, 0])))
position_targets = np.array(
[[0.3, 0.2, 0.3], [0.3, 0, 0.6], [0.3, -0.2, 0.3], [0.3, 0, 0], [0.3, 0.2, 0.3], [0.3, 0.2, 0.3]]
)
orientation_targets = rotvecs_to_quats(np.tile(np.array([np.pi, 0, 0]), (len(position_targets), 1)))
orientation_targets[-1] = rotvecs_to_quats(np.array([np.pi / 2, 0, 0]))
return builder, position_targets, orientation_targets
async def _test_lula_task_space_trajectory_generator(
self, usd_path, robot_name, robot_prim_path, ee_frame, task_space_targets, orientation_targets, built_path=None
):
add_reference_to_stage(usd_path, robot_prim_path)
self._timeline = omni.timeline.get_timeline_interface()
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._kinematics_solver = LulaKinematicsSolver(**kinematics_config)
self._trajectory_generator = LulaTaskSpaceTrajectoryGenerator(
kinematics_config["robot_description_path"], kinematics_config["urdf_path"]
)
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
for i, target_pos in enumerate(task_space_targets):
VisualCuboid(f"/targets/target_{i}", position=target_pos, size=0.05)
self._robot = Robot(robot_prim_path)
self._robot.initialize()
await self._set_determinism_settings(self._robot)
if built_path is None:
trajectory = self._trajectory_generator.compute_task_space_trajectory_from_points(
task_space_targets, orientation_targets, ee_frame
)
self.assertTrue(trajectory is not None, "Failed to generate trajectory")
else:
trajectory = self._trajectory_generator.compute_task_space_trajectory_from_path_spec(built_path, ee_frame)
self.assertTrue(trajectory is not None, "Failed to generate trajectory")
self._art_kinematics = ArticulationKinematicsSolver(self._robot, self._kinematics_solver, ee_frame)
self._art_trajectory = ArticulationTrajectory(self._robot, trajectory, self._physics_dt)
art_traj = self._art_trajectory.get_action_sequence()
initial_positions = art_traj[0].joint_positions
initial_positions[initial_positions == None] = 0
self._robot.set_joint_positions(initial_positions)
self._robot.set_joint_velocities(np.zeros_like(initial_positions))
await update_stage_async()
target_dists = np.ones(len(task_space_targets))
for action in art_traj:
await update_stage_async()
self._robot.apply_action(action)
robot_pos, robot_orient = self._art_kinematics.compute_end_effector_pose()
pos_diff = np.linalg.norm(task_space_targets - robot_pos, axis=1)
orient_diff = np.linalg.norm(orientation_targets - rot_matrices_to_quats(robot_orient), axis=1)
diff = pos_diff + orient_diff
mask = target_dists > diff
target_dists[mask] = diff[mask]
delete_prim("/targets")
self.assertTrue(
np.all(target_dists < 0.01), f"Did not hit every task_space target: Distance to targets = {target_dists}"
)
async def test_set_task_space_trajectory_solver_config_settings(self):
robot_name = "Franka"
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._trajectory_generator = LulaTaskSpaceTrajectoryGenerator(
kinematics_config["robot_description_path"], kinematics_config["urdf_path"]
)
lula_kinematics = LulaKinematicsSolver(**kinematics_config)
self._trajectory_generator.set_c_space_position_limits(*lula_kinematics.get_cspace_position_limits())
self._trajectory_generator.set_c_space_velocity_limits(lula_kinematics.get_cspace_velocity_limits())
self._trajectory_generator.set_c_space_acceleration_limits(lula_kinematics.get_cspace_acceleration_limits())
self._trajectory_generator.set_c_space_jerk_limits(lula_kinematics.get_cspace_jerk_limits())
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("max_segment_iterations", 10)
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("max_aggregate_iterations", 10)
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("convergence_dt", 0.5)
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("max_dilation_iterations", 5)
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("min_time_span", 0.5)
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("time_split_method", "uniform")
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("time_split_method", "chord_length")
self._trajectory_generator.set_c_space_trajectory_generator_solver_param("time_split_method", "centripetal")
conversion_config = self._trajectory_generator.get_path_conversion_config()
conversion_config.alpha = 1.3
conversion_config.initial_s_step_size = 0.04
conversion_config.initial_s_step_size_delta = 0.003
conversion_config.max_iterations = 40
conversion_config.max_position_deviation = 0.002
conversion_config.min_position_deviation = 0.0015
conversion_config.min_s_step_size = 1e-4
conversion_config.min_s_step_size_delta = 1e-4
| 18,274 | Python | 44.460199 | 119 | 0.663018 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/omni/isaac/motion_generation/tests/test_kinematics.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
from omni.isaac.motion_generation.articulation_kinematics_solver import ArticulationKinematicsSolver
import omni.kit.test
import carb
import asyncio
# Import extension python module we are testing with absolute import path, as if we are external user (other extension)
from omni.isaac.motion_generation import interface_config_loader
from omni.isaac.motion_generation.lula import LulaKinematicsSolver
from omni.isaac.core.utils import distance_metrics
from omni.isaac.core.utils.stage import update_stage_async, open_stage_async
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.prims import XFormPrim
from omni.isaac.core.utils.types import ArticulationAction
from omni.isaac.core.robots.robot import Robot
from omni.isaac.core.world import World
from omni.isaac.core.utils.viewports import set_camera_view
import os
import json
import numpy as np
from omni.isaac.core.utils.prims import is_prim_path_valid
from omni.isaac.core.utils.numpy.rotations import quats_to_rot_matrices
from omni.isaac.core.world import World
# Having a test class derived from omni.kit.test.AsyncTestCase declared on the root of module will
# make it auto-discoverable by omni.kit.test
class TestKinematics(omni.kit.test.AsyncTestCase):
# Before running each test
async def setUp(self):
self._physics_dt = 1 / 60 # duration of physics frame in seconds
self._timeline = omni.timeline.get_timeline_interface()
ext_manager = omni.kit.app.get_app().get_extension_manager()
ext_id = ext_manager.get_enabled_extension_id("omni.isaac.motion_generation")
self._mg_extension_path = ext_manager.get_extension_path(ext_id)
self._polciy_config_dir = os.path.join(self._mg_extension_path, "motion_policy_configs")
self.assertTrue(os.path.exists(os.path.join(self._polciy_config_dir, "policy_map.json")))
with open(os.path.join(self._polciy_config_dir, "policy_map.json")) as policy_map:
self._policy_map = json.load(policy_map)
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
pass
# After running each test
async def tearDown(self):
self._timeline.stop()
while omni.usd.get_context().get_stage_loading_status()[2] > 0:
print("tearDown, assets still loading, waiting to finish...")
await asyncio.sleep(1.0)
await update_stage_async()
self._mg = None
await update_stage_async()
World.clear_instance()
pass
async def _set_determinism_settings(self, robot):
World()
carb.settings.get_settings().set_bool("/app/runLoops/main/rateLimitEnabled", True)
carb.settings.get_settings().set_int("/app/runLoops/main/rateLimitFrequency", int(1 / self._physics_dt))
carb.settings.get_settings().set_int("/persistent/simulation/minFrameRate", int(1 / self._physics_dt))
robot.disable_gravity()
robot.set_solver_position_iteration_count(64)
robot.set_solver_velocity_iteration_count(64)
async def reset_robot(self, robot):
"""
To make motion_generation outputs more deterministic, this method may be used to
teleport the robot to specified position targets, setting velocity to 0
This prevents changes in dynamic_control from affecting motion_generation tests
"""
robot.post_reset()
await self._set_determinism_settings(robot)
await update_stage_async()
pass
async def test_lula_fk_ur10(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/UR10/ur10.usd"
robot_name = "UR10"
robot_prim_path = "/ur10"
trans_dist, rot_dist = await self._test_lula_fk(
usd_path, robot_name, robot_prim_path, joint_target=-np.array([0.1, 0.1, 0.1, 0.1, 0.1, 0.2])
)
self.assertTrue(np.all(trans_dist < 0.001))
self.assertTrue(np.all(rot_dist < 0.005))
async def test_lula_fk_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_name = "Franka"
robot_prim_path = "/panda"
trans_dist, rot_dist = await self._test_lula_fk(
usd_path,
robot_name,
robot_prim_path,
base_pose=np.array([0.10, 0, 1.5]),
base_orient=np.array([0.1, 0, 0.3, 0.7]),
)
# There is a known bug with the kinematics not matching on the Franka finger frames
self.assertTrue(np.all(trans_dist[:-2] < 0.005), trans_dist)
self.assertTrue(np.all(rot_dist[:] < 0.005), rot_dist)
async def _test_lula_fk(
self,
usd_path,
robot_name,
robot_prim_path,
joint_target=None,
base_pose=np.zeros(3),
base_orient=np.array([1, 0, 0, 0]),
):
await open_stage_async(usd_path)
set_camera_view(eye=[3.5, 2.3, 2.1], target=[0, 0, 0], camera_prim_path="/OmniverseKit_Persp")
self._timeline = omni.timeline.get_timeline_interface()
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._kinematics = LulaKinematicsSolver(**kinematics_config)
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
self._robot.set_world_pose(base_pose, base_orient)
self._kinematics.set_robot_base_pose(base_pose, base_orient)
if joint_target is not None:
self._robot.get_articulation_controller().apply_action(ArticulationAction(joint_target))
# move towards target or default position
await self.move_until_still(self._robot)
frame_names = self._kinematics.get_all_frame_names()
art_fk = ArticulationKinematicsSolver(self._robot, self._kinematics, frame_names[0])
trans_dists = []
rot_dist = []
# save the distance between lula and usd frames for each frame that exists for both robot views
for frame in frame_names:
if is_prim_path_valid(robot_prim_path + "/" + frame):
art_fk.set_end_effector_frame(frame)
lula_frame_pos, lula_frame_rot = art_fk.compute_end_effector_pose()
usd_frame_pos, usd_frame_rot = XFormPrim(robot_prim_path + "/" + frame).get_world_pose()
trans_dists.append(distance_metrics.weighted_translational_distance(lula_frame_pos, usd_frame_pos))
rot_dist.append(
distance_metrics.rotational_distance_angle(lula_frame_rot, quats_to_rot_matrices(usd_frame_rot))
)
return np.array(trans_dists), np.array(rot_dist)
async def test_lula_ik_ur10(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/UR10/ur10.usd"
robot_name = "UR10"
robot_prim_path = "/ur10"
frame = "ee_link"
# await self._test_lula_ik(usd_path,robot_name,robot_prim_path,frame,np.array([40,60,80]),np.array([0,1,0,0]),1,.1)
await self._test_lula_ik(
usd_path,
robot_name,
robot_prim_path,
frame,
np.array([0.40, 0.40, 0.80]),
None,
1,
0.1,
base_pose=np.array([0.10, 0, 0.5]),
base_orient=np.array([0.1, 0, 0.3, 0.7]),
)
async def test_lula_ik_franka(self):
usd_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka.usd"
robot_name = "Franka"
robot_prim_path = "/panda"
frame = "right_gripper"
# await self._test_lula_ik(usd_path,robot_name,robot_prim_path,frame,np.array([40,30,60]),np.array([.1,0,0,-1]),1,.1)
await self._test_lula_ik(
usd_path,
robot_name,
robot_prim_path,
frame,
np.array([0.40, 0.30, 0.60]),
np.array([0.1, 0, 0, -1]),
1,
0.1,
base_pose=np.array([0.10, 0, 0.5]),
base_orient=np.array([0.1, 0, 0.3, 0.7]),
)
frame = "panda_hand"
await self._test_lula_ik(
usd_path,
robot_name,
robot_prim_path,
frame,
np.array([0.40, 0.30, 0.60]),
None,
1,
0.1,
base_pose=np.array([0.10, 0, 0.5]),
base_orient=np.array([0.1, 0, 0.3, 0.7]),
)
async def _test_lula_ik(
self,
usd_path,
robot_name,
robot_prim_path,
frame,
position_target,
orientation_target,
position_tolerance,
orientation_tolerance,
base_pose=np.zeros(3),
base_orient=np.array([0, 0, 0, 1]),
):
await open_stage_async(usd_path)
set_camera_view(eye=[3.5, 2.3, 2.1], target=[0, 0, 0], camera_prim_path="/OmniverseKit_Persp")
self._timeline = omni.timeline.get_timeline_interface()
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config(robot_name)
self._kinematics = LulaKinematicsSolver(**kinematics_config)
# Start Simulation and wait
self._timeline.play()
await update_stage_async()
self._robot = Robot(robot_prim_path)
self._robot.initialize()
self._robot.set_world_pose(base_pose, base_orient)
self._kinematics.set_robot_base_pose(base_pose, base_orient)
art_ik = ArticulationKinematicsSolver(self._robot, self._kinematics, frame)
# testing IK and ArticulationKinematicsSolver object wrapping IK
alg_ik_action, success = art_ik.compute_inverse_kinematics(
position_target, orientation_target, position_tolerance, orientation_tolerance
)
alg_ik, _ = self._kinematics.compute_inverse_kinematics(
frame, position_target, orientation_target, None, position_tolerance, orientation_tolerance
)
self.assertTrue(success, "IK Solver did not converge to a solution")
# check if USD robot can get to IK result
self._robot.get_articulation_controller().apply_action(alg_ik_action)
await self.move_until_still(self._robot)
# check IK consistent with FK
lula_pos, lula_rot = self._kinematics.compute_forward_kinematics(frame, joint_positions=alg_ik)
self.assertTrue(
distance_metrics.weighted_translational_distance(lula_pos, position_target) < position_tolerance
)
if orientation_target is not None:
tgt_rot = quats_to_rot_matrices(orientation_target)
rot_dist = distance_metrics.rotational_distance_angle(lula_rot, tgt_rot)
self.assertTrue(rot_dist < orientation_tolerance, "Rotational distance too large: " + str(rot_dist))
# check IK consistent with USD robot frames
if is_prim_path_valid(robot_prim_path + "/" + frame):
usd_pos, usd_rot = XFormPrim(robot_prim_path + "/" + frame).get_world_pose()
trans_dist = distance_metrics.weighted_translational_distance(usd_pos, position_target)
self.assertTrue(trans_dist < position_tolerance, str(usd_pos) + str(position_target))
if orientation_target is not None:
rot_dist = distance_metrics.rotational_distance_angle(quats_to_rot_matrices(usd_rot), tgt_rot)
self.assertTrue(rot_dist < orientation_tolerance)
else:
carb.log_warn("Frame " + frame + " does not exist on USD robot")
async def move_until_still(self, robot, timeout=500):
h = 10
positions = np.zeros((h, robot.num_dof))
for i in range(timeout):
positions[i % h] = robot.get_joint_positions()
await update_stage_async()
if i > h:
std = np.std(positions, axis=0)
if np.all(std < 0.001):
return i
return timeout
| 12,635 | Python | 40.70297 | 125 | 0.630313 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/docs/CHANGELOG.md | # Changelog
## [4.5.6] - 2023-01-06
### Fixed
- Typo in variable name in ArticulationTrajectory.get_robot_articulation()
## [4.5.5] - 2022-12-12
### Changed
- Updates to API docs
## [4.5.4] - 2022-12-04
### Changed
- Small change to Cobotta RmpFlow configs for consistency with tutorials.
## [4.5.3] - 2022-12-01
### Changed
- Moved Cortex UR10 RMPflow config file and corresponding policy config to new directory (was only in legacy directory and unused).
## [4.5.2] - 2022-11-29
### Changed
- Updated old robot_description YAML files for Franka, UR10, DOFbot, and Cobotta to remove unecessary fields that had no effect.
## [4.5.1] - 2022-11-28
### Added
- Updated file paths to Nucleus assets in RmpFlow tests for Kawasaki, Flexiv, and Festo robots.
## [4.5.0] - 2022-11-28
### Added
- Added RmpFlow config and test for FestoCobot
## [4.4.0] - 2022-11-28
### Added
- Added RmpFlow configs and tests for Kawasaki and Flexiv robots
## [4.3.1] - 2022-11-22
### Added
- Cortex UR10 configs for UR10 bin supporting stacking demo
## [4.3.0] - 2022-11-22
### Changed
- Updated ArticulationSubset to handle sparse ArticulationActions. Previously, it None-padded the ArticulationAction.
- Some modifications to ArticulationSubset to simplify the error checking code and change member names.
- Updates ArticulationMotionPolicy to use the sparse API.
- Moved ArticulationSubset to omni.isaac.core
## [4.2.0] - 2022-11-18
### Added
- Added RmpFlow configs for universal robots
## [4.1.1] - 2022-11-18
### Fixed
- Fixed missing import statement for ArticulationTrajectory in MotionGeneration __init__
## [4.1.0] - 2022-11-17
### Added
- Added Trajectory interface, ArticulationTrajectory, and Lula Trajectory Generators
## [4.0.3] - 2022-11-10
### Changed
- Updated determinism settings to include omni.isaac.core World
## [4.0.2] - 2022-10-24
### Changed
- Moved Test cases using UR10 asset to use USD from Nucleus
## [4.0.1] - 2022-10-20
### Changed
- Moved Test cases using Franka asset to use USD from Nucleus
## [4.0.0] - 2022-10-17
### Changed
- Allow user to variable physics dt on each frame to an ArticulationMotionPolicy or set a default value.
- Change RmpFlow parameter 'evaluations_per_frame' to 'maximum_substep_size' to account for a possibly varying framerate
## [3.6.4] - 2022-10-06
### Changed
- Updated outdated Franka URDF with new joint limits on joint 7
## [3.6.3] - 2022-09-02
### Added
- Added function to get default rmpflow cspace target
- Added test case for setting rmpflow cspace target
## [3.6.2] - 2022-09-01
### Changed
- Remove legacy viewport calls from tests
## [3.6.1] - 2022-08-16
### Changed
- Updated RMPflow parameters in config YAML files for Denso robots: Turned on velocity_cap_rmp
## [3.6.0] - 2022-08-10
### Added
- Added Cobotta Pro 900 and Cobotta Pro 1300 as supported robots with provided RMPflow config files and test cases.
## [3.5.1] - 2022-08-03
### Fixed
- `ArticulationSubset.get_joint_subset_indices()` fixed (was returning function rather than return value of function call.)
## [3.5.0] - 2022-07-26
### Changed
- Changed gripper_controller argument to gripper in the PickPlaceController.
- moved PickPlaceController and StackingController to omni.isaac.manipulators
## [3.4.0] - 2022-07-20
### Added
- Added set_param() function to Lula RRT implementation.
### Changed
- Changed docstrings for PathPlannerVisualizer and Lula RRT implementation
### Fixed
- Fixed unreliable test case for lula RRT by reducing the RRT step size
## [3.3.1] - 2022-07-19
### Fixed
- Fixed bug in RmpFlow.set_cspace_target() which changed the end effector target when it shouldn't have
- Fixed bug in RmpFlow.get_internal_robot_joint_states() which resulted in a TypeError
## [3.3.0] - 2022-07-18
### Changed
- Updated ArticulationSubset to wait until robot joint states are queried to access the Articulation object. This avoids annoying errors when attempting to initialize an ArticulationMotionPolicy before the "play" button has been pressed.
## [3.2.1] - 2022-06-28
### Changed
- Updated MotionPolicy to not assume a default orientation. It now passes None to the MotionPolicy.
## [3.2.0] - 2022-06-17
### Added
- Added PathPlanningInterface with Lula RRT implementation and simple class for aiding visualization
## [3.1.2] - 2022-05-23
### Added
- Added conversion to numpy if articulation backend is GPU/torch
## [3.1.1] - 2022-05-18
### Added
- Added getter to get the MotionPolicy from a MotionPolicyController.
## [3.1.0] - 2022-05-09
### Changed
- Updated all hard coded USD object values to meters in motion_generation tests
### Fixed
- Fixed bug in RmpFlow.create_ground_plane() related to unit conversion
## [3.0.1] - 2022-05-02
### Added
- Added some accessors to ArticulationMotionPolicy and ArticulationSubset.
## [3.0.0] - 2022-04-29
### Added
- Added Kinematics interface with a Lula implementation
- Added ArticulationKinematicsSolver wrapper for interfacing kinematics with USD robot
### Changed
- Replaced InverseKinematicsSolver(BaseController) object with ArticulationKinematicsSolver
## [2.0.0] - 2022-04-21
### Changed
- Renamed MotionGenerator to ArticulationMotionPolicy
### Added
- Created ArticulationSubset class to handle index mapping between Articulation and MotionPolicy
## [1.3.1] - 2022-04-27
### Added
- Added RmpFlowSmoothed to lula/motion_policies.py to support cortex.
## [1.3.0] - 2022-04-18
### Changed
- Extracted methods from MotionPolicy to form a WorldInterface class. This has no functional effect on any code outside MotionGeneration
## [1.2.0] - 2022-04-15
### Changed
- Obstacles are now marked as static explicitly when added to MotionPolicy
## [1.1.0] - 2022-04-14
### Added
- Separated RmpFlow visualization functions for end effector and collision spheres
- Added test case for visualization
- Added Sdf.ChangeBlock() to visualization functions for efficiency
## [1.0.3] - 2022-04-13
### Changed
- Fixed typo in interface_config_loader.py.
## [1.0.2] - 2022-04-01
### Changed
- modified default RmpFlow configs have fewer updates per frame (10 was unnecessary) and to not ignore robot state updates by default
- updated golden values in tests as a direct result of config change
## [1.0.1] - 2022-04-01
### Added
- test case for motion_generation extension: test for proper behavior when add/enable/disable/remove objects to RmpFlow
### Fixed
- ground plane handling: enable/disable/remove ground_plane didn't work
- static obstacle handling: dictionary key error when enable/disable/remove static obstacles
## [1.0.0] - 2022-03-25
### Changed
- Restructured MotionGeneration extension to place emphasis on MotionPolicy over MotionGeneration. The user is now expected to interact directly with a MotionPolicy for adding/editing obstacles, and setting targets. MotionGeneration is a light utility class for interfacing the simulated USD robot to the MotionPolicy (get USD robot state and appropriately map the joint indeces).
- RmpFlowController -> MotionPolicyController:
- The RmpFlowController wrapper that was used to interface Core examples with RmpFlow has been expanded to wrap any MotionPolicy
- omni.isaac.motion_generation/policy_configs -> omni.isaac.motion_generation/motion_policy_configs: changed folder containing config files for MotionPolicies to be named "motion_policy_configs" to leave room for future interfaces to have config directories
- Path to RmpFlow: omni.isaac.motion_generation.LulaMotionPolicies.RmpFlow -> omni.isaac.motion_generation.lula.motion_policies.RmpFlow
### Added
- interface_config_loader: a set of helper functions for checking what config files exist directly in the motion_generation extension and loading the configs as keyword arguments to the appropriate class e.g. RmpFlow(**loaded_config_dict)
## [0.2.1] - 2022-02-15
- Updated internal RMPflow implementation to allow for visualizing Lula collision spheres as prims on the stage
## [0.2.0] - 2022-02-10
### Changed
- Updated MotionGeneration to use Core API to query prim position and control the robot
## [0.1.5] - 2022-02-10
### Fixed
- Undefined joint in dofbot USD referenced by RMPflow config
## [0.1.4] - 2022-01-20
### Added
- moved kinematics.py from omni.isaac.core.utils to this extension
## [0.1.3] - 2021-12-13
### Changed
- Removed deprecated fields from the Lula robot description files and RMPflow configuration files for the DOFBOT and Franka robots. This also corrects an oversight in the Franka robot description file that had resulted in a lack of collision spheres (and thus obstacle avoidance) for panda_link6.
## [0.1.2] - 2021-12-02
### Changed
- event_velocities to events_dt in PickPlaceController
- Added new phase of wait in PickPlaceController
## [0.1.1] - 2021-08-04
### Added
- Added a simple wheel base pose controller.
## [0.1.0] - 2021-08-04
### Added
- Initial version of Isaac Sim Motion Generation Extension
| 8,972 | Markdown | 27.305994 | 384 | 0.741864 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/docs/README.md | # Usage
To enable this extension, go to the Extension Manager menu and enable omni.isaac.motion_generation extension.
| 120 | Markdown | 23.199995 | 109 | 0.8 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.motion_generation/docs/index.rst | Motion Generation Extension [omni.isaac.motion_generation]
##########################################################
World Interface
================
.. autoclass:: omni.isaac.motion_generation.WorldInterface
:members:
:undoc-members:
:member-order: bysource
Motion Policy Interface
=======================
.. autoclass:: omni.isaac.motion_generation.MotionPolicy
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: omni.isaac.motion_generation.lula.motion_policies.RmpFlow
:members:
:undoc-members:
:member-order: bysource
ArticulationMotionPolicy
=========================
.. autoclass:: omni.isaac.motion_generation.ArticulationMotionPolicy
:members:
:undoc-members:
:member-order: bysource
KinematicsSolver
===========================
.. autoclass:: omni.isaac.motion_generation.KinematicsSolver
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: omni.isaac.motion_generation.LulaKinematicsSolver
:members:
:undoc-members:
:member-order: bysource
ArticulationKinematicsSolver
=============================
.. autoclass:: omni.isaac.motion_generation.ArticulationKinematicsSolver
:members:
:undoc-members:
:member-order: bysource
Path Planning Interface
========================
.. autoclass:: omni.isaac.motion_generation.PathPlanner
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: omni.isaac.motion_generation.lula.RRT
:members:
:undoc-members:
:member-order: bysource
Trajectory
===================
.. autoclass:: omni.isaac.motion_generation.Trajectory
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: omni.isaac.motion_generation.lula.LulaTrajectory
:members:
:undoc-members:
:member-order: bysource
Lula Trajectory Generators
==========================
.. autoclass:: omni.isaac.motion_generation.lula.LulaCSpaceTrajectoryGenerator
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: omni.isaac.motion_generation.lula.LulaTaskSpaceTrajectoryGenerator
:members:
:undoc-members:
:member-order: bysource
ArticulationTrajectory
======================
.. autoclass:: omni.isaac.motion_generation.ArticulationTrajectory
:members:
:undoc-members:
:member-order: bysource
Motion Policy Base Controller
==============================
.. automodule:: omni.isaac.motion_generation.motion_policy_controller
:inherited-members:
:members:
:undoc-members:
:exclude-members:
Wheel Base Pose Controller
===========================
.. automodule:: omni.isaac.motion_generation.wheel_base_pose_controller
:inherited-members:
:members:
:undoc-members:
:exclude-members:
| 2,677 | reStructuredText | 21.504201 | 81 | 0.663429 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/PACKAGE-LICENSES/omni.isaac.version-LICENSE.md | Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/config/extension.toml | [core]
reloadable = true
order = 0
[package]
version = "1.0.0"
category = "Other"
title = "Isaac Sim Version"
description = "Isaac Sim Version"
authors = ["NVIDIA"]
repository = ""
keywords = ["isaac"]
changelog = "docs/CHANGELOG.md"
readme = "docs/README.md"
icon = "data/icon.png"
[dependencies]
[[python.module]]
name = "omni.isaac.version" | 347 | TOML | 15.571428 | 33 | 0.682997 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/omni/isaac/version/__init__.py | # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from .version import *
| 452 | Python | 40.181815 | 76 | 0.803097 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/omni/isaac/version/version.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import sys
import os.path
import typing
import carb.settings
import carb.tokens
class Version:
def __init__(self):
self.core = ""
self.prerelease = ""
self.major = ""
self.minor = ""
self.patch = ""
self.pretag = ""
self.prebuild = ""
self.buildtag = ""
def parse_version(full_version: Version):
parsed_version = Version()
if "+" in full_version:
full_version, parsed_version.buildtag = full_version.split("+")
if "-" in full_version:
parsed_version.core, parsed_version.prerelease = full_version.split("-", maxsplit=1)
parsed_version.major, parsed_version.minor, parsed_version.patch = parsed_version.core.split(".", maxsplit=2)
parsed_version.pretag, parsed_version.prebuild = parsed_version.prerelease.split(".", maxsplit=1)
else:
parsed_version.major, parsed_version.minor, parsed_version.patch = full_version.split(".", maxsplit=2)
parsed_version.core = full_version
return parsed_version
def get_version() -> typing.Tuple[str, str, str, str, str, str, str, str]:
"""Retrieve version from file
Returns:
Core version (str)
Pre-release tag and build number (str)
Major version (str)
Minor version (str)
Patch version (str)
Pre-release tag (str)
Build number (str)
Build tag (str)
"""
app_folder = carb.settings.get_settings().get_as_string("/app/folder")
if not app_folder:
app_folder = carb.tokens.get_tokens_interface().resolve("${app}")
app_start_folder = os.path.normpath(os.path.join(app_folder, os.pardir))
app_version = open(f"{app_start_folder}/VERSION").readline().strip()
parsed_version = parse_version(app_version)
return (
parsed_version.core,
parsed_version.prerelease,
parsed_version.major,
parsed_version.minor,
parsed_version.patch,
parsed_version.pretag,
parsed_version.prebuild,
parsed_version.buildtag,
)
| 2,476 | Python | 32.931506 | 117 | 0.657512 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/docs/CHANGELOG.md | # Changelog
## [1.0.0] - 2022-05-12
### Added
- Added first version of version.
| 82 | Markdown | 10.857141 | 33 | 0.621951 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/docs/README.md | # Usage
To enable this extension, go to the Extension Manager menu and enable omni.isaac.version extension | 107 | Markdown | 34.999988 | 98 | 0.813084 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.version/docs/index.rst | omni.isaac.version
###########################
.. toctree::
:maxdepth: 1
CHANGELOG
| 93 | reStructuredText | 8.399999 | 27 | 0.44086 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/PACKAGE-LICENSES/omni.isaac.franka-LICENSE.md | Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/config/extension.toml | [core]
reloadable = true
order = 0
[package]
version = "0.4.0"
category = "Simulation"
title = "Isaac Franka Robot"
description = "Isaac Franka Robot Helper Class"
authors = ["NVIDIA"]
repository = ""
keywords = ["isaac"]
changelog = "docs/CHANGELOG.md"
readme = "docs/README.md"
icon = "data/icon.png"
[dependencies]
"omni.isaac.core" = {}
"omni.isaac.motion_generation" = {}
"omni.isaac.manipulators" = {}
[[python.module]]
name = "omni.isaac.franka"
| 456 | TOML | 18.041666 | 47 | 0.686404 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/__init__.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.franka.franka import Franka
from omni.isaac.franka.kinematics_solver import KinematicsSolver
| 537 | Python | 47.909087 | 76 | 0.819367 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/franka.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from typing import Optional, List
import numpy as np
from omni.isaac.core.robots.robot import Robot
from omni.isaac.core.prims.rigid_prim import RigidPrim
from omni.isaac.core.utils.prims import get_prim_at_path
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.utils.stage import add_reference_to_stage, get_stage_units
import carb
from omni.isaac.manipulators.grippers.parallel_gripper import ParallelGripper
class Franka(Robot):
"""[summary]
Args:
prim_path (str): [description]
name (str, optional): [description]. Defaults to "franka_robot".
usd_path (Optional[str], optional): [description]. Defaults to None.
position (Optional[np.ndarray], optional): [description]. Defaults to None.
orientation (Optional[np.ndarray], optional): [description]. Defaults to None.
end_effector_prim_name (Optional[str], optional): [description]. Defaults to None.
gripper_dof_names (Optional[List[str]], optional): [description]. Defaults to None.
gripper_open_position (Optional[np.ndarray], optional): [description]. Defaults to None.
gripper_closed_position (Optional[np.ndarray], optional): [description]. Defaults to None.
"""
def __init__(
self,
prim_path: str,
name: str = "franka_robot",
usd_path: Optional[str] = None,
position: Optional[np.ndarray] = None,
orientation: Optional[np.ndarray] = None,
end_effector_prim_name: Optional[str] = None,
gripper_dof_names: Optional[List[str]] = None,
gripper_open_position: Optional[np.ndarray] = None,
gripper_closed_position: Optional[np.ndarray] = None,
deltas: Optional[np.ndarray] = None,
) -> None:
prim = get_prim_at_path(prim_path)
self._end_effector = None
self._gripper = None
self._end_effector_prim_name = end_effector_prim_name
if not prim.IsValid():
if usd_path:
add_reference_to_stage(usd_path=usd_path, prim_path=prim_path)
else:
assets_root_path = get_assets_root_path()
if assets_root_path is None:
carb.log_error("Could not find Isaac Sim assets folder")
usd_path = assets_root_path + "/Isaac/Robots/Franka/franka.usd"
add_reference_to_stage(usd_path=usd_path, prim_path=prim_path)
if self._end_effector_prim_name is None:
self._end_effector_prim_path = prim_path + "/panda_rightfinger"
else:
self._end_effector_prim_path = prim_path + "/" + end_effector_prim_name
if gripper_dof_names is None:
gripper_dof_names = ["panda_finger_joint1", "panda_finger_joint2"]
if gripper_open_position is None:
gripper_open_position = np.array([0.05, 0.05]) / get_stage_units()
if gripper_closed_position is None:
gripper_closed_position = np.array([0.0, 0.0])
else:
if self._end_effector_prim_name is None:
self._end_effector_prim_path = prim_path + "/panda_rightfinger"
else:
self._end_effector_prim_path = prim_path + "/" + end_effector_prim_name
if gripper_dof_names is None:
gripper_dof_names = ["panda_finger_joint1", "panda_finger_joint2"]
if gripper_open_position is None:
gripper_open_position = np.array([0.05, 0.05]) / get_stage_units()
if gripper_closed_position is None:
gripper_closed_position = np.array([0.0, 0.0])
super().__init__(
prim_path=prim_path, name=name, position=position, orientation=orientation, articulation_controller=None
)
if gripper_dof_names is not None:
if deltas is None:
deltas = np.array([0.05, 0.05]) / get_stage_units()
self._gripper = ParallelGripper(
end_effector_prim_path=self._end_effector_prim_path,
joint_prim_names=gripper_dof_names,
joint_opened_positions=gripper_open_position,
joint_closed_positions=gripper_closed_position,
action_deltas=deltas,
)
return
@property
def end_effector(self) -> RigidPrim:
"""[summary]
Returns:
RigidPrim: [description]
"""
return self._end_effector
@property
def gripper(self) -> ParallelGripper:
"""[summary]
Returns:
ParallelGripper: [description]
"""
return self._gripper
def initialize(self, physics_sim_view=None) -> None:
"""[summary]
"""
super().initialize(physics_sim_view)
self._end_effector = RigidPrim(prim_path=self._end_effector_prim_path, name=self.name + "_end_effector")
self._end_effector.initialize(physics_sim_view)
self._gripper.initialize(
physics_sim_view=physics_sim_view,
articulation_apply_action_func=self.apply_action,
get_joint_positions_func=self.get_joint_positions,
set_joint_positions_func=self.set_joint_positions,
dof_names=self.dof_names,
)
return
def post_reset(self) -> None:
"""[summary]
"""
super().post_reset()
self._gripper.post_reset()
self._articulation_controller.switch_dof_control_mode(
dof_index=self.gripper.joint_dof_indicies[0], mode="position"
)
self._articulation_controller.switch_dof_control_mode(
dof_index=self.gripper.joint_dof_indicies[1], mode="position"
)
return
| 6,207 | Python | 42.71831 | 116 | 0.612856 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/kinematics_solver.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.motion_generation import ArticulationKinematicsSolver, interface_config_loader, LulaKinematicsSolver
from omni.isaac.core.articulations import Articulation
from typing import Optional
class KinematicsSolver(ArticulationKinematicsSolver):
"""Kinematics Solver for Franka robot. This class loads a LulaKinematicsSovler object
Args:
robot_articulation (Articulation): An initialized Articulation object representing this Franka
end_effector_frame_name (Optional[str]): The name of the Franka end effector. If None, an end effector link will
be automatically selected. Defaults to None.
"""
def __init__(self, robot_articulation: Articulation, end_effector_frame_name: Optional[str] = None) -> None:
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config("Franka")
self._kinematics = LulaKinematicsSolver(**kinematics_config)
if end_effector_frame_name is None:
end_effector_frame_name = "right_gripper"
ArticulationKinematicsSolver.__init__(self, robot_articulation, self._kinematics, end_effector_frame_name)
return
| 1,598 | Python | 47.454544 | 121 | 0.760951 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/tasks/pick_place.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import omni.isaac.core.tasks as tasks
from omni.isaac.franka import Franka
from omni.isaac.core.utils.prims import is_prim_path_valid
from omni.isaac.core.utils.string import find_unique_string_name
from typing import Optional
import numpy as np
class PickPlace(tasks.PickPlace):
"""[summary]
Args:
name (str, optional): [description]. Defaults to "franka_pick_place".
cube_initial_position (Optional[np.ndarray], optional): [description]. Defaults to None.
cube_initial_orientation (Optional[np.ndarray], optional): [description]. Defaults to None.
target_position (Optional[np.ndarray], optional): [description]. Defaults to None.
cube_size (Optional[np.ndarray], optional): [description]. Defaults to None.
offset (Optional[np.ndarray], optional): [description]. Defaults to None.
"""
def __init__(
self,
name: str = "franka_pick_place",
cube_initial_position: Optional[np.ndarray] = None,
cube_initial_orientation: Optional[np.ndarray] = None,
target_position: Optional[np.ndarray] = None,
cube_size: Optional[np.ndarray] = None,
offset: Optional[np.ndarray] = None,
) -> None:
tasks.PickPlace.__init__(
self,
name=name,
cube_initial_position=cube_initial_position,
cube_initial_orientation=cube_initial_orientation,
target_position=target_position,
cube_size=cube_size,
offset=offset,
)
return
def set_robot(self) -> Franka:
"""[summary]
Returns:
Franka: [description]
"""
franka_prim_path = find_unique_string_name(
initial_name="/World/Franka", is_unique_fn=lambda x: not is_prim_path_valid(x)
)
franka_robot_name = find_unique_string_name(
initial_name="my_franka", is_unique_fn=lambda x: not self.scene.object_exists(x)
)
return Franka(prim_path=franka_prim_path, name=franka_robot_name)
| 2,499 | Python | 39.32258 | 103 | 0.654662 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/tasks/stacking.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.core.tasks import Stacking as BaseStacking
from omni.isaac.franka import Franka
from omni.isaac.core.utils.prims import is_prim_path_valid
from omni.isaac.core.utils.string import find_unique_string_name
from omni.isaac.core.utils.stage import get_stage_units
import numpy as np
from typing import Optional
class Stacking(BaseStacking):
"""[summary]
Args:
name (str, optional): [description]. Defaults to "franka_stacking".
target_position (Optional[np.ndarray], optional): [description]. Defaults to None.
cube_size (Optional[np.ndarray], optional): [description]. Defaults to None.
offset (Optional[np.ndarray], optional): [description]. Defaults to None.
"""
def __init__(
self,
name: str = "franka_stacking",
target_position: Optional[np.ndarray] = None,
cube_size: Optional[np.ndarray] = None,
offset: Optional[np.ndarray] = None,
) -> None:
if target_position is None:
target_position = np.array([0.5, 0.5, 0]) / get_stage_units()
BaseStacking.__init__(
self,
name=name,
cube_initial_positions=np.array([[0.3, 0.3, 0.3], [0.3, -0.3, 0.3]]) / get_stage_units(),
cube_initial_orientations=None,
stack_target_position=target_position,
cube_size=cube_size,
offset=offset,
)
return
def set_robot(self) -> Franka:
"""[summary]
Returns:
Franka: [description]
"""
franka_prim_path = find_unique_string_name(
initial_name="/World/Franka", is_unique_fn=lambda x: not is_prim_path_valid(x)
)
franka_robot_name = find_unique_string_name(
initial_name="my_franka", is_unique_fn=lambda x: not self.scene.object_exists(x)
)
return Franka(prim_path=franka_prim_path, name=franka_robot_name)
| 2,379 | Python | 38.016393 | 101 | 0.644388 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/tasks/__init__.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.franka.tasks.follow_target import FollowTarget
from omni.isaac.franka.tasks.pick_place import PickPlace
from omni.isaac.franka.tasks.stacking import Stacking
| 602 | Python | 49.249996 | 76 | 0.820598 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/tasks/follow_target.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import omni.isaac.core.tasks as tasks
from omni.isaac.franka import Franka
from omni.isaac.core.utils.prims import is_prim_path_valid
from omni.isaac.core.utils.string import find_unique_string_name
from typing import Optional
import numpy as np
class FollowTarget(tasks.FollowTarget):
"""[summary]
Args:
name (str, optional): [description]. Defaults to "franka_follow_target".
target_prim_path (Optional[str], optional): [description]. Defaults to None.
target_name (Optional[str], optional): [description]. Defaults to None.
target_position (Optional[np.ndarray], optional): [description]. Defaults to None.
target_orientation (Optional[np.ndarray], optional): [description]. Defaults to None.
offset (Optional[np.ndarray], optional): [description]. Defaults to None.
franka_prim_path (Optional[str], optional): [description]. Defaults to None.
franka_robot_name (Optional[str], optional): [description]. Defaults to None.
"""
def __init__(
self,
name: str = "franka_follow_target",
target_prim_path: Optional[str] = None,
target_name: Optional[str] = None,
target_position: Optional[np.ndarray] = None,
target_orientation: Optional[np.ndarray] = None,
offset: Optional[np.ndarray] = None,
franka_prim_path: Optional[str] = None,
franka_robot_name: Optional[str] = None,
) -> None:
tasks.FollowTarget.__init__(
self,
name=name,
target_prim_path=target_prim_path,
target_name=target_name,
target_position=target_position,
target_orientation=target_orientation,
offset=offset,
)
self._franka_prim_path = franka_prim_path
self._franka_robot_name = franka_robot_name
return
def set_robot(self) -> Franka:
"""[summary]
Returns:
Franka: [description]
"""
if self._franka_prim_path is None:
self._franka_prim_path = find_unique_string_name(
initial_name="/World/Franka", is_unique_fn=lambda x: not is_prim_path_valid(x)
)
if self._franka_robot_name is None:
self._franka_robot_name = find_unique_string_name(
initial_name="my_franka", is_unique_fn=lambda x: not self.scene.object_exists(x)
)
return Franka(prim_path=self._franka_prim_path, name=self._franka_robot_name)
| 2,963 | Python | 41.342857 | 97 | 0.643267 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/controllers/rmpflow_controller.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import omni.isaac.motion_generation as mg
from omni.isaac.core.articulations import Articulation
class RMPFlowController(mg.MotionPolicyController):
"""[summary]
Args:
name (str): [description]
robot_articulation (Articulation): [description]
physics_dt (float, optional): [description]. Defaults to 1.0/60.0.
"""
def __init__(self, name: str, robot_articulation: Articulation, physics_dt: float = 1.0 / 60.0) -> None:
self.rmp_flow_config = mg.interface_config_loader.load_supported_motion_policy_config("Franka", "RMPflow")
self.rmp_flow = mg.lula.motion_policies.RmpFlow(**self.rmp_flow_config)
self.articulation_rmp = mg.ArticulationMotionPolicy(robot_articulation, self.rmp_flow, physics_dt)
mg.MotionPolicyController.__init__(self, name=name, articulation_motion_policy=self.articulation_rmp)
self._default_position, self._default_orientation = (
self._articulation_motion_policy._robot_articulation.get_world_pose()
)
self._motion_policy.set_robot_base_pose(
robot_position=self._default_position, robot_orientation=self._default_orientation
)
return
def reset(self):
mg.MotionPolicyController.reset(self)
self._motion_policy.set_robot_base_pose(
robot_position=self._default_position, robot_orientation=self._default_orientation
)
| 1,870 | Python | 43.547618 | 114 | 0.705348 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/controllers/__init__.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.franka.controllers.rmpflow_controller import RMPFlowController
from omni.isaac.franka.controllers.pick_place_controller import PickPlaceController
from omni.isaac.franka.controllers.stacking_controller import StackingController
| 672 | Python | 55.083329 | 83 | 0.83631 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/controllers/pick_place_controller.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from omni.isaac.manipulators.grippers.parallel_gripper import ParallelGripper
import omni.isaac.manipulators.controllers as manipulators_controllers
from omni.isaac.core.articulations import Articulation
from omni.isaac.franka.controllers import RMPFlowController
from typing import Optional, List
class PickPlaceController(manipulators_controllers.PickPlaceController):
"""[summary]
Args:
name (str): [description]
gripper (ParallelGripper): [description]
robot_articulation (Articulation): [description]
end_effector_initial_height (Optional[float], optional): [description]. Defaults to None.
events_dt (Optional[List[float]], optional): [description]. Defaults to None.
"""
def __init__(
self,
name: str,
gripper: ParallelGripper,
robot_articulation: Articulation,
end_effector_initial_height: Optional[float] = None,
events_dt: Optional[List[float]] = None,
) -> None:
if events_dt is None:
events_dt = [0.008, 0.005, 1, 0.1, 0.05, 0.05, 0.0025, 1, 0.008, 0.08]
manipulators_controllers.PickPlaceController.__init__(
self,
name=name,
cspace_controller=RMPFlowController(
name=name + "_cspace_controller", robot_articulation=robot_articulation
),
gripper=gripper,
end_effector_initial_height=end_effector_initial_height,
events_dt=events_dt,
)
return
| 1,967 | Python | 39.999999 | 101 | 0.677682 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/omni/isaac/franka/controllers/stacking_controller.py | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import omni.isaac.manipulators.controllers as manipulators_controllers
from omni.isaac.franka.controllers import PickPlaceController
from omni.isaac.manipulators.grippers.parallel_gripper import ParallelGripper
from omni.isaac.core.articulations import Articulation
from typing import List
class StackingController(manipulators_controllers.StackingController):
"""[summary]
Args:
name (str): [description]
gripper (ParallelGripper): [description]
robot_prim_path (str): [description]
picking_order_cube_names (List[str]): [description]
robot_observation_name (str): [description]
"""
def __init__(
self,
name: str,
gripper: ParallelGripper,
robot_articulation: Articulation,
picking_order_cube_names: List[str],
robot_observation_name: str,
) -> None:
manipulators_controllers.StackingController.__init__(
self,
name=name,
pick_place_controller=PickPlaceController(
name=name + "_pick_place_controller", gripper=gripper, robot_articulation=robot_articulation
),
picking_order_cube_names=picking_order_cube_names,
robot_observation_name=robot_observation_name,
)
return
| 1,749 | Python | 37.888888 | 108 | 0.691252 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/docs/CHANGELOG.md | # Changelog
## [0.4.0] - 2022-09-27
### Removed
- usd files local to extension
## [0.3.0] - 2022-07-26
### Removed
- Removed GripperController class and used the new ParallelGripper class instead.
### Changed
- Changed gripper_dof_indices argument in PickPlaceController to gripper
- Changed gripper_dof_indices argument in StackingController to gripper
### Added
- Added deltas argument in Franka class for the gripper action deltas when openning or closing.
## [0.2.1] - 2022-07-22
### Fixed
- Bug with adding a custom usd for manipulator
## [0.2.0] - 2022-05-02
### Changed
- Changed InverseKinematicsSolver class to KinematicsSolver class, using the new LulaKinematicsSolver class in motion_generation
## [0.1.4] - 2022-04-21
### Changed
- Updated RmpFlowController class init alongside modifying motion_generation extension
## [0.1.3] - 2022-04-13
### Changed
- Fix Franka units in gripper open config.
## [0.1.2] - 2022-03-25
### Changed
- Updated RmpFlowController class alongside changes to motion_generation extension
## [0.1.1] - 2022-03-16
### Changed
- Replaced find_nucleus_server() with get_assets_root_path()
## [0.1.0] - 2021-09-01
### Added
- Added Franka class and and Franka Task Follower Class
| 1,234 | Markdown | 21.87037 | 128 | 0.724473 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/docs/README.md | # Usage
To enable this extension, go to the Extension Manager menu and enable omni.isaac.franka extension | 106 | Markdown | 34.666655 | 97 | 0.811321 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.franka/docs/index.rst | Franka Robot [omni.isaac.franka]
################################
Franka
=============
.. automodule:: omni.isaac.franka.franka
:inherited-members:
:members:
:undoc-members:
:exclude-members:
Franka Kinematics Solver
=========================
.. automodule:: omni.isaac.franka.kinematics_solver
:inherited-members:
:members:
Franka Controllers
==================
.. automodule:: omni.isaac.franka.controllers
:inherited-members:
:imported-members:
:members:
:undoc-members:
:exclude-members:
Franka Tasks
=============
.. automodule:: omni.isaac.franka.tasks
:inherited-members:
:imported-members:
:members:
:undoc-members:
:exclude-members:
| 717 | reStructuredText | 16.095238 | 51 | 0.585774 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/PACKAGE-LICENSES/omni.isaac.debug_draw-LICENSE.md | Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited. | 412 | Markdown | 57.999992 | 74 | 0.839806 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/config/extension.toml | [core]
reloadable = true
order = 0
[package]
version = "0.2.3"
category = "Simulation"
title = "Isaac Sim Debug Drawing"
description = "Persistent Debug Drawing Helpers"
authors = ["NVIDIA"]
repository = ""
keywords = ["isaac", "physics", "inspect",]
changelog = "docs/CHANGELOG.md"
readme = "docs/README.md"
icon = "data/icon.png"
writeTarget.kit = true
# Other extensions that must be loaded before this one
[dependencies]
"omni.graph" = {}
"omni.graph.tools" = {}
"omni.debugdraw" = {}
# needed to access drawing interfaces:
"omni.kit.renderer.core" = {}
"omni.kit.viewport.window" = {}
"omni.hydra.rtx" = {}
# The generated tests will make use of these modules
"omni.usd" = {}
"omni.kit.async_engine" = {}
[[python.module]]
name = "omni.isaac.debug_draw"
[[python.module]]
name = "omni.isaac.debug_draw.tests"
# Watch the .ogn files for hot reloading (only for Python files)
[fswatcher.patterns]
include = ["*.ogn", "*.py"]
exclude = ["Ogn*Database.py"]
[[native.plugin]]
path = "bin/*.plugin"
recursive = false | 1,022 | TOML | 21.733333 | 64 | 0.68591 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/__init__.py | # Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from .scripts.extension import *
| 467 | Python | 41.545451 | 76 | 0.805139 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/ogn/OgnDebugDrawPointCloudDatabase.py | """Support for simplified access to data on nodes of type omni.isaac.debug_draw.DebugDrawPointCloud
Take a point cloud as input and display it in the scene.
"""
import omni.graph.core as og
import omni.graph.core._omni_graph_core as _og
import omni.graph.tools.ogn as ogn
import carb
import numpy
class OgnDebugDrawPointCloudDatabase(og.Database):
"""Helper class providing simplified access to data on nodes of type omni.isaac.debug_draw.DebugDrawPointCloud
Class Members:
node: Node being evaluated
Attribute Value Properties:
Inputs:
inputs.color
inputs.depthTest
inputs.execIn
inputs.pointCloudData
inputs.transform
inputs.width
"""
# This is an internal object that provides per-class storage of a per-node data dictionary
PER_NODE_DATA = {}
# This is an internal object that describes unchanging attributes in a generic way
# The values in this list are in no particular order, as a per-attribute tuple
# Name, Type, ExtendedTypeIndex, UiName, Description, Metadata,
# Is_Required, DefaultValue, Is_Deprecated, DeprecationMsg
# You should not need to access any of this data directly, use the defined database interfaces
INTERFACE = og.Database._get_interface([
('inputs:color', 'color4f', 0, None, 'Color of points', {ogn.MetadataKeys.DEFAULT: '[0.75, 0.75, 1, 1]'}, True, [0.75, 0.75, 1, 1], False, ''),
('inputs:depthTest', 'bool', 0, 'Depth Test Points', 'If true, the points will not render when behind other objects.', {ogn.MetadataKeys.DEFAULT: 'true'}, True, True, False, ''),
('inputs:execIn', 'execution', 0, None, 'The input execution port', {}, True, None, False, ''),
('inputs:pointCloudData', 'point3f[]', 0, None, 'Buffer of 3d points containing point cloud data', {ogn.MetadataKeys.DEFAULT: '[]'}, True, [], False, ''),
('inputs:transform', 'matrix4d', 0, None, 'The matrix to transform the points by', {}, True, [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]], False, ''),
('inputs:width', 'float', 0, None, 'Size of points', {ogn.MetadataKeys.DEFAULT: '0.02'}, True, 0.02, False, ''),
])
@classmethod
def _populate_role_data(cls):
"""Populate a role structure with the non-default roles on this node type"""
role_data = super()._populate_role_data()
role_data.inputs.color = og.Database.ROLE_COLOR
role_data.inputs.execIn = og.Database.ROLE_EXECUTION
role_data.inputs.pointCloudData = og.Database.ROLE_POINT
role_data.inputs.transform = og.Database.ROLE_MATRIX
return role_data
class ValuesForInputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = {"color", "depthTest", "execIn", "transform", "width", "_setting_locked", "_batchedReadAttributes", "_batchedReadValues"}
"""Helper class that creates natural hierarchical access to input attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedReadAttributes = [self._attributes.color, self._attributes.depthTest, self._attributes.execIn, self._attributes.transform, self._attributes.width]
self._batchedReadValues = [[0.75, 0.75, 1, 1], True, None, [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0], 0.02]
@property
def pointCloudData(self):
data_view = og.AttributeValueHelper(self._attributes.pointCloudData)
return data_view.get()
@pointCloudData.setter
def pointCloudData(self, value):
if self._setting_locked:
raise og.ReadOnlyError(self._attributes.pointCloudData)
data_view = og.AttributeValueHelper(self._attributes.pointCloudData)
data_view.set(value)
self.pointCloudData_size = data_view.get_array_size()
@property
def color(self):
return self._batchedReadValues[0]
@color.setter
def color(self, value):
self._batchedReadValues[0] = value
@property
def depthTest(self):
return self._batchedReadValues[1]
@depthTest.setter
def depthTest(self, value):
self._batchedReadValues[1] = value
@property
def execIn(self):
return self._batchedReadValues[2]
@execIn.setter
def execIn(self, value):
self._batchedReadValues[2] = value
@property
def transform(self):
return self._batchedReadValues[3]
@transform.setter
def transform(self, value):
self._batchedReadValues[3] = value
@property
def width(self):
return self._batchedReadValues[4]
@width.setter
def width(self, value):
self._batchedReadValues[4] = value
def __getattr__(self, item: str):
if item in self.LOCAL_PROPERTY_NAMES:
return object.__getattribute__(self, item)
else:
return super().__getattr__(item)
def __setattr__(self, item: str, new_value):
if item in self.LOCAL_PROPERTY_NAMES:
object.__setattr__(self, item, new_value)
else:
super().__setattr__(item, new_value)
def _prefetch(self):
readAttributes = self._batchedReadAttributes
newValues = _og._prefetch_input_attributes_data(readAttributes)
if len(readAttributes) == len(newValues):
self._batchedReadValues = newValues
class ValuesForOutputs(og.DynamicAttributeAccess):
LOCAL_PROPERTY_NAMES = { }
"""Helper class that creates natural hierarchical access to output attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
self._batchedWriteValues = { }
def _commit(self):
_og._commit_output_attributes_data(self._batchedWriteValues)
self._batchedWriteValues = { }
class ValuesForState(og.DynamicAttributeAccess):
"""Helper class that creates natural hierarchical access to state attributes"""
def __init__(self, node: og.Node, attributes, dynamic_attributes: og.DynamicAttributeInterface):
"""Initialize simplified access for the attribute data"""
context = node.get_graph().get_default_graph_context()
super().__init__(context, node, attributes, dynamic_attributes)
def __init__(self, node):
super().__init__(node)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT)
self.inputs = OgnDebugDrawPointCloudDatabase.ValuesForInputs(node, self.attributes.inputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT)
self.outputs = OgnDebugDrawPointCloudDatabase.ValuesForOutputs(node, self.attributes.outputs, dynamic_attributes)
dynamic_attributes = self.dynamic_attribute_data(node, og.AttributePortType.ATTRIBUTE_PORT_TYPE_STATE)
self.state = OgnDebugDrawPointCloudDatabase.ValuesForState(node, self.attributes.state, dynamic_attributes)
| 7,785 | Python | 48.910256 | 202 | 0.642518 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/ogn/tests/TestOgnDebugDrawPointCloud.py | import omni.kit.test
import omni.graph.core as og
import omni.graph.core.tests as ogts
import os
class TestOgn(ogts.OmniGraphTestCase):
async def test_data_access(self):
from omni.isaac.debug_draw.ogn.OgnDebugDrawPointCloudDatabase import OgnDebugDrawPointCloudDatabase
test_file_name = "OgnDebugDrawPointCloudTemplate.usda"
usd_path = os.path.join(os.path.dirname(__file__), "usd", test_file_name)
if not os.path.exists(usd_path):
self.assertTrue(False, f"{usd_path} not found for loading test")
(result, error) = await ogts.load_test_file(usd_path)
self.assertTrue(result, f'{error} on {usd_path}')
test_node = og.Controller.node("/TestGraph/Template_omni_isaac_debug_draw_DebugDrawPointCloud")
database = OgnDebugDrawPointCloudDatabase(test_node)
self.assertTrue(test_node.is_valid())
node_type_name = test_node.get_type_name()
self.assertEqual(og.GraphRegistry().get_node_type_version(node_type_name), 1)
def _attr_error(attribute: og.Attribute, usd_test: bool) -> str:
test_type = "USD Load" if usd_test else "Database Access"
return f"{node_type_name} {test_type} Test - {attribute.get_name()} value error"
self.assertTrue(test_node.get_attribute_exists("inputs:color"))
attribute = test_node.get_attribute("inputs:color")
db_value = database.inputs.color
expected_value = [0.75, 0.75, 1, 1]
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:depthTest"))
attribute = test_node.get_attribute("inputs:depthTest")
db_value = database.inputs.depthTest
expected_value = True
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:execIn"))
attribute = test_node.get_attribute("inputs:execIn")
db_value = database.inputs.execIn
self.assertTrue(test_node.get_attribute_exists("inputs:pointCloudData"))
attribute = test_node.get_attribute("inputs:pointCloudData")
db_value = database.inputs.pointCloudData
expected_value = []
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:transform"))
attribute = test_node.get_attribute("inputs:transform")
db_value = database.inputs.transform
expected_value = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
self.assertTrue(test_node.get_attribute_exists("inputs:width"))
attribute = test_node.get_attribute("inputs:width")
db_value = database.inputs.width
expected_value = 0.02
actual_value = og.Controller.get(attribute)
ogts.verify_values(expected_value, actual_value, _attr_error(attribute, True))
ogts.verify_values(expected_value, db_value, _attr_error(attribute, False))
| 3,705 | Python | 51.197182 | 107 | 0.676923 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/ogn/tests/__init__.py | """====== GENERATED BY omni.graph.tools - DO NOT EDIT ======"""
import omni.graph.tools as ogt
ogt.import_tests_in_directory(__file__, __name__)
| 145 | Python | 35.499991 | 63 | 0.634483 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/scripts/extension.py | # Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
import omni.ext
from .. import _debug_draw
class Extension(omni.ext.IExt):
def on_startup(self):
self._draw = _debug_draw.acquire_debug_draw_interface()
def on_shutdown(self):
_debug_draw.release_debug_draw_interface(self._draw)
| 691 | Python | 31.952379 | 76 | 0.758321 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/tests/test_debug_draw.py | # Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
# NOTE:
# omni.kit.test - std python's unittest module with additional wrapping to add suport for async/await tests
# For most things refer to unittest docs: https://docs.python.org/3/library/unittest.html
import omni.kit.test
from omni.isaac.debug_draw import _debug_draw
import random
# Having a test class dervived from omni.kit.test.AsyncTestCase declared on the root of module will make it auto-discoverable by omni.kit.test
class TestDebugDraw(omni.kit.test.AsyncTestCase):
# Before running each test
async def setUp(self):
self._draw = _debug_draw.acquire_debug_draw_interface()
pass
# After running each test
async def tearDown(self):
await omni.kit.app.get_app().next_update_async()
pass
# Actual test, notice it is "async" function, so "await" can be used if needed
async def test_draw_points(self):
N = 10000
point_list_1 = [
(random.uniform(-1000, 1000), random.uniform(-1000, 1000), random.uniform(-1000, 1000)) for _ in range(N)
]
point_list_2 = [
(random.uniform(-1000, 1000), random.uniform(1000, 3000), random.uniform(-1000, 1000)) for _ in range(N)
]
point_list_3 = [
(random.uniform(-1000, 1000), random.uniform(-3000, -1000), random.uniform(-1000, 1000)) for _ in range(N)
]
colors = [(random.uniform(0.5, 1), random.uniform(0.5, 1), random.uniform(0.5, 1), 1) for _ in range(N)]
sizes = [random.randint(1, 50) for _ in range(N)]
self._draw.draw_points(point_list_1, [(1, 0, 0, 1)] * N, [10] * N)
self._draw.draw_points(point_list_2, [(0, 1, 0, 1)] * N, [10] * N)
self._draw.draw_points(point_list_3, colors, sizes)
self.assertEqual(self._draw.get_num_points(), 3 * N)
self._draw.clear_points()
self.assertEqual(self._draw.get_num_points(), 0)
pass
async def test_draw_lines(self):
N = 10000
point_list_1 = [
(random.uniform(1000, 3000), random.uniform(-1000, 1000), random.uniform(-1000, 1000)) for _ in range(N)
]
point_list_2 = [
(random.uniform(1000, 3000), random.uniform(-1000, 1000), random.uniform(-1000, 1000)) for _ in range(N)
]
colors = [(random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1), 1) for _ in range(N)]
sizes = [random.randint(1, 25) for _ in range(N)]
self._draw.draw_lines(point_list_1, point_list_2, colors, sizes)
self.assertEqual(self._draw.get_num_lines(), N)
self._draw.clear_lines()
self.assertEqual(self._draw.get_num_lines(), 0)
pass
async def test_draw_spline(self):
point_list_1 = [
(random.uniform(-300, -100), random.uniform(-100, 100), random.uniform(-100, 100)) for _ in range(10)
]
self._draw.draw_lines_spline(point_list_1, (1, 1, 1, 1), 10, False)
point_list_2 = [
(random.uniform(-300, -100), random.uniform(-100, 100), random.uniform(-100, 100)) for _ in range(10)
]
self._draw.draw_lines_spline(point_list_2, (1, 1, 1, 1), 5, True)
self.assertGreater(self._draw.get_num_lines(), 0)
self._draw.clear_lines()
self.assertEqual(self._draw.get_num_lines(), 0)
pass
| 3,735 | Python | 44.560975 | 142 | 0.627041 |
swadaskar/Isaac_Sim_Folder/exts/omni.isaac.debug_draw/omni/isaac/debug_draw/tests/__init__.py | # Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
"""
Presence of this file allows the tests directory to be imported as a module so that all of its contents
can be scanned to automatically add tests that are placed into this directory.
"""
| 624 | Python | 47.076919 | 103 | 0.799679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.