Please provide all relevant details below before submitting your post. This will help the community provide more accurate and timely assistance. After submitting, you can check the appropriate boxes. Remember, you can always edit your post later to include additional information if needed.
Isaac Sim Version
4.2.0
4.1.0
4.0.0
[v] 2023.1.1
2023.1.0-hotfix.1
Other (please specify):
Isaac Lab Version (if applicable)
1.2
1.1
1.0
Other (please specify):
Operating System
Ubuntu 22.04
Ubuntu 20.04
[v] Windows 11
Windows 10
Other (please specify):
GPU Information
- Model: NVIDIA RTX A6000
- Driver Version:
Topic Description
I Want to move a Chair Tilt Using Franka Robot.
Detailed Description
I Want to move a Chair Tilt Using Franka Robot.
But, When I’m trying to grab the Chair tilt, it Slips.
So, I put a Cube on the Chair Tilt. (Mother : Tilt, Child : Cube)
But, I Can’t Use Get Object () Function. (Error)
How Can I move Chiar Tilt using VS Code?
The Code is Like This.
from omni.isaac.examples.base_sample import BaseSample
from omni.isaac.franka import Franka
from omni.isaac.kuka import kuka
from omni.isaac.core.objects import DynamicCuboid
from omni.isaac.franka.controllers import PickPlaceController
from omni.isaac.core.utils.types import ArticulationAction
import numpy as np
from pxr import Usd, UsdGeom, Gf, Sdf
import omni.kit.app
import omni.kit.undo
import omni.kit.commands
from omni.isaac.core.articulations import Articulation
from omni.isaac.core.prims import XFormPrim, RigidPrim
class HelloWorld(BaseSample):
def init(self) → None:
super().init()
self._return_to_initial_position = False
self._initial_joint_positions = None
return
def setup_scene(self):
world = self.get_world()
world.scene.add_default_ground_plane()
franka = world.scene.add(Franka(prim_path="/World/Fancy_Franka", name="fancy_franka"))
world.scene.add(
DynamicCuboid(
prim_path="/World/random_cube",
name="fancy_cube",
position=np.array([0.3, 0.3, 0.3]),
scale=np.array([0.0515, 0.0515, 0.0515]),
color=np.array([0, 0, 1.0]),
)
)
usd_path =“D:/Omniverse/Test/Tilt_Cube.usd”
add_reference_to_stage(usd_path=usd_path, prim_path=“/World”)
prim = RigidPrim(prim_path=“/World/Cooper”, name= “Fancy_Tilt”,scale = np.array([0.01,0.01,0.01]), position = np.array([0.5,0.5,0.0]), orientation = np.array([1.0,0.0,0.0,0.0]))
world.scene.add(prim)
omni.kit.commands.execute(“SetStaticCollider”, path = Sdf.Path(“/World/Cooper”), approximationShape = “none”)
return
async def setup_post_load(self):
self._world = self.get_world()
self._franka = self._world.scene.get_object("fancy_franka")
self._fancy_cube = self._world.scene.get_object("fancy_cube")
self.cooper_object = self._world.scene.get_object("Fancy_Tilt")
self.cooper_box = self._world.scene.get_object("Fancy_Box")
# Cooper = tilt_prim
# Initialize a pick and place controller
self._controller = PickPlaceController(
name="pick_place_controller",
gripper=self._franka.gripper,
robot_articulation=self._franka,
)
self._world.add_physics_callback("sim_step", callback_fn=self.physics_step)
# World has pause, stop, play..etc
# Note: if async version exists, use it in any async function is this workflow
self._franka.gripper.set_joint_positions(self._franka.gripper.joint_opened_positions)
self._initial_joint_positions = self._franka.get_joint_positions()
await self._world.play_async()
return
# This function is called after Reset button is pressed
# Resetting anything in the world should happen here
async def setup_post_reset(self):
self._controller.reset()
self._franka.gripper.set_joint_positions(self._franka.gripper.joint_opened_positions)
self._initial_joint_positions = self._franka.get_joint_positions()
await self._world.play_async()
return
def physics_step(self, step_size):
if not self._return_to_initial_position:
cube_position, _ = self._fancy_cube.get_world_pose()
cooper_position, _ = self.cooper_object.get_world_pose()
# cooper_position1,_ = self.cooper_object.GetChildren()
start_postion = np.array([0.3, 0.3, 0.3])
goal_position = np.array([-0.3, -0.3, 0.0515 / 2.0])
current_joint_positions = self._franka.get_joint_positions()
actions = self._controller.forward(
picking_position=cooper_position,
placing_position=goal_position,
current_joint_positions=current_joint_positions,
)
self._franka.apply_action(actions)
# Only for the pick and place controller, indicating if the state
# machine reached the final state.
if self._controller.is_done():
self._return_to_initial_position = True
self._controller.reset()
else:
# 로봇을 원래 위치로 되돌리기
cube_position1, _ = self._fancy_cube.get_world_pose()
goal_position1 = np.array([0.3, 0.3, 0.0515 / 2.0])
current_joint_positions1 = self._franka.get_joint_positions()
# actions = self._controller.forward(
# # picking_position=goal_position1,
# placing_position=goal_position1,
# current_joint_positions=current_joint_positions1,
# )
interpolation_factor = 0.05 # 이동 속도를 조절하는 인자 (0과 1 사이의 값)
new_joint_positions = current_joint_positions1 + interpolation_factor * (self._initial_joint_positions - current_joint_positions1)
actions = ArticulationAction(joint_positions=new_joint_positions, joint_indices=np.arange(len(self._initial_joint_positions)))
self._franka.apply_action(actions)
# if np.allclose(self._franka.get_joint_positions(), self._initial_joint_positions, atol=1e-2):
# self._world.pause()
return
The Hierarchy of Chair is like this.
- World (PhysicsScene)
- Cooper (xform)
- Cooper (xform)
- Cube(Mesh)
- Cooper (xform)
Screenshots or Videos
(If applicable, add screenshots or links to videos that demonstrate the issue)
Additional Information
What I’ve Tried
(Describe any troubleshooting steps you’ve already taken)
Related Issues
(If you’re aware of any related issues or forum posts, please link them here)
Additional Context
(Add any other context about the problem here)