Access to manipulators from envs created with GridCloner

Hello,

I use the GridClone class to clone an environment containing an instance of SingleManipulator. I viewed how to have access to the robot_view and how to be able to get the local/world poses of the robots.
However, I’d also like to have access to the different manipulators in order to be able to apply inverse kinematics to the manipulators of the environments. Do someone know how I could do it ?

Below is an example code of an environment I vectorize. I’m able to use the manipulator from env_0 but not the other ones.

Thank you in advance

from omni.isaac.kit import SimulationApp

simulation_app = SimulationApp({"headless": False})

from omni.isaac.core import World
from omni.isaac.manipulators import SingleManipulator
from omni.isaac.manipulators.grippers import ParallelGripper
from omni.isaac.core.utils.nucleus import get_assets_root_path
from omni.isaac.core.articulations import ArticulationView
from omni.isaac.core.utils.stage import add_reference_to_stage
from omni.isaac.cloner import GridCloner
from omni.isaac.core.utils.prims import define_prim
from omni.isaac.core.prims import RigidPrimView
from omni.isaac.motion_generation import interface_config_loader
from omni.isaac.motion_generation import ArticulationKinematicsSolver, LulaKinematicsSolver
import carb
import sys
import numpy as np



my_world = World(stage_units_in_meters=1.0)
my_world.scene.add_default_ground_plane()

# set up grid cloner
env_0_path = "/World/envs/env_0"
cloner = GridCloner(spacing=1.5)
cloner.define_base_env("/World/envs")
define_prim(env_0_path)

# Create SingleManipulator for env_0 
asset_path = get_assets_root_path() + "/Isaac/Robots/Franka/franka_alt_fingers.usd"
prim_path = env_0_path + "/" + "Franka"
add_reference_to_stage(usd_path=asset_path, prim_path=prim_path)
gripper = ParallelGripper(
    end_effector_prim_path= prim_path + "/" + "panda_rightfinger",
    joint_prim_names=["panda_finger_joint1", "panda_finger_joint2"],
    joint_opened_positions=np.array([0.05, 0.05]),
    joint_closed_positions=np.array([0.0, 0.0]),
    action_deltas=np.array([0.05, 0.05]),
)
my_franka = my_world.scene.add(
    SingleManipulator(
        prim_path=prim_path, name="my_franka", end_effector_prim_name="panda_rightfinger", gripper=gripper
    )
)
my_franka.gripper.set_default_state(my_franka.gripper.joint_opened_positions)

# Add kinematic solver for my_franka to env_0
kinematics_config = interface_config_loader.load_supported_lula_kinematics_solver_config("Franka")
kinematics = LulaKinematicsSolver(**kinematics_config)
articulation_controller = my_franka.get_articulation_controller()
ik_controller = ArticulationKinematicsSolver(my_franka, kinematics, end_effector_frame_name="panda_rightfinger")

# clone environments
prim_paths = cloner.generate_paths("/World/envs/env", 4)
env_pos = cloner.clone(source_prim_path="/World/envs/env_0", prim_paths=prim_paths)

# Create an articulation view for all the robots
robot_view = ArticulationView(prim_paths_expr="/World/envs/*/Franka", name="my_franka_view")
my_world.scene.add(robot_view)
my_world.reset()

# How to access SingleManipulators and KinematicSolvers of all cloned environments ?
1 Like

I think the problem is that my_franka is only taking the prim_path of env_0_path.

Do you know how I could do to create the manipulators using the other paths created after the cloning of the environment?

Hello,

Right now we don’t provide a view/ batched version of the SingleManipulator class as well as a batched version of the ArticulationKinematicsSolver so we recommend using the single classes Articulation and SingleManipulator if you want to create an ik solver for each of the articulations. We might be providing a batched version of these in a future release.

Let us know if you have further questions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.