Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Hot swapping code (http://www.chiefdelphi.com/forums/showthread.php?t=132390)

nickmcski 08-01-2015 11:27

Hot swapping code
 
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

Quote:

Originally Posted by nickmcski (Post 1424275)
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

Re: Hot swapping code
 
We found that with 11 second compile times and 7 second reboots, we don't need to hot-swap anything.

jtrv 13-01-2015 12:38

Re: Hot swapping code
 
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

Re: Hot swapping code
 
Ah ha, I did some more digging and I found this in the debug launch for the roboRIO
Code:

/usr/local/frc/JRE/bin/java -XX:+UsePerfData -agentlib:jdwp=transport=dt_socket,address=8348,server=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.


All times are GMT -5. The time now is 22:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi