-
Notifications
You must be signed in to change notification settings - Fork 12
Creating A Toast Module Start to Finish
This tutorial covers the starting phases of how to build a module, deploy Toast to your RoboRIO and how to deploy your module. This tutorial covers Java modules.
Step 1: Download Hotplate. To download HotPlate, follow these instructions:
- Windows
- Install Ruby using the Ruby Installer. (Make sure to check the box that says "Add Ruby executables to your PATH")
- Mac
- While mac comes with a Ruby version preinstalled, you may reinstall using the rbenv package from Homebrew
- Linux
- It is recommended to use RVM to install ruby, however you can also run
sudo apt-get install ruby
.
Running gem install hotplate
in a command line terminal will install the HotPlate utility to your system.
Step 1: Open a Command Prompt (cmd on windows, terminal on mac/linux) and run the cd
command to change directory to your projects folder. This is where you Toast module will live. In this case, we are changing into the directory Documents/MyToastProjects
.
Step 2: Run toast init
and choose the appropriate data for you module. Keep in mind that your Module Name should be in lowercase.
This will create a new folder with the name of your module. cd
into this directory and you are ready to continue.
Once you are inside of your module directory, connect your RoboRIO through the USB Tether Cable or over the network. Next, you can run the gradlew toastDeploy
command to send the latest Toast binary to your RoboRIO, ready to be used. Your Robot is now Toast-Ready!
Now that your RoboRIO is setup, we can start working on your Module. Inside of your module directory, run the gradlew eclipse
command to setup your Eclipse development environment.
NOTE: You can also use intelliJ by running gradlew idea
NOTE: If you are using intelliJ, you can ignore the eclipse section and instead open the project in IntelliJ like any other project
Fire up eclipse and point your workspace to the default directory (or wherever you want it). Once eclipse is open, right click in the Project / Package Explorer and select "Import"
Select "General -> Existing Projects into Workspace"
Select "Browse" and point it to where your module is stored. You should see your module project automatically be picked up by the "Projects" view.
Hit "Finish". Your module is now imported into eclipse and you can open your RobotModule.java
file and start editing away. This is where you write your module and make it do its thing, just like with regular code.
You are now free to develop your module.
To test your code in Toast's simulator, go to the 'run' button dropdown and select "Run Configurations...".
Select the configuration named "YourModule-Sim" under Java Application and hit Run. This will launch the Toast simulator and your code.
Welcome to Toast!
To build your module, simply open a command prompt in your Module directory and run gradlew build
. This will build your Module .jar file and will store it under build/libs
. This is the file that you can distribute to other teams for them to use and load into their Robots.
To Deploy your module directly to your RoboRIO, run gradlew deploy
instead. This will send the code to your RoboRIO and will restart the Robot's code.
If you're keeping your module on Github, or releasing the source in anyway, please take some time to read this entry, which explains how people can build your module from source (Ruby and Hotplate are only required for building a module from scratch).