Skip to content

BLAST-Robotics/DiagramRenderer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robot Renderer

This is a minimal Java (Maven) project that renders a simple robot diagram to a PNG using parameters.

Build

PowerShell:

mvn -v; mvn -DskipTests package

Run

PowerShell example:

java -jar target\robot-renderer-0.1.0-SNAPSHOT-jar-with-dependencies.jar examples\simple.json output\robot.png

Run tests

mvn test

Notes

  • The App reads a JSON spec (see examples/simple.json) and writes output/robot.png by default.
  • Uses AWT to draw; it works headless on most CI if java.awt.headless=true is set.

Developer guide — make changes, build, and run

  1. Make code changes
  • Open the project in your IDE (IntelliJ IDEA, VS Code with Java extensions, or Eclipse).
  • Edit source files under src/main/java/com/example/robotrenderer/.
  • The main classes:
    • App — CLI entrypoint that reads a JSON spec and writes a PNG.
    • GuiApp — Swing UI for editing specs, preview, and saving PNGs.
    • Renderer — drawing logic; accepts a RobotSpec and returns a BufferedImage.
    • RobotSpec — parameter model (width, length, drivetrain, hasArm, armLength, mechanism, color, bumperWidth).
  1. Build locally (no system Maven required)

We included a lightweight wrapper mvnw.ps1 and mvnw.cmd that downloads Maven into .maven/. Run (PowerShell):

cd 'C:\Users\vivaa\OneDrive\Documents\FRCShenanigans\DiagramRenderer'
powershell -ExecutionPolicy Bypass -File .\mvnw.ps1 -DskipTests package

Or if you have Maven on PATH, just:

mvn -DskipTests package

Run tests (wrapper):

powershell -ExecutionPolicy Bypass -File .\mvnw.ps1 test
  1. Run the CLI app
# after packaging
java -jar target\robot-renderer-0.1.0-SNAPSHOT-jar-with-dependencies.jar examples\simple.json output\robot.png
  1. Launch the Swing GUI (development / desktop)
  • From your IDE: run com.example.robotrenderer.GuiApp main class.
  • Or from the packaged jar (jar-with-dependencies):
java -cp target\robot-renderer-0.1.0-SNAPSHOT-jar-with-dependencies.jar com.example.robotrenderer.GuiApp

GUI quick walkthrough:

  • Edit the Width / Length (in inches), choose drivetrain (tank, mecanum, swerve).
  • Toggle "Has Arm" and set Arm length.
  • Choose mechanism (intake, shooter, none), set Color as hex (e.g. #0077CC), and Bumper width in inches.
  • Click Preview to see an in-window preview.
  • Click Render & Save PNG to write output/gui_render.png.
  • Use Load JSON / Save JSON to persist and load RobotSpec JSON files.
  1. What the application does
  • Given a JSON RobotSpec, the Renderer draws a top-down schematic of a robot: robot base, drivetrain wheels or modules, a simple arm, mechanism indicator (intake/shooter), bumpers, and a label.
  • The GUI lets you interactively edit parameters and produce a PNG render.
  1. Tips for extending the renderer
  • Add more fields to RobotSpec for sensors, battery, or team-specific components.
  • Update Renderer.render() to position additional components using the same inches-to-pixels scaling.
  • Add unit tests under src/test/java that construct RobotSpec instances and assert the renderer returns non-null images or writes expected files.

If you want, I can:

  • Add the official Maven Wrapper files (mvnw, .mvn/wrapper/*) instead of the lightweight downloader.
  • Add an option to the CLI jar to launch the GUI with --gui.
  • Add SVG output or more advanced layout presets.

About

Vibe Fork

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 44.6%
  • Shell 27.3%
  • Batchfile 24.7%
  • PowerShell 3.4%