View Full Version : Hot swapping code
nickmcski
08-01-2015, 11:27
Just wondering if anyone knows if the roboRIO supports hot swapping, or is it possible if I add some java parameters to the roboRIO to enable hot swapping. I have used hot swapping on my computer before but I don't know how the roboRIO VM works.
fsilberberg
08-01-2015, 15:17
Just wondering if anyone knows if the roboRIO supports hot swapping, or is it possible if I add some java parameters to the roboRIO to enable hot swapping. I have used hot swapping on my computer before but I don't know how the roboRIO VM works.
Well, we use the standard Java se embedded JRE. You'll have to figure out how to get whatever environment you're using for hotswapping to connect to a remote JVM. The embedded profile we use is more limited than the full Java se, so you might have to create a custom JRE with more features.
This year, the code redeploy is really fast, like 7 seconds from compile to running. Is this really too slow that you need hotswapping?
Pratik Kunapuli
09-01-2015, 10:28
We found that with 11 second compile times and 7 second reboots, we don't need to hot-swap anything.
if you really wanted to, you could just make the 2 versions of code you want, say code A and B, separated by packages.
In the robot main class outside of packages A and B, run an init method to detect from the RIO a .txt file with a single character: A or B.
If A, call the Package A main class in teleopPeriodic(), etc.
If B, call the Package B main class.
This would only work with iterative, i don't know if it will work with Command or Simple.
This way you can just change a .txt file on the RIO and you don't have to recompile or rebuild, since both packages will be on the RIO. Dunno about memory usage though.
edit: you could also just do something on smartdashboard. that simplifies the whole txt file thing.
nickmcski
16-01-2015, 00:06
Ah ha, I did some more digging and I found this in the debug launch for the roboRIO
/usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,ser ver=y,suspend=y -jar /home/lvuser/FRCUserProgram.jar
So if i'm correct you should be able to hotswap code if you connect to the roborio over port 8348, I haven't tested it yet but I will be sure to post my results when I get into school tomorrow.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.