When I add a robot from .usd file to the world scene, the initial pose of the robot is not correct (a bit 90 y-axis rotated and a bit 15 x-axis rotated). But if I use world.stop and world.play, the robot pose becomes correct. I’m not sure if using world.stop is the correct way to reset the pose, but anybody knows what is the correct way to load the robot with the correct pose? I will do RL for my later implementation, using world.stop will stop the simulation completely, which is not good for the RL training.
I attached my code to below.
import os
curr_path = os.path.abspath(os.path.dirname(__file__))
asset_path = curr_path + "asset/WheeledTennisRobot/tennis_robot.usd"
from omni.isaac.kit import SimulationApp
simulation_app = SimulationApp({"headless": False})
from omni.isaac.core import World
from omni.isaac.core.robots import Robot
from omni.isaac.core.utils.stage import add_reference_to_stage, get_stage_units
from omni.isaac.core.utils.types import ArticulationAction
from omni.isaac.core import SimulationContext
import numpy as np
import argparse
import sys
my_world = World(stage_units_in_meters=1.0)
my_world.scene.add_default_ground_plane()
add_reference_to_stage(usd_path=asset_path, prim_path="/World/Robot")
tennis_robot = my_world.scene.add(Robot(prim_path="/World/Robot/tennis_robot", name="robot1"))
tennis_robot.set_world_pose(position=np.array([0.0, 0.0, 1.0]) / get_stage_units())
my_world.initialize_physics()
my_world.reset()
# ********************************using stop and play, the pose becomes correct
my_world.stop()
my_world.play()
# *****************************************************
while simulation_app.is_running():
my_world.step(render=True)
my_world.stop()
simulation_app.close()