Adding Objects to Your Simulation
This tutorial walks you through adding both primitive shapes and URDF-based objects into your simulation environment using Ark.
✅ Prerequisites
Before proceeding, ensure:
- You have access and permission to modify your project’s configuration files.
sim_node
is correctly set up and running.
📁 Project Structure Overview
Make sure your folder structure resembles this:
text
CopyEdit
project_root/
├── config/
│ ├── global_config.yaml # Main simulation config
│ ├── objects/ # Object definitions live here
│ │ └── ball.yaml # Your new object file
│ └── ...
└── sim_node.py
🧩 Step 1: Link Object in Global Config
Edit global_config.yaml
to include your object:
simulator:
# ... your existing sim config
objects:
- "objects/ball.yaml"
🌍 Step 2: Enable Ground Truth Publishing
To have Ark automatically publish an object’s true position and orientation, add:
publish_ground_truth: Tru
This works for both primitive and URDF-based objects.
⚙️ Adding a Primitive Object
Ark supports two basic primitives:
GEOM_BOX
GEOM_SPHERE
🏀 Example: Ball (Sphere)
File: config/objects/ball.yaml
name: "ball"
config:
source: "primitive"
publish_ground_truth: True
visual:
shape_type: "GEOM_SPHERE"
visual_shape:
radius: 0.05
rgbaColor: [0.0, 1.0, 0.0, 1.0] # Green
collision:
shape_type: "GEOM_SPHERE"
collision_shape:
radius: 0.05
multi_body:
baseMass: 0.1 # Dynamic object
base_position: [-0.5, 0.0, 0.5]
base_orientation: [0.0, 0.0, 0.0, 1.0]
💡 Explanation
Field | Description |
source | Use "primitive" for built-in shapes |
shape_type | Sphere geometry (GEOM_SPHERE ) |
radius | 5 cm |
rgbaColor | Green with full opacity |
baseMass | 0.1 kg; object can move and be affected by physics |
base_position | x = -0.5, y = 0.0, z = 0.5 |
base_orientation | Quaternion for no rotation |
Note: If baseMass = 0, the object becomes static (immovable).
🧱 Example: Floor (Box)
File: config/objects/floor.yaml
yaml
CopyEdit
name: "floor"
config:
source: "primitive"
publish_ground_truth: False
visual:
shape_type: "GEOM_BOX"
visual_shape:
halfExtents: [1, 1, 0.1]
rgbaColor: [1.0, 0.0, 0.5, 1.0] # Pink
collision:
shape_type: "GEOM_BOX"
collision_shape:
halfExtents: [1, 1, 0.1]
multi_body:
baseMass: 0 # Static object
base_position: [0.0, 0.0, 0.0]
base_orientation: [0.0, 0.0, 0.0, 1.0]
🦾 Adding a URDF Object
You can also load more complex objects from a URDF file.
Example: Power Drill
name: "power_drill"
config:
source: "urdf"
urdf_path: "config/objects/power_drill/model.urdf"
publish_ground_truth: False
base_position: [-0.5, 0.5, 0.3]
base_orientation: [0.0, 0.0, 0.0, 1.0]
global_scaling: 1.5
Key Parameters:
source: "urdf"
: Load from a URDF file
urdf_path
: Relative path to the model file
global_scaling
: Optional scaling factor
base_position
/base_orientation
: Sets object’s spawn pose
🚀 Running the Simulation
After adding objects to your config, run the simulation. You should see the ball, floor, and any URDF models appear in your simulated world.
✅ If everything is set up correctly, it should look like this:

Code can be found:
Next Steps