Go to Post Oh, and your t-square and pencil can't crash, unlike your laptop :D - scottydoh [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 21-01-2006, 20:22
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
CMU Camera kills robot controller if not found.

We found an interesting problem today, that we can't find a way to get around it. We would like to "code" around it but not sure how.

We have our camera tracking ok, and everything works great.

However, if we lose the backup battery and we powered down the robot. Our code goes through the camera initialization again, waiting about 3 seconds before it comes online (normal)...however it locks up the robot controller from executing code because the camera could not be found on power up. We studied this today when we put a simple PrintF statement in a while 1 loop in OperatorControl function that says: "Hi, I am in the OperatorControl Loop". This was only printed to the screen once, and none of our code would execute any more. We did not get a code error LED, and we seemed to have all green lights on the robot controller.

If we had a good battery, and the camera was found on power up or during the initialization, then it would startup ok and track data. We could then unplug the TTL port "live", folks don't try this at home...but we had to do this to see what would happen...and we also unplugged the backup battery to kill the camera totally. Our code kept executing just fine after killing the RS-232 and power source to the camera live without powering down.

We are thinking about the what ifs. What if our camera becomes damaged by a poof ball and doesn't work, the next time it powers up with a "Initialize Camera " function call, it's going to LOCK UP, and we are going to be a sitting DUCK.

We could not see ANY WAY to code around this. Can we check for the camera somehow and not execute the Initialize if we don't find the camera present so our robot will continue to initialize and execute the rest of our code?

Can anyone else replicate this?

Get your camera tracking working FIRST....good battery, put a printF statement in the main loop so you can see that your controller is executing on every loop.

Next, power down your robot. Unplug your camera TTL and backup battery, leave your code alone.

Now power up your robot and observe if your printF statement is still working. What we see is after the 3 seconds, the printF will print one time, and that's all she wrote...no more looping....seems locked up.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #2   Spotlight this post!  
Unread 21-01-2006, 20:37
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Re: CMU Camera kills robot controller if not found.

Huh. Yesterday, we started with the camera, got it working well, and soon after, got our base driving. We put the electronics on the base, and didnot put the camera on, just incase it self-destructed or something. So, about 10 minutes after the power down and camera removal, it drove fine. No problems at all. So, in conclusion, we had none of the problems you described. However, we also had un-commented the default_routine function (yes, I know i've got to fix this before we try the camera again), and we left the backup battery in. I wonder what could be wrong? Maybe its actually the backup battery?
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
  #3   Spotlight this post!  
Unread 22-01-2006, 07:58
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: CMU Camera kills robot controller if not found.

Run the camera off a analog port for power. The camera will be powered from
the 12v battery instead of the backup.

Last edited by Kingofl337 : 29-01-2006 at 09:20.
  #4   Spotlight this post!  
Unread 22-01-2006, 13:06
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: CMU Camera kills robot controller if not found.

How will this help us if the camera is missing, broken? Then on power up, it locks up the code, because the robot controller can't find it?

Maybe I didn't explain the problem good enough above. The camera works great when it's connected and the robot controller finds the camera on power up.

But if the camera code is still in the controller and you disconnect the camera from the controller, it acts like it searchs for the camera, never finds it, excutes one cycle enough to do one printF statement, then locks up.

If the robot controller finds the camera on power up, then the camera dies while the controller is powered up, it's not a problem. The robot controller doesn't care, it just doesn't get any packet information.




Quote:
Originally Posted by Kingofl337
Run the camera off a analogue port for power. The camera will be powered from
the 12v battery instead of the backup.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #5   Spotlight this post!  
Unread 22-01-2006, 14:32
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: CMU Camera kills robot controller if not found.

Quote:
Originally Posted by chakorules
We are thinking about the what ifs. What if our camera becomes damaged by a poof ball and doesn't work, the next time it powers up with a "Initialize Camera " function call, it's going to LOCK UP, and we are going to be a sitting DUCK.

We could not see ANY WAY to code around this. Can we check for the camera somehow and not execute the Initialize if we don't find the camera present so our robot will continue to initialize and execute the rest of our code?
One of the things that we would most certainly be doing is using a switch on the robot, and a switch on the OI, to control whether or not the any of the camera code is used. Using a switch on the OI would be a little trickier than one on the robot, in that you have to make sure that you get a packet through to read the switch before attempting any code related to the camera. This strategy is not quite automatic, but it can be used to get the job done and it is a good idea, in general, to place PID systems and such under conditional control in this manner.

I have not looked at the details of the camera initialization code yet, but it should be possible to run a simple handshake with the camera and detect that the handshake is taking too long. You can then set a variable indicating that the camera is off line.

Eugene
  #6   Spotlight this post!  
Unread 23-01-2006, 08:15
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: CMU Camera kills robot controller if not found.

It is true that if you call the camera code to capture a packet, it waits for valid data to show up. If the camera is not running, then it waits forever. This is to handle case where you initialize the camera and immediately start reading data and the first packet hasn't come in yet.

If we were to add a time out (maybe 500ms) so that it would return all zeros if valid camera data was never received (including 0 confidence) would that work for you?
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
  #7   Spotlight this post!  
Unread 23-01-2006, 09:34
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: CMU Camera kills robot controller if not found.

Quote:
Originally Posted by BradAMiller
It is true that if you call the camera code to capture a packet, it waits for valid data to show up. If the camera is not running, then it waits forever. This is to handle case where you initialize the camera and immediately start reading data and the first packet hasn't come in yet.

If we were to add a time out (maybe 500ms) so that it would return all zeros if valid camera data was never received (including 0 confidence) would that work for you?

The problem that we are experiencing is initializing the camera, when the camera is not found. In fact is does "wait forever" it seems to us.

We understand that if data is never received that we could write a time out code, in fact that is what we want to do. But how do we write a timeout in EasyC when the initialize of the camera is a function block that we can't edit or interface to? It seems to go into that function and never come back out, (the CPU pointer, aka scan)

If the cpu went into the initialize function and never comes out, how are we suppose to write a timeout function for it?
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #8   Spotlight this post!  
Unread 25-01-2006, 22:42
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: CMU Camera kills robot controller if not found.

So no one has any other suggestions on this issue?
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #9   Spotlight this post!  
Unread 26-01-2006, 08:36
intelitek_Chris intelitek_Chris is offline
Registered User
no team
 
Join Date: Dec 2005
Location: Manchester
Posts: 19
intelitek_Chris will become famous soon enoughintelitek_Chris will become famous soon enough
Re: CMU Camera kills robot controller if not found.

As it stands now, everything should work properly as long as the camera remains powered and connected. We are working on a better method for situations where the camera loses power during a match, so that the code will not wait forever for a response from the camera.
  #10   Spotlight this post!  
Unread 26-01-2006, 10:09
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 751
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: CMU Camera kills robot controller if not found.

Ok no problems. I was asking because I didn't know if we are doing something wrong, or if we could write something to handle it. But sounds like we can't at this point.

What we are going to try is program a button on the OI, if the button is pressed (and held) during a power up in the Initiazation, we aren't going to excute any of the camera stuff.

If we get in a match and our camera dies, we have a robot reset on the OI, we will hold down our programmed "bypass" button, press robot reset, reboot the robot, and hope it forgets about the camera and comes back to life to finish the match...

That's our work around for now, do you think that would work?
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #11   Spotlight this post!  
Unread 26-01-2006, 11:47
intelitek_Chris intelitek_Chris is offline
Registered User
no team
 
Join Date: Dec 2005
Location: Manchester
Posts: 19
intelitek_Chris will become famous soon enoughintelitek_Chris will become famous soon enough
Re: CMU Camera kills robot controller if not found.

That is a really good idea!

I will let you know if I hear of any other solutions. As long as the code you execute when you hold the 'bypass' button doesn't contain any camera calls, your work around should work perfectly.
  #12   Spotlight this post!  
Unread 26-01-2006, 19:26
Vashts6583's Avatar
Vashts6583 Vashts6583 is offline
The sleepless
AKA: Rob Metzger
FRC #0007 (Team 007)
Team Role: Leadership
 
Join Date: Dec 2004
Rookie Year: 2005
Location: Parkville
Posts: 79
Vashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to allVashts6583 is a name known to all
Send a message via ICQ to Vashts6583 Send a message via AIM to Vashts6583 Send a message via MSN to Vashts6583 Send a message via Yahoo to Vashts6583
Thumbs up Re: CMU Camera kills robot controller if not found.

how about running a counter in the initialization loop, and if the counter hits such and such a number, then break out of the loop and forget the camera. takes a little bit of knowledge of loops and the like. shouldn't be hard. only an idea. =P good luck with it all.
__________________
/*********************
2005: Software Assistant
2006: Software Head
2007: President/Driver/Software Head/Temporary Safety Captain
*********************/

//2005: Chesapeake Regional - Finalist


Life is what you do outside of FIRST. No wonder it's so short.
  #13   Spotlight this post!  
Unread 27-01-2006, 17:52
winners winners is offline
Registered User
no team
 
Join Date: Jan 2006
Location: Nazareth
Posts: 22
winners is an unknown quantity at this point
Re: CMU Camera kills robot controller if not found.

Quote:
Originally Posted by Kingofl337
Run the camera off a analog port for power. The camera will be powered from
the 12v battery instead of the backup.
what analog port?

Last edited by Kingofl337 : 29-01-2006 at 09:20.
  #14   Spotlight this post!  
Unread 29-01-2006, 09:21
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: CMU Camera kills robot controller if not found.

It doesn't matter just pick one. They are all 5v.
  #15   Spotlight this post!  
Unread 04-02-2006, 13:30
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 592
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: CMU Camera kills robot controller if not found.

Quote:
Originally Posted by chakorules
We are thinking about the what ifs. What if our camera becomes damaged by a poof ball and doesn't work, the next time it powers up with a "Initialize Camera " function call, it's going to LOCK UP, and we are going to be a sitting DUCK.
Sorry I couldn't get to this sooner, but there is a new version of WPILib that you can try that has one second timeouts on receiving camera data. If no camera data has been received before the timeout, then zeros are returned for all values. So if your code starts seeing zeros coming back for everything, including confidence, servo values, etc. then you know that the camera is not working.

This only happens for the first time. After that, the camera will always return the last value it received.

This should be fixed in an upcoming release of EasyC, but to try it for now, you can download the library from my web site, unpack the .zip file and replace the copy of WPILIb.lib inside of the EasyC directory C:\Program Files\Intelitek\easyC for FRC\Frc\18F8722 with the copy of WPILib2k6.lib from the .zip file.

It has been tested, but bugs do happen, and I'd suggest keeping a copy of the old file that you are replacing.

Please post a message or send mail if you run into any problems.
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Persistent "no robot controller found" error 1594code Programming 12 20-02-2006 20:59
CMU Cam not Tracking Properly on Robot coastertux Programming 6 29-01-2006 00:02
Camera not found! SpeakerSilenced Programming 0 21-02-2005 12:54
Camera not found!!! Code\\Pilot Programming 11 02-02-2005 00:04
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 19-03-2003 13:30


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

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