Skip to content

Adds flip state and rotation for visualization - #168

Open
micahwoodard wants to merge 7 commits into
mainfrom
feat-add-camera-rotation-parameters
Open

Adds flip state and rotation for visualization#168
micahwoodard wants to merge 7 commits into
mainfrom
feat-add-camera-rotation-parameters

Conversation

@micahwoodard

Copy link
Copy Markdown
Collaborator

Adds flip state and rotation for camera preview visualization. Will need to be integrated in #139 to take effect

)


class DynamicForagingSpinnakerCamera(cameras.SpinnakerCamera):

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.

Lets put this in a seperate model and use composition over inheritance. I

DynamicForagingSpinnakerCamera(BaseModel):
   camera: SpinnakerCamera
   visualizer_settings: AnotherBaseModel

If we keep the inheritance, we will have to deal with up/down casting types and this keeps it a bit cleaner in Bonsai. You may need to change some stuff in the mapper.

class DynamicForagingSpinnakerCamera(cameras.SpinnakerCamera):
"""A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers."""

flip_state: float = Field(default=2, gt=0, le=2, description="Camera flip state", validate_default=True)

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.

flip_state: None | Literal["horizontal", "vertical", "both"] = Field(default=None)

@micahwoodard micahwoodard mentioned this pull request Sep 4, 2026

@bruno-f-cruz bruno-f-cruz 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.

One small change and otherwise gtg

class VisualizerSettings(BaseModel):
"""Visualizer settings for the dynamic foraging rig's camera. This includes camera image rotation and flip state for visualizers."""

flip_state: None | Literal["horizontal", "vertical", "both"] = Field(

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.

One of those cases where I think it is probably easier to add "None" as a string to the literal and make it default so you dont have to deal with the type conversion.

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.

Easier to handle on bonsai too since you already need a mapper from string-> whatever the operator will receive

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