![]() |
Reducing code build time
Often our team makes small changes to code (e.g. adding a command to an autonomous sequence) that aren't otherwise adjustable via RobotPreferences/NetworkTables/SmartDashboard (as far as I know...)
What can we do to reduce the ~2 minutes it takes to recompile our code each time? Is RobotPy (being interpreted) a faster alternative? |
Re: Reducing code build time
We've made a concerted effort over the past three years to create code that doesn't need to be recompiled.
For instance, any constant (numeric) value that we use on the robot is actually stored in a text file and loaded at code startup. Likewise, we use a scripting system that reads the commands from text files for autonomous. In that way, changes to auton or constants are as quick as a change of a number in notepad, and then double clicking a batch file to dump it onto the cRIO. We can write entirely new and complicated autonomous programs in a minute or two. You can even do the same for your hardware assignments, like DIO or PWM channels, etc, so if hardware breaks you can change which port your using in seconds rather than 5 minutes. |
Re: Reducing code build time
Quote:
For OP, heres our FileRead.java Code:
to use this, place a text file that looks like this in /auton/yourPath.txt (ext doesnt matter, i use txt for easy editing) Code:
constValue : 105.54Code:
FileRead f = new FileRead("yourPath.txt");Quote:
Out of curiosity, what language are you using? Compiling and loading java takes about 30 seconds plugged in 1 minute on battery for me ( battery saver settings ). |
Re: Reducing code build time
Quote:
We are using Java, standard WPILibJ and all. Compiling and loading OTA takes between 1.5 minutes to 2 minutes plugged in. |
Re: Reducing code build time
Quote:
|
Re: Reducing code build time
Quote:
Quote:
One nice thing about RobotPy/pyfrc is that it has a robot simulator you can run on your PC, so you can try many types of new things out without having to even touch your robot. This makes your recompile time effectively zero. :p |
Re: Reducing code build time
An SSD in your build machine would also be worth trying. $100 gets you a decent one these days.
|
Re: Reducing code build time
Quote:
I have a 32 giger in my laptop and running win7 on it, it boots in 3s. However, it is impractical because of the price, even for just a small one. Thankfully I have a second hard disk bay in my laptop. I decent hard disk should be able to provide sufficient speed for a lengthy compile. Getting an SSD becomes impractical, because, for example, my laptop has a very low rating because the processor gives me a 3.1 but the ssd gives me 7 Just get a decent machine, with preferable an i3 or i5 (or i7 if you are lucky to find one cheap). While this is kinda off topic, C++ is known for large build times, and I want new code to update on the system on bootup every match. For that, I wrote a build script that just automatically builds the code. It takes 5 mins so it isn't too bad and the program is automatically launched after the build and if the build fails, the last successful build is run and the errors are logged! |
Re: Reducing code build time
Quote:
[Section] Key = Value These 'Preferences' are read before any other calls in Begin.vi. To aid in the development, we've added a multiple button press on the two driver joysticks to reload these values. This makes it a lot faster to change some constants and ftp them down to the cRIO and not have to reboot it. Also, this year we have implemented a record and replay system for autonomous. From the custom dashboard we enter a file name and flip a toggle switch. The code on the cRIO opens a binary file and stores the needed values to it. We store the following every 10 ms: left joystick Y right joystick Y (we use tank drive), start position of the catapult stop position of the catapult intake arm position (up / down) intake roller speed (sign determines direction) transmission state (high / low gear) launch button When the toggle switch is pressed again or a time limit has been reached the file is closed. To replay this file, the driver selects it from a drop-down list on the custom dashboard (list is published from Begin.vi, which reads the root drive of the cRIO), this file name is passed back to the cRIO and opened. Every 10 ms the next set of values is read from the file and written to their original variables. All control of the robot is done in Periodic Tasks.vi. |
Re: Reducing code build time
|
Re: Reducing code build time
Have any of you guys heard of makefiles? It's the traditional way to set up a comilation so that it only redoes the steps needed when things change.
|
Re: Reducing code build time
Our team uses RoboyPy and what you can do is have a button in your code that sends the command sys.exit() which forces your not to reload the code. Basically reduces change time from 2m to around 30s.
|
Re: Reducing code build time
Quote:
Thanks for all the ideas so far. Our mentor Priscilla added that a lot of the rebuild time is due to the cRIO building, not necessarily compilation. |
| All times are GMT -5. The time now is 02:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi