|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Segmentation Fault with PuTTy
Hello all,
We are running our robot.py through a SSH on PuTTy (because we have zero idea how to get pyfrc functioning, it doesn't seem to work) and have successfully gotten our "Robot Code" light to go green on the Driver's Station. However, when we start implementing a more advanced code into the RoboRIO, puTTy returns "Segmentation Fault." Our code light goes red then. I suppose my question is, really, how do we get our code functioning? It's the same stuff we used last year, and the same electricals minus the RoboRIO (which appears to be accepting Python and communicates with the DS). Thanks, robotdna |
|
#2
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
I ran into some issues with pyfrc today also, and I'm going to see if I can nail it down. What particular issues are you having?
A segmentation fault means we screwed something up. If you could send me the code that caused the segmentation fault, I can help you figure it out. dustin@virtualroadside.com |
|
#3
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
More specificially, this happens when a python extension (written in C) tries to access a memory beyond reach.
You can trace it in following ways: 1.Add sys.settrace at the very first line of the code. 2.Use gdb at the command prompt gdb python (gdb) run /path/to/script.py ## wait for segfault ## (gdb) backtrace ## stack trace of the c code My python is rather rusty. Let me know if this method doesn't work |
|
#4
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
So, I gave this some thought, and I believe you are creating objects outside of your robot class. At the moment, HALInitialize is not called until after wpilib.run() is called, and if you try to create a device before HALInitialize is called, it will segfault.
For the moment, create your devices inside your robot object, and the segfault will go away. In the next release of the RobotPy WPILib libraries, it will raise an error if you do this. |
|
#5
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
Were you able to resolve your issue?
|
|
#6
|
|||
|
|||
|
Re: Segmentation Fault with PuTTy
First off, how does one even use pyfrc? It seems like there is documentation on how to install pyfrc, but nothing on how to actually function with it.
Where do I type any of my commands? I installed pyfrc using pip(pip window comes up, I select "c:\python34\python.exe" as the interpreter, then typed "pip install pyfrc" What do I do next from this? Your documentation has plenty on what commands to use, but no documentation on where to type them or how to use them. Thanks again for all your help, robotdna |
|
#7
|
|||
|
|||
|
Re: Segmentation Fault with PuTTy
Alright, so using putty:
Every time we use "lmotor2 = wpilib.Talon(1)" we get a segmentation fault. When we replace Talon with Joystick or Timer, the code runs correctly. We also get this error using "TalonSRX" and "Jaguar". Thanks, robotdna |
|
#8
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
Quote:
Please upgrade to RobotPy 2015.0.3 (just released a few minutes ago), and it will allow you to create the objects whenever you would like without segmentation faults. |
|
#9
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
Quote:
The way pyfrc works is it attached to some predefined hooks in the installed wpilib on your computer, such that when you execute your robot code directly, you can specify options to run the various pyfrc commands. When you run your robot code, you can run it using whatever mechanism you would like (a script, via eclipse, via the terminal). Most people will use the terminal (or cmd on Windows) to execute their code. So, to execute your robot code on Windows, you would open cmd, change directories to where your robot code is, and then run this: Code:
py robot.py Code:
python3 robot.py Code:
py robot.py --help Code:
py robot.py deploy |
|
#10
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
Also, I've updated the documentation on the usage section of pyfrc. Please let me know if the documentation makes sense to you.
http://pyfrc.readthedocs.org/en/latest/usage.html |
|
#11
|
|||
|
|||
|
Re: Segmentation Fault with PuTTy
Quote:
Alright, everything with RobotPy and PyFRC appears to be functioning perfectly and quite smoothly. Thank you so much for your support! |
|
#12
|
||||
|
||||
|
Re: Segmentation Fault with PuTTy
Good to hear!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|