{"id":16032146,"url":"https://github.com/virtuald/magicbot-java","last_synced_at":"2026-04-28T11:04:59.951Z","repository":{"id":68764541,"uuid":"85530004","full_name":"virtuald/magicbot-java","owner":"virtuald","description":"RobotPy's magicbot framework implemented in Java","archived":false,"fork":false,"pushed_at":"2018-02-22T21:27:13.000Z","size":355,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T04:43:47.753Z","etag":null,"topics":["first-robotics-competition","frc","java","magicbot-framework","state-machine"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/virtuald.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-20T03:06:45.000Z","updated_at":"2023-07-24T19:47:39.000Z","dependencies_parsed_at":"2023-05-22T00:45:17.100Z","dependency_job_id":null,"html_url":"https://github.com/virtuald/magicbot-java","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/virtuald/magicbot-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fmagicbot-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fmagicbot-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fmagicbot-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fmagicbot-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/virtuald","download_url":"https://codeload.github.com/virtuald/magicbot-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fmagicbot-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32377599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T09:24:15.638Z","status":"ssl_error","status_checked_at":"2026-04-28T09:24:15.071Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["first-robotics-competition","frc","java","magicbot-framework","state-machine"],"created_at":"2024-10-08T21:20:44.679Z","updated_at":"2026-04-28T11:04:59.906Z","avatar_url":"https://github.com/virtuald.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Magicbot framework (Java)\n=========================\n\n[![Build Status](https://travis-ci.org/virtuald/magicbot-java.svg?branch=master)](https://travis-ci.org/virtuald/magicbot-java)\n\nThis is an implementation of the [RobotPy MagicBot framework](http://robotpy.readthedocs.io/en/stable/frameworks/magicbot.html)\nfor Java. MagicBot is an opinionated framework for creating Python robot\nprograms for the FIRST Robotics Competition. It is envisioned to be an easier\nto use and less verbose alternative to the WPILib Command framework.\n\nThe code in this repository was used in the 2017/2018 season on an FRC robot.\nWhile the code is not as extensively tested as the python framework, the unit\ntests from python for the state machine functionality have been ported\nto JUnit and are tested on travis-ci.\n\n\nDifferences between the Java and Python implementations\n-------------------------------------------------------\n\n* Components must implement the `MagicComponent` interface\n* Autonomous modes must implement the `MagicAutonomous` interface (though, you really\n  should be inheriting from AutonomousStateMachine)\n* Need to call `addAutonomous` and `addComponent` in Robot.java\n* The `tunable` functionality is not implemented\n* State machines are not tunable via NetworkTables\n* No per-component logger objects\n\nInstallation\n------------\n\nDownload the latest Magicbot.jar from https://github.com/virtuald/magicbot-java/releases\nand put it in `~/wpilib/user/java/lib`. Magicbot will be available the next time\nthat you restart eclipse.\n\nDocumentation\n-------------\n\nRefer to the [MagicBot python documentation](http://robotpy.readthedocs.io/en/stable/frameworks/magicbot.html),\nthe philosophy is the same and the implementations are very similar.\n\n### Autonomous Mode State Machines\n\nHere's an example of an autonomous state machine that moves a robot forward for\n2.5 seconds, rotates for 1 second, then moves forward for another second. We\nassume there's a variable in the main robot class of type `DriveTrain` that is\ncalled `driveTrain`, which is copied to this class when the robot is initializing.\n\n``` java\npublic class MyAutonomous extends AutonomousStateMachine {\n\n  @MagicInject\n  DriveTrain driveTrain;\n\n  @TimedState(first=true, duration=2.5, nextState=\"rotate\")\n  public void driveForward(){\n    driveTrain.move(-0.8, 0);\n  }\n  \n  @TimedState(duration=1.0, nextState=\"driveForwardAgain\")\n  public void rotate() {\n    driveTrain.move(0, 0.5);\n  }\n  \n  @TimedState(duration=1)\n  public void driveForwardAgain() {\n    driveTrain.move(-0.8, 0);\n  }\n}\n```\n\nObviously, this is a trivial example, but hopefully it shows the potential of\nthe approach! Teams I've worked with have used the python implementation of this\nvery successfully, and it makes writing complex sequences of steps very easy to\ndo.\n\n### Magic Injection\n\nMagic injection is cool! Say you have your robot class, and two other objects.\n\n```java\npublic class Robot extends MagicRobot {\n    Component1 component1;\n    Component2 component2;\n    \n    @Override\n    public void createObjects() {\n        component1 = new Component1();\n        component2 = new Component2();\n    }\n}\n```\n\n```java\npublic class Component1 {\n    @MagicInject\n    Component2 component2;\n}\n```\n\nOnce the robot has initialized and `createObjects` has exited, then the\n`component2` variable in the `Component1` class will be set to the instance\nof `component2` that was present in the original Robot class.\n\nThis is really useful because you don't have to pass variables around everywhere,\nyou can just use injection and they'll be injected automatically for you.\n\n### Other stuff\n\nFeel free to edit this README and add better docs!!\n\nContributing\n============\n\nI'm not planning on doing anything except bugfixes for this code, but will\nhappiliy accept pull requests with new features if they conform to the spirit of\nMagicBot.\n\nLicense\n=======\n\nApache 2.0\n\nAuthor\n======\n\nDustin Spicuzza (dustin@virtualroadside.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtuald%2Fmagicbot-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirtuald%2Fmagicbot-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtuald%2Fmagicbot-java/lists"}