Skip to content

Conversation

gioelemo
Copy link
Collaborator

This PR includes the following:

  • Use custom starting position and starting angle for the Agent
  • Slightly adapted visualization script to include more than one Agent (passed as additional information).
  • Minor changes for LLM version (see PR in terra-baselines)

The executables

DATASET_PATH=/path/to/dataset DATASET_SIZE=<num_maps_per_type> python -m terra.viz.main_manual

and

DATASET_PATH=/path/to/dataset DATASET_SIZE=<num_maps_per_type> python -m terra.viz.play

should work as before

@gioelemo gioelemo requested review from Idate96 and Copilot July 29, 2025 15:26
Copilot

This comment was marked as outdated.

gioelemo and others added 5 commits July 29, 2025 17:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gioelemo gioelemo requested a review from Copilot August 19, 2025 14:07
Copilot

This comment was marked as outdated.

@gioelemo gioelemo requested a review from Copilot August 20, 2025 09:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for custom agent positioning and angle initialization, along with enhanced visualization capabilities for multiple agents. The changes enable users to specify custom starting positions and angles for agents instead of relying solely on random or default positioning.

  • Custom agent positioning and angle support through new optional parameters
  • Enhanced visualization to handle multiple agents with partition visualization
  • Configuration updates to simplify curriculum levels for LLM integration

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
terra/viz/main_manual.py Adds custom position and angle parameters to environment reset
terra/viz/game/game.py Implements multi-agent visualization with partition support and agent configuration handling
terra/state.py Adds custom position and angle parameters to State creation methods
terra/env.py Updates environment reset to support custom positioning parameters
terra/config.py Simplifies curriculum configuration to focus on foundations maps
terra/agent.py Implements comprehensive custom positioning logic with validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

def use_custom_position(k):
# Create position based on custom args or defaults
temp_pos = IntMap(jnp.array(custom_pos)) if custom_pos is not None else IntMap(jnp.array([-1, -1]))
temp_angle = jnp.full((1,), custom_angle, dtype=IntMap) if custom_angle is not None else jnp.full((1,), -1, dtype=IntMap)
Copy link
Preview

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

The sentinel value -1 for unset angle should be defined as a constant to improve code clarity.

Suggested change
temp_angle = jnp.full((1,), custom_angle, dtype=IntMap) if custom_angle is not None else jnp.full((1,), -1, dtype=IntMap)
temp_angle = jnp.full((1,), custom_angle, dtype=IntMap) if custom_angle is not None else jnp.full((1,), UNSET_ANGLE, dtype=IntMap)

Copilot uses AI. Check for mistakes.

@@ -82,6 +143,58 @@ def new(
return Agent(agent_state=agent_state, width=width, height=height, moving_dumped_dirt=moving_dumped_dirt), key


def _validate_agent_position(
Copy link
Preview

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

The function docstring should document the expected types and ranges for the parameters, particularly the Array types and what constitutes valid position/angle values.

Copilot uses AI. Check for mistakes.

@leggedrobotics leggedrobotics deleted a comment from Copilot AI Aug 20, 2025
@leggedrobotics leggedrobotics deleted a comment from Copilot AI Aug 20, 2025
@leggedrobotics leggedrobotics deleted a comment from Copilot AI Aug 20, 2025
@leggedrobotics leggedrobotics deleted a comment from Copilot AI Aug 20, 2025
@leggedrobotics leggedrobotics deleted a comment from Copilot AI Aug 20, 2025
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.

1 participant