How badinkajink/modified-code-as-policies works
This repository combines modified Code-as-Policies prompt designs with RobotPy examples and a small Codex web demo. The intended user journey is natural-language instruction to generated robot policy; the demo server visibly submits a prompt template to OpenAI and returns completion text. Robot control, autonomous routines, and simulation form separate implementation branches. Source excerpts establish the Romi and swerve wiring, but do not show a complete generated-policy-to-robot execution path, so that link is omitted.
Main entry points: drivetrain.py Romi drivetrain · robotcontainer.py Command configuration · server.py Generation server · swerve_robot.py Swerve robot
Components 26
Policy prompts
- Tabletop policies
qqa/tabletop_prompt.py - Interactive policies
qqa/full_interactive_tabletop_prompt.py - Unaware policies
qqa/unaware_tabletop_prompt.py - Simulated Romi prompt
codex_robotpy/autonomous/simulated_romi_prompt.py
Web demo
- Demo prompt
codex_robotpy/demo-site/simulated_romi_prompt.py - Generation server
codex_robotpy/demo-site/server.py
Romi robot
- Romi lifecycle
codex_robotpy/romi/robot.py - Command configuration
codex_robotpy/romi/robotcontainer.py - Romi drivetrain
codex_robotpy/romi/subsystems/drivetrain.py - Arcade drive
codex_robotpy/romi/commands/arcadedrive.py - Distance auto
codex_robotpy/romi/commands/autonomous_distance.py - Timed auto
codex_robotpy/romi/commands/autonomous_time.py - Drive distance
codex_robotpy/romi/commands/drivedistance.py - Drive timed
codex_robotpy/romi/commands/drivetime.py - Turn degrees
codex_robotpy/romi/commands/turndegrees.py - Turn timed
codex_robotpy/romi/commands/turntime.py - Romi simulation
codex_robotpy/physics.py
Swerve robot
- Swerve robot
codex_robotpy/swerve_robot.py - Swerve drivetrain
codex_robotpy/components/drivetrain.py - Driver controls
codex_robotpy/components/driverstation.py - Robot sensors
codex_robotpy/components/sensors.py - Swerve autonomous
codex_robotpy/magicbot_autonomous/testAuto.py - Swerve simulation
codex_robotpy/swerve_physics.py
Other components
- Robot user
- OpenAI Codex API
- UR5 in PyBullet
Connections 30
- Robot user → Generation server: submits instruction
codex_robotpy/demo-site/server.py - Generation server → Demo prompt: prefixes prompt
codex_robotpy/demo-site/server.py - Generation server → OpenAI Codex API: requests completion
codex_robotpy/demo-site/server.py - Generation server → Robot user: returns completion
codex_robotpy/demo-site/server.py - Romi lifecycle → Command configuration: creates
codex_robotpy/romi/robot.py - Command configuration → Romi drivetrain: creates
codex_robotpy/romi/robotcontainer.py - Command configuration → Arcade drive: configures default
codex_robotpy/romi/robotcontainer.py - Command configuration → Distance auto: offers routine
codex_robotpy/romi/robotcontainer.py - Command configuration → Timed auto: offers routine
codex_robotpy/romi/robotcontainer.py - Arcade drive → Romi drivetrain: drives
codex_robotpy/romi/robotcontainer.py - Distance auto → Drive distance: sequences
codex_robotpy/romi/commands/autonomous_distance.py - Distance auto → Turn degrees: sequences
codex_robotpy/romi/commands/autonomous_distance.py - Timed auto → Drive timed: sequences
codex_robotpy/romi/commands/autonomous_time.py - Timed auto → Turn timed: sequences
codex_robotpy/romi/commands/autonomous_time.py - Drive distance → Romi drivetrain: uses
codex_robotpy/romi/commands/drivedistance.py - Drive timed → Romi drivetrain: uses
codex_robotpy/romi/commands/drivetime.py - Turn degrees → Romi drivetrain: uses
codex_robotpy/romi/commands/turndegrees.py - Turn timed → Romi drivetrain: uses
codex_robotpy/romi/commands/turntime.py - Swerve robot → Swerve drivetrain: uses
codex_robotpy/swerve_robot.py - Swerve robot → Driver controls: uses
codex_robotpy/swerve_robot.py - Swerve robot → Robot sensors: uses
codex_robotpy/swerve_robot.py - Swerve autonomous → Swerve drivetrain: commands
codex_robotpy/magicbot_autonomous/testAuto.py - Romi simulation → Romi lifecycle: simulates
codex_robotpy/physics.py - Swerve simulation → Swerve robot: simulates
codex_robotpy/swerve_physics.py - Swerve simulation → Swerve drivetrain: uses
codex_robotpy/swerve_physics.py - Robot user → Tabletop policies: instructs
README.md - Robot user → Interactive policies: instructs
README.md - Robot user → Unaware policies: instructs
README.md - Simulated Romi prompt → Romi lifecycle: targets policy runtime
- UR5 in PyBullet → Robot user: receives policies
README.md