Skip to content

Conversation

@BarceloChristian
Copy link
Collaborator

Pull Request

📝 Description

Randomizers no longer randomize on each frame is Cosmos is enabled.
Robot animation moves frame by frame.

🎯 Type of Change

Please delete options that are not relevant.

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/refactoring (no functional changes)
  • ⚡ Performance improvement
  • ✅ Test addition/update
  • 🔧 Configuration change

📋 Checklist

Please check all applicable items:

Code Quality

  • My code follows the style guidelines of this project
  • I have run pre-commit run --all-files and all checks pass
  • I have performed a self-review of my own code
  • My code is properly typed (mypy passes)
  • My code is properly formatted (ruff passes)

Documentation

  • I have commented my code, particularly in hard-to-understand areas
  • I have added docstrings to all new functions/classes/methods
  • I have made corresponding changes to the documentation
  • I have updated the README if needed

Signed-off-by: Christian Barcelo <christian.barcelo@ekumenlabs.com>
Copy link
Contributor

@IDavGal IDavGal left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise looks good. Love the template too

Comment on lines +68 to +75
def randomize_lights() -> None:
"""Randomize lights attributes."""
with self.lights:
rep.modify.attribute("inputs:color", rep.distribution.uniform(self.min_color, self.max_color))
rep.modify.attribute("inputs:enableColorTemperature", self.enable_color_temperature)
rep.modify.attribute(
"inputs:exposure", rep.distribution.uniform(self.min_exposure, self.max_exposure)
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a necessity that the registered functions need to receive no params? Otherwise, for consistency and to reduce nesting, I'd suggest define the randomization method we're registering as a class method and just register it when randomize_all_frames is set for all randomizers that use replication.

if randomize_all_frames:
    rep.register(self.randomize_this)
    with rep.trigger.on_frame():
        randomize_this()
else:
    # Single time randomization logic

Comment on lines +82 to +90
def randomize(self) -> None:
"""Apply randomization to the robot."""
if self.randomize_all_frames:
return
fps = float(self.timeline_iface.get_time_codes_per_seconds())
self.timeline_iface.set_current_time(self.current_frame / fps)
self.current_frame += 1
if self.current_frame >= NUM_FRAMES:
self.current_frame = FIRST_MOVING_FRAME
Copy link
Contributor

Choose a reason for hiding this comment

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

This method loops over the animation sequentially?

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.

3 participants