Go to Post Does this need a "Do not try this at home" stamp? - sanddrag [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 3 votes, 4.67 average. Display Modes
  #16   Spotlight this post!  
Unread 30-11-2010, 23: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: 256
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: RobotPy 2010.beta2

Quote:
Originally Posted by Robototes2412 View Post
oh, what port is this on?
It's UDP broadcasted by the robot to 10.255.255.255, port 6666. There's no data format, the UDP payload is simply the console output.
__________________
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)
Reply With Quote
  #17   Spotlight this post!  
Unread 01-12-2010, 01:28
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: RobotPy 2010.beta2

so i listen for a broadcast on port 6666?

how would i do this with netcat?
Reply With Quote
  #18   Spotlight this post!  
Unread 01-12-2010, 01:51
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: 256
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: RobotPy 2010.beta2

Quote:
Originally Posted by Robototes2412 View Post
so i listen for a broadcast on port 6666?

how would i do this with netcat?
Untested, but something like "nc -u -l -p 6666" ?

Remember that to get anything you need to have the NetConsole server running on the cRIO (by editing ni-rt.ini per the instructions in the above link).

Also I've only seen this work over wired connections (on the PC side); wireless to the robot works fine, but the PC has to be hardwired to the router (I think this has to do with it being broadcast instead of unicast).
__________________
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)
Reply With Quote
  #19   Spotlight this post!  
Unread 02-12-2010, 03:36
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RobotPy 2010.beta2

Quote:
Originally Posted by Robototes2412 View Post
oh, what port is this on?
UDP 6666 for packets to the client.
UDP 6668 for packets to the cRIO.
Reply With Quote
  #20   Spotlight this post!  
Unread 02-12-2010, 05:20
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RobotPy 2010.beta2

Quote:
Originally Posted by Robototes2412 View Post
so i listen for a broadcast on port 6666?

how would i do this with netcat?
You can use this utility (since netcat doesn't play very nicely with listening for broadcast UDP).

You can then use the script here.... or just run (after compiling ncb.c):
Code:
./ncb 6666 &
nc -u 10.xx.yy.2 6668
Enjoy,
-Joe
Reply With Quote
  #21   Spotlight this post!  
Unread 02-12-2010, 18:26
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: RobotPy 2010.beta2

thanks

so i add netconsole.out to the startupdll's?
Reply With Quote
  #22   Spotlight this post!  
Unread 02-12-2010, 20:41
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: RobotPy 2010.beta2

Quote:
Originally Posted by Robototes2412 View Post
so i add netconsole.out to the startupdll's?
Add it to the beginning of EarlyStartupLibraries. Guess you didn't find the instructions.
Reply With Quote
  #23   Spotlight this post!  
Unread 03-12-2010, 00:16
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: RobotPy 2010.beta2

just confirming
Reply With Quote
  #24   Spotlight this post!  
Unread 09-01-2011, 21:49
blakeelias's Avatar
blakeelias blakeelias is offline
2011 CT chairman's award
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New York
Posts: 26
blakeelias is an unknown quantity at this point
Re: RobotPy 2010.beta2

This is great!

I played with RobotPy a little, and here's a problem I encountered. When our code exits due to some error, it waits 5 seconds and then starts our script again, which is how we load new code.

However, when it's an actual error, not an intentional interrupt for new code, while we look at the source and fix the problem it keeps on restarting every 5 seconds. Eventually it crashes with some memory error and we have to restart the robot. (I don't have the output in front of me; I'll try and reproduce it so I can post the exact error.)

Has anyone else had this issue? How can I prevent it from doing this?
Reply With Quote
  #25   Spotlight this post!  
Unread 10-01-2011, 00:58
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: 256
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: RobotPy 2010.beta2

Quote:
Originally Posted by blakeelias View Post
This is great!

I played with RobotPy a little, and here's a problem I encountered. When our code exits due to some error, it waits 5 seconds and then starts our script again, which is how we load new code.

However, when it's an actual error, not an intentional interrupt for new code, while we look at the source and fix the problem it keeps on restarting every 5 seconds. Eventually it crashes with some memory error and we have to restart the robot. (I don't have the output in front of me; I'll try and reproduce it so I can post the exact error.)

Has anyone else had this issue? How can I prevent it from doing this?
I will fix this in the first 2011 release (Wednesday at the latest). What I will do is handle the restart/reload exception specially; any other exception will result in ending the user program (requiring a full robot reboot).
__________________
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)
Reply With Quote
  #26   Spotlight this post!  
Unread 10-01-2011, 01:13
Slix Slix is offline
Registered User
AKA: Peter Kowalczyk
FRC #2115 (NightMares)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2010
Location: Mundelein, IL
Posts: 31
Slix is an unknown quantity at this point
Re: RobotPy 2010.beta2

Quote:
Originally Posted by Peter Johnson View Post
I will fix this in the first 2011 release (Wednesday at the latest). What I will do is handle the restart/reload exception specially; any other exception will result in ending the user program (requiring a full robot reboot).
Full robot reboot as in a power cycle? That seems like it could be improved (though, timely release of the first 2011 release is probably more important). The advantage of quickly reloading code without a power cycle is great, and syntax errors are probably common.

How long does a power cycle take for most people? With our LabView code (I don't know if your language makes a difference), it took a minute or two before we got communications after turning the robot on.

If the error is happening because the user code is being loaded/unloaded so often, then I can't think of any good fix that doesn't involve fixing the memory error/bug.
Reply With Quote
  #27   Spotlight this post!  
Unread 10-01-2011, 02:08
blakeelias's Avatar
blakeelias blakeelias is offline
2011 CT chairman's award
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New York
Posts: 26
blakeelias is an unknown quantity at this point
Re: RobotPy 2010.beta2

When there's an error can't it just sit there and wait for you to load new code? Maybe that's something that could be done in robot.py inside of run(), if it catches an exception then checkRestart() continuously.
Reply With Quote
  #28   Spotlight this post!  
Unread 10-01-2011, 02:18
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: 256
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: RobotPy 2010.beta2

Quote:
Originally Posted by blakeelias View Post
When there's an error can't it just sit there and wait for you to load new code? Maybe that's something that could be done in robot.py inside of run(), if it catches an exception then checkRestart() continuously.
By scanning the /py/ directory for updated date/time/size files (maybe non-ideal because of multiple files...)? Or wait for a joystick button press?
__________________
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)
Reply With Quote
  #29   Spotlight this post!  
Unread 10-01-2011, 02:20
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: 256
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: RobotPy 2010.beta2

Quote:
Originally Posted by Slix View Post
If the error is happening because the user code is being loaded/unloaded so often, then I can't think of any good fix that doesn't involve fixing the memory error/bug.
Unfortunately the memory leak appears to be very difficult to fix (it's a leak in Python itself).

With regards to reboot time, you don't need to power cycle the whole robot. Clicking the "Reboot Robot..." button on the Driver Station Diagnostics tab only takes 20-30 seconds. Still non-ideal, of course, but much faster than a power cycle (the additional delay is due to the wireless network startup time).
__________________
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)

Last edited by Peter Johnson : 10-01-2011 at 02:25.
Reply With Quote
  #30   Spotlight this post!  
Unread 10-01-2011, 02:48
blakeelias's Avatar
blakeelias blakeelias is offline
2011 CT chairman's award
FRC #0694 (Stuypulse)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New York
Posts: 26
blakeelias is an unknown quantity at this point
Re: RobotPy 2010.beta2

Quote:
Originally Posted by Peter Johnson View Post
By scanning the /py/ directory for updated date/time/size files (maybe non-ideal because of multiple files...)? Or wait for a joystick button press?
Wait for a button press, same as usual. I was just going to try wrapping the whole run method in a try..except, and in the `except' continuously check for a joystick button to raise the restart runtime error.

http://pastebin.com/9bcUEy96
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
RobotPy: Python for FRC Peter Johnson Python 28 17-10-2012 11:46
[FTC]: FTC 2010-2010 "A New Game" JohnFogarty FIRST Tech Challenge 2 21-08-2010 22:34
Connect a Million Minds 2010 Robotics Invitational, June 26, 2010 Columbus, Ohio Dr. Osemwengie Off-Season Events 29 03-07-2010 00:33
2010 accelerometer chsr C/C++ 1 22-01-2010 02:28


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

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