""" Inspect state observations and kinematics for both 6-DoF (so100) and 7-DoF (panda) in ManiSkill 3 """ import gymnasium as gym import numpy as np import mani_skill.envs print("=" * 70) print("INSPECTING ROBOT STATES & KINEMATICS") print("=" * 70) for uid in ["panda", "so100"]: print(f"\n--- Robot: {uid} ---") try: env = gym.make( "PickCube-v1", robot_uids=uid, obs_mode="state", control_mode="pd_joint_pos", sim_backend="cpu", render_backend="cpu", ) obs, _ = env.reset() robot = env.unwrapped.agent.robot qpos = robot.get_qpos() qvel = robot.get_qvel() qlimits = robot.get_qlimits() print(f"[+] Robot {uid} DoF: {robot.dof}") print(f"[+] qpos shape: {qpos.shape}, dtype: {qpos.dtype}") print(f"[+] qvel shape: {qvel.shape}") print(f"[+] qlimits shape: {qlimits.shape}") print(f"[+] qlimits min: {qlimits[0, :, 0] if qlimits.ndim == 3 else qlimits[:, 0]}") print(f"[+] qlimits max: {qlimits[0, :, 1] if qlimits.ndim == 3 else qlimits[:, 1]}") # Test 1 step act = env.action_space.sample() obs, rew, term, trunc, info = env.step(act) print(f"[+] Step successful! Rew: {rew}, Term: {term}, Trunc: {trunc}") env.close() except Exception as e: print(f"[!] Error inspecting {uid}: {e}") import traceback traceback.print_exc()