Skip to content

feat: Populate scene using batch spawning#41

Open
knicked wants to merge 9 commits into
developmentfrom
kd/batch_spawning
Open

feat: Populate scene using batch spawning#41
knicked wants to merge 9 commits into
developmentfrom
kd/batch_spawning

Conversation

@knicked

@knicked knicked commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

New simulation interfaces supports batch spawning, we can use it to populate the scene in a single frame.

A custom service handler for SpawnEntities is provided in the project gem for registering gripping points, in the same way as in #25 .

You can test using

pixi run build-sim
pixi run sim
pixi run uv run scripts/populate_scene.py

@knicked knicked force-pushed the kd/batch_spawning branch from f99172c to 51eda9e Compare July 8, 2026 10:30
@knicked knicked marked this pull request as ready for review July 8, 2026 10:36
@knicked knicked force-pushed the kd/batch_spawning branch from c665064 to 688d9e3 Compare July 8, 2026 14:55
knicked added 4 commits July 10, 2026 13:36
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
@knicked knicked force-pushed the kd/batch_spawning branch from 688d9e3 to 743de23 Compare July 10, 2026 11:43

@zakmat zakmat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and I really like such optimizations!

Can you ensure the units test are working? I have put some statically noticed things as comments - havent run the build myself

offset_yaw = 0.0

simulation_name = self.spawn_on_spot(
req = self.make_spawn_entity_msg_for_spot(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we update the tests?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the old spawning function for spawning single objects, so the tests don't need updating - tests only spawned a small amount of objects for testing specific features, so they don't need it.

Comment thread rai_app/environment/scene_manager.py Outdated
Comment thread rai_app/environment/scene_manager.py Outdated
for res in result.results:
if res.result.result != 1:
print(f"ERROR: {res.result.error_message}")
return [res.entity_name for res in result.results]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is res.entity_name in case of failed spawn?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't expect this function to fail, so correct error handling was not implemented here - I just modified the implementation so that it's compatible with the previous version in the codebase. That print was only for debugging.

If we wanted to handle those errors, we would have to refactor the code further and that should be in a seperate PR IMO.

Comment thread rai_app/environment/scene_manager.py Outdated
Comment thread pixi.toml
# No cwd override: the script path is project-root-relative and the script cd's
# into $DEMO_ROOT/sim itself.
cmd = "bash scripts/build_sim.sh"
inputs = ["scripts/build_sim.sh", "sim/Gem/Source/*", "sim/Gem/Include/*", "sim/Gem/CMakeLists.txt", "sim/Gem/gem.json", "sim/Gem/*.cmake"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was the blanket solution necessary?

We could leave with that although its bit sad.

Notice sim/Gem/Source/* - this is fine for a single layer and will not recurse, right?

knicked added 5 commits July 10, 2026 16:20
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Signed-off-by: Kacper Dąbrowski <kacper.dabrowski@robotec.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants