Go to Post Ah, this sounds like a sitcom whose pilot I should write and send to NBC - "Life With Lavery". There's a lot of eating, several practical jokes, and lots of bad hair. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-30-2016, 12:59 PM
urg8rb8 urg8rb8 is offline
Registered User
FRC #0108
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Plantation
Posts: 22
urg8rb8 is an unknown quantity at this point
Can't get driver station to keep robot code light to stay green

Robot communications light stays on but the robot code light stays green for like two seconds then turns red. We put printf calls in RobotInit() and Disable() and we see both prints in NetConsole. This tells me that the code is actually being executed by the roborio but why is the Disable() function being called?

We've been at this for a few days and can't figure it out. We've made sure all the pieces of SW have been updated to the latest versions.

Thanks for your help!!

Last edited by urg8rb8 : 01-30-2016 at 01:03 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-31-2016, 01:42 PM
axton900's Avatar
axton900 axton900 is offline
Programming Co-Captain
FRC #1403 (Cougar Robotics)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2015
Location: New Jersey USA
Posts: 45
axton900 has a spectacular aura aboutaxton900 has a spectacular aura aboutaxton900 has a spectacular aura about
Re: Can't get driver station to keep robot code light to stay green

If you do not have a SendableChooser object, HAL does not initialize. Try this and see if your code works
Reply With Quote
  #3   Spotlight this post!  
Unread 02-01-2016, 11:57 PM
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 152
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: Can't get driver station to keep robot code light to stay green

Disable() gets called on startup so that you can do the things required to "disable" if there's anything special you'd like to do. Some questions...

Do you ever get the chance to click on "Enable" at the driver station? Or is it dead by then?
If it's dead so quickly, (the green robot code isn't lit) this means the program crashed and the best way to catch a crash is with the debugger. Take a look at screensteps live for "how to debug" ... but the gist is that rather than "Run As...->WPILib", you should use "Debug As...->WPILib" and this will deploy the code, but it will then launch it via the gdb debugger. If you're fortunate, the crash (exception) will get caught by gdb and you can pretty easily tell where the crash is.

To give you a hint of the type of thing I've seen make an early crash pre-enable with my students is not understanding declaring pointers and when they can be used. For instance, at the definition of your "SimpleRobot" class, if you declare a pointer and then try to use the pointer before instantiating it (via 'new'), you'd be using a null pointer. Things like...

Code:
class MyRobot : SimpleRobot {
  Victor *pMotor;
  int curSpeed = pMotor->Get();
....
}
In this case, curSpeed should be declared but not used in that way. It should be used in some place like RobotInit() AFTER doing a pMotor = new Victor(1);

There are many ways to make such an early crash - this is just an example. Give the debugger a try (its a great and valuable tool to know how to use) and if you're still stumped, post your code and we'll take a look for what might be at issue.

Quote:
Originally Posted by urg8rb8 View Post
Robot communications light stays on but the robot code light stays green for like two seconds then turns red. We put printf calls in RobotInit() and Disable() and we see both prints in NetConsole. This tells me that the code is actually being executed by the roborio but why is the Disable() function being called?

We've been at this for a few days and can't figure it out. We've made sure all the pieces of SW have been updated to the latest versions.

Thanks for your help!!
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
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


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

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