Log in

View Full Version : Help uploading RobotPy code


nyaculak
07-04-2012, 21:00
My team was considering using Python for a few projects during the off-season. I downloaded RobotPy-2012.2 from First Forge, and I'm slightly confused about which files I'm suppose to use to upload the code.
0) We should start by flashing our cRIO to C++, correct?
1) I'm assuming I start by adding a main robot code file called "robot.py" to the directory "./robot/py". Am I correct?
2) I looked into the utilities directory and I saw two install scripts. One is called install.py, and the other is called team_upload.py. Which one am I suppose to use? Or are we suppose to use both?
3) For each install script that you are suppose to use, could you tell me which directory I'm suppose to call it from? I don't think we're suppose to run the install script from the utilities directory
4) My team tried to use python earlier this year, but when we uploaded code (through Filezilla), our DS said we had communication, but no robot code. Are there any possible explanations for this?
Thanks for any help you can give us!

Peter Johnson
08-04-2012, 12:32
My team was considering using Python for a few projects during the off-season. I downloaded RobotPy-2012.2 from First Forge, and I'm slightly confused about which files I'm suppose to use to upload the code.
0) We should start by flashing our cRIO to C++, correct?
1) I'm assuming I start by adding a main robot code file called "robot.py" to the directory "./robot/py". Am I correct?
2) I looked into the utilities directory and I saw two install scripts. One is called install.py, and the other is called team_upload.py. Which one am I suppose to use? Or are we suppose to use both?
3) For each install script that you are suppose to use, could you tell me which directory I'm suppose to call it from? I don't think we're suppose to run the install script from the utilities directory
4) My team tried to use python earlier this year, but when we uploaded code (through Filezilla), our DS said we had communication, but no robot code. Are there any possible explanations for this?
Thanks for any help you can give us!

0) Correct. Also make sure you check the box to enable NetConsole, as all Python error messages as well as all print statements in your code go to the cRio console.
1) For your own code, create an empty folder in the location of your choosing and create a robot.py file inside of it. You can copy and edit the team_upload.py script to this directory to make it easier to upload your code, although you can also use Windows Explorer or FileZilla to FTP (ftp://10.xx.yy.2/py/), so it's not required.
2) You need to run install.py only once (for a given RoboyPy release). It is the equivalent of the imaging tool for RobotPy, and installs the interpreter and libraries to the robot. If you reimage your cRio you'll also need to rerun it. Ideally someday we might get slightly more official support and have an option in the official imaging tool for Python. You can also FTP it yourself if you don't have python installed on Windows.
3) install.py should be in the robot directory of the distribution, and that's also where it should be run from. As mentioned above, team_upload.py should be copied to where you are writing your code.
4) Either you didn't install the interpreter/libraries as described in (2), or your code had an error and raised an exception. Enable NetConsole in the imaging tool and run NetConsole on your laptop (it's on the start menu) to see what error messages you might be getting.

nyaculak
09-04-2012, 16:28
Thanks for your reply! I'll be sure to try uploading the code as soon as I am able to (hopefully tomorrow).