Export the position of a cylinder as a python variable

Hi! I am working on building a robot with the fluid emitter at the end-effector. I am using a separate fluid engine called SPlisHSPlasH to generate fluid particles. Here’s the general explanation of my idea.

  1. get the end-effector pose from Isaac Sim
  2. import the pose into SPlisHSPlasH as a python file
  3. generate fluid particles as .vtk
  4. render it with Paraview and import it back to Isaac Sim

First of all, I would like to know how I can export the end-effector position as a python file.

Thanks in advance!

Hi @sy2154 - To export the end-effector position from Isaac Sim, you can use the Python API provided by Isaac Sim. Here’s a simple example of how you can get the end-effector pose of a robot:

from omni.isaac.dynamic_control import _dynamic_control
dc = _dynamic_control.acquire_dynamic_control_interface()

# Assuming the robot is an Articulation
robot_path = "/path/to/your/robot"
robot = dc.get_articulation(robot_path)

# Assuming the end-effector is a link in the Articulation
end_effector_path = "/path/to/your/end_effector"
end_effector = dc.get_articulation_link(robot, end_effector_path)

# Get the pose of the end-effector
pose = dc.get_rigid_body_pose(end_effector)

The pose variable now contains the pose of the end-effector. This pose is a GfMatrix4d object, which contains the position and orientation of the end-effector in the world frame.

To export this pose to a Python file, you can simply write it to a file:

with open('end_effector_pose.py', 'w') as f:
    f.write(f'pose = {pose}')

This will create a Python file named end_effector_pose.py with a variable pose that contains the pose of the end-effector. You can then import this file in your SPlisHSPlasH script:

from end_effector_pose import pose

Please note that you need to replace “/path/to/your/robot” and “/path/to/your/end_effector” with the actual paths to your robot and end-effector in the USD stage.