import isaaclab.sim as sim_utils
from isaaclab.actuators import ImplicitActuatorCfg
from isaaclab.assets import ArticulationCfg, AssetBaseCfg, RigidObjectCfg
from isaaclab.utils.assets import ISAACLAB_NUCLEUS_DIR
from isaaclab.sim.spawners.from_files.from_files_cfg import UsdFileCfg
from isaaclab.sim.schemas.schemas_cfg import (
    RigidBodyPropertiesCfg,
    CollisionPropertiesCfg,
)
from mindbot.utils.assets import MINDBOT_ASSETS_DIR

DRYINGBOX_CFG = ArticulationCfg(
    spawn=sim_utils.UsdFileCfg(
        usd_path=f"{MINDBOT_ASSETS_DIR}/devices/DryingBox/Equipment_BB_13.usd",
        rigid_props=sim_utils.RigidBodyPropertiesCfg(
            disable_gravity=False,
            max_depenetration_velocity=1.0
        ),
        articulation_props=sim_utils.ArticulationRootPropertiesCfg(
            fix_root_link=False,
            enabled_self_collisions=False,
            solver_position_iteration_count=32,
            solver_velocity_iteration_count=16,
            stabilization_threshold=1e-6,
        ),
    ),
    init_state=ArticulationCfg.InitialStateCfg(
        pos=[1.95, -0.45, 0.9], rot=[-0.7071, 0.0, 0.0, 0.7071]
    ),
    # actuators={}
    actuators={
        "passive_damper": ImplicitActuatorCfg(
            # ".*" 表示匹配该USD文件内的所有关节（无论是轮子、屏幕转轴还是其他）
            joint_names_expr=["RevoluteJoint"],
            stiffness=10000.0,
            damping=1000.0,
            effort_limit_sim=10000.0,
            velocity_limit_sim=100.0,
        ),
    },
)
