Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   What is wrong with my RobotPy code? (http://www.chiefdelphi.com/forums/showthread.php?t=133183)

team-4480 19-01-2015 18:13

What is wrong with my RobotPy code?
 
Hi and sorry for so many question! I am the sole python programmer so I have no one else to turn to. So the problem is when I upload my code to the RIO and then I click enable in the driver station, the driver station disables the code after about a second. I can't seem to find anything that would make the Driver Station quit so quickly without showing an error. Any help will be greatly appreciated! Code: http://pastebin.com/L17jQVqB

virtuald 19-01-2015 18:27

Re: What is wrong with my RobotPy code?
 
Recommend that you use the pyfrc simulator to test your code. Your problem will be immediately apparent when you actually run it. :)

To use the pyfrc simulator, get pyfrc installed and just run 'robot.py sim'.

When uploading the code to the robot, to see the output from your code (which would also show your problem), specify the --nc parameter to 'robot.py deploy' and it will launch a netconsole listener, which will show the output from your code.

You might benefit from the RobotPy eclipse plugins that we just released, it makes running tests and such a lot easier.

team-4480 19-01-2015 18:33

Re: What is wrong with my RobotPy code?
 
Quote:

Originally Posted by virtuald (Post 1430709)
Recommend that you use the pyfrc simulator to test your code. Your problem will be immediately apparent when you actually run it. :)

To use the pyfrc simulator, get pyfrc installed and just run 'robot.py sim'.

When uploading the code to the robot, to see the output from your code (which would also show your problem), specify the --nc parameter to 'robot.py deploy' and it will launch a netconsole listener, which will show the output from your code.

You might benefit from the RobotPy eclipse plugins that we just released, it makes running tests and such a lot easier.

I appreciate it(again)! I will try the pyfrc sim and --nc parameter! Thanks a bunch!

TimTheGreat 19-01-2015 20:57

Re: What is wrong with my RobotPy code?
 
Your code seems a bit complex. What are you trying to accomplish. There may be an easier way.

Peter Johnson 20-01-2015 03:23

Re: What is wrong with my RobotPy code?
 
There are two issues with your code:

1 - you call teleopPeriodic from robotInit. You shouldn't do this. The IterativeRobot class does this for you.

2 - you have a while loop in teleopPeriodic. You shouldn't do this either. The IterativeRobot class periodically calls this function in a loop. You only need to have a while loop if you're using SampleRobot as a base class (not recommended).

See the documentation on IterativeRobot for more details: http://robotpy.readthedocs.org/en/la...tiveRobot.html

team-4480 20-01-2015 17:31

Re: What is wrong with my RobotPy code?
 
Quote:

Originally Posted by TimTheGreat (Post 1430772)
Your code seems a bit complex. What are you trying to accomplish. There may be an easier way.

I am trying to make a controller curve so it is not a 1 to 1 ratio on the controller for better handling of robot. Thanks!


All times are GMT -5. The time now is 02:45.

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