robosuite icon indicating copy to clipboard operation
robosuite copied to clipboard

Question: Custom Task / Arena Creation with Scenario Randomization

Open sahil-tgs opened this issue 5 months ago • 3 comments

Summary
I’m working on a project using Robosuite and had a question regarding customizing environments.
Specifically, I’d like to know if there’s a way to build custom tasks or arenas where I can control and randomize more components of the environment programmatically.

Details

  • I’m familiar with customizing robots and using existing tasks.
  • My use case involves advanced scenario randomization (e.g., varying number of objects and positions, such as being able to place multiple tables or multiple robots with different objects to interact with all within the same environment).
  • Currently, I’m facing an issue with the table object in the “Lift task” environment—I can’t seem to reposition or place the table at different locations.

Question

  • Is there a recommended way to build or modify environments created using the task abstraction?
  • Can tasks be extended to allow more flexible control over arena elements (e.g., table positioning or customization like changing the height and width of table)?

Any guidance or examples would be greatly appreciated.

sahil-tgs avatar Aug 24 '25 13:08 sahil-tgs

  1. To build your own custom environments, I would recommend taking a look here. I would also suggest looking at provided environments since they cover a decent variety of tasks.
  2. For repositioning the table in the Lift environment, you can change this line here. This the just the (x, y, z) offset of the table. Currently, it is placed such that the table is on top of the floor, but you can change this value. I would recommend cloning the robosuite repo and changing the values from there.

abhihjoshi avatar Aug 24 '25 15:08 abhihjoshi

Image

I'm trying to do a minimal single robot in an empty arena using the Building Your Own Environments with MujocoWorldBase. But robot is not loading up properly. Like how it would in a standard task env. What am I missing here the code that generates that make the simulation in the image.

import mujoco
from robosuite.models import MujocoWorldBase
from robosuite.models.robots import Panda
from robosuite.models.grippers import gripper_factory
from robosuite.models.arenas import EmptyArena

world = MujocoWorldBase()

robot = Panda()
gripper = gripper_factory('PandaGripper')
robot.add_gripper(gripper)

robot.set_base_xpos([0, 0, 0])
world.merge(robot)

arena = EmptyArena()
world.merge(arena)

model = world.get_model(mode="mujoco")

data = mujoco.MjData(model)
print(f"Starting simulation with robot: {robot.name}")

viewer = mujoco.viewer.launch_passive(model, data)

while viewer.is_running() and data.time < 10:
    mujoco.mj_step(model, data)
    viewer.sync()
    
    # Print status every second
    if int(data.time) > int(data.time - model.opt.timestep):
        print(f"Time: {data.time:.1f}s")

viewer.close()
print("Simulation complete!")

sahil-tgs avatar Sep 04 '25 08:09 sahil-tgs

in the viewer, it's also showing the collision geometry (which has the funny colors); you can scroll down on the left and press 'Rendering'. Then, you can toggle the group numbers 0/1/2 to toggle the rendering.

Aside from that tutorial, I'd recommend starting from something like the Lift environment and modifying relevant functions there.

kevin-thankyou-lin avatar Oct 22 '25 05:10 kevin-thankyou-lin