IsaacLab icon indicating copy to clipboard operation
IsaacLab copied to clipboard

ridgeback_franka move problem

Open FanZhang91 opened this issue 9 months ago • 2 comments

run the 'check_ridgeback_franka.py' scripts。The action information related to mobile base is not all-zero, but the mobile base does not move. How to fix this issue?

https://github.com/user-attachments/assets/b655a71d-846f-4444-9649-60611c4aa2d2

FanZhang91 avatar Apr 11 '25 09:04 FanZhang91

Thanks for posting this. You'll have to elaborate on what exactly you are seeing and how you are running this. Which is the action information you are referring to? Is this from the GUI? Also, please let us know which version of Isaac Lab and Isaac Sim you are using. Thanks.

RandomOakForest avatar Apr 11 '25 10:04 RandomOakForest

Thanks for posting this. You'll have to elaborate on what exactly you are seeing and how you are running this. Which is the action information you are referring to? Is this from the GUI? Also, please let us know which version of Isaac Lab and Isaac Sim you are using. Thanks.

@RandomOakForest Here is the information. Isaac Lab == 2.0.2 Isaac Sim == 4.5.0-rc.36+release.19112.f59b3005.gl run the script in IsaacLab: python source/isaaclab/test/assets/check_ridgeback_franka.py

##################################The following this the code######################################

import argparse

from isaaclab.app import AppLauncher

parser = argparse.ArgumentParser(
    description="This script demonstrates how to simulate a mobile manipulator with dummy joints."
)

AppLauncher.add_app_launcher_args(parser)
args_cli = parser.parse_args()

app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app


import torch

import isaaclab.sim as sim_utils
from isaaclab.assets import Articulation


from isaaclab_assets.robots.ridgeback_franka import RIDGEBACK_FRANKA_PANDA_CFG  # isort:skip


def design_scene():
    cfg = sim_utils.GroundPlaneCfg()
    cfg.func("/World/defaultGroundPlane", cfg)
    cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
    cfg.func("/World/Light", cfg)
    # add robots and return them
    return add_robots()


def add_robots() -> Articulation:
    robot_cfg = RIDGEBACK_FRANKA_PANDA_CFG
    robot_cfg.spawn.func("/World/Robot_1", robot_cfg.spawn, translation=(0.0, -1.0, 0.0))
    robot_cfg.spawn.func("/World/Robot_2", robot_cfg.spawn, translation=(0.0, 1.0, 0.0))
    robot = Articulation(cfg=robot_cfg.replace(prim_path="/World/Robot.*"))

    return robot


def run_simulator(sim: sim_utils.SimulationContext, robot: Articulation):
    actions = robot.data.default_joint_pos.clone()

    sim_dt = sim.get_physics_dt()
    sim_time = 0.0
    ep_step_count = 0
    while simulation_app.is_running():
        if ep_step_count % 1000 == 0:
            sim_time = 0.0
            ep_step_count = 0
            joint_pos, joint_vel = robot.data.default_joint_pos.clone(), robot.data.default_joint_vel.clone()
            robot.write_joint_state_to_sim(joint_pos, joint_vel)
            robot.reset()
            actions = torch.rand_like(robot.data.default_joint_pos) + robot.data.default_joint_pos
            # -- base
            actions[:, 0:3] = 0.0
            # -- gripper
            actions[:, -2:] = 0.04
            print("[INFO]: Resetting robots state...")
        # change the gripper action
        if ep_step_count % 200 == 0:
            # flip command for the gripper
            actions[:, -2:] = 0.0 if actions[0, -2] > 0.0 else 0.04
        # change the base action
        # -- forward and backward (x-axis)
        if ep_step_count == 200:
            actions[:, :3] = 0.0
            actions[:, 0] = 1.0
        if ep_step_count == 300:
            actions[:, :3] = 0.0
            actions[:, 0] = -1.0
        # -- right and left (y-axis)
        if ep_step_count == 400:
            actions[:, :3] = 0.0
            actions[:, 1] = 1.0
        if ep_step_count == 500:
            actions[:, :3] = 0.0
            actions[:, 1] = -1.0
        # -- turn right and left (z-axis)
        if ep_step_count == 600:
            actions[:, :3] = 0.0
            actions[:, 2] = 1.0
        if ep_step_count == 700:
            actions[:, :3] = 0.0
            actions[:, 2] = -1.0
        if ep_step_count == 900:
            actions[:, :3] = 0.0
            actions[:, 2] = 1.0
        # change the arm action
        if ep_step_count % 100:
            actions[:, 3:10] = torch.rand(robot.num_instances, 7, device=robot.device)
            actions[:, 3:10] += robot.data.default_joint_pos[:, 3:10]
        # apply action
        robot.set_joint_velocity_target(actions[:, :3], joint_ids=[0, 1, 2])
        robot.set_joint_position_target(actions[:, 3:], joint_ids=[3, 4, 5, 6, 7, 8, 9, 10, 11])
        robot.write_data_to_sim()
        # perform step
        sim.step()
        # update sim-time
        sim_time += sim_dt
        ep_step_count += 1
        # update buffers
        robot.update(sim_dt)


def main():
    """Main function."""
    # Initialize the simulation context
    sim = sim_utils.SimulationContext(sim_utils.SimulationCfg())
    # Set main camera
    sim.set_camera_view([1.5, 1.5, 1.5], [0.0, 0.0, 0.0])
    # design scene
    robot = design_scene()
    # Play the simulator
    sim.reset()
    # Now we are ready!
    print("[INFO]: Setup complete...")
    # Run the simulator
    run_simulator(sim, robot)


if __name__ == "__main__":
    # run the main function
    main()
    # close sim app
    simulation_app.close()

FanZhang91 avatar Apr 11 '25 11:04 FanZhang91

https://github.com/isaac-sim/IsaacLab/issues/2254 Hope this helps!

exaFLOPs26 avatar May 10 '25 23:05 exaFLOPs26

Following up on this, let us know if you still need further help. I'll move this issue to our Discussions.

RandomOakForest avatar Jun 02 '25 20:06 RandomOakForest