Go to Post As Grandma used to say, "empirical data is better than no data at all." - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2015, 18:13
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 229
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
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
  #2   Spotlight this post!  
Unread 19-01-2015, 18:27
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
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.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #3   Spotlight this post!  
Unread 19-01-2015, 18:33
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 229
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: What is wrong with my RobotPy code?

Quote:
Originally Posted by virtuald View Post
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!
  #4   Spotlight this post!  
Unread 19-01-2015, 20:57
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 238
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
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.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
  #5   Spotlight this post!  
Unread 20-01-2015, 03:23
Peter Johnson Peter Johnson is offline
WPILib Developer
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 268
Peter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud of
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
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC

2010 FRC World Champions (294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
  #6   Spotlight this post!  
Unread 20-01-2015, 17:31
team-4480's Avatar
team-4480 team-4480 is offline
Debug? What's that?
FRC #4480
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Minnesooota
Posts: 229
team-4480 will become famous soon enoughteam-4480 will become famous soon enough
Re: What is wrong with my RobotPy code?

Quote:
Originally Posted by TimTheGreat View Post
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!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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