Go to Post Lexan $20.... Stock Aluminum $30.... Having a OI that is heavier than the robot PRICELESS.... - GBIT [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 17-01-2011, 20:43
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Vision Processing / Networking Problems

I've been fighting the camera since about Thursday, and I'm running out of ideas. It seems that there may also be some networking problems interconnected, but I can't tell which is which anymore. I'll try to document what steps I've taken and what seems to have helped, but feel free to ask me questions and I'll answer as best as I can. (Note: I'm a new member, so my posts may take a while to show up, so feel free to ask for lots of information at a time).

Phase 1: Camera video feed and basic arcade drive code both working.

Phase 2: I believe that I added the HSLImage object and attempted to get an image from the camera. Also, we were trying to set up another computer to run Windriver/Driver Station so we could get off the classmate. Both computers are connected in Windriver, but cannot download (this happened on the new computer before the classmate). Classmate is Windows 7, new computer is XP.

Phase 3: The next day, problem still persists. FTP was also unable to connect. We tried various combinations of changing IP addresses on the computers, disabling wireless on one or both computers for a time, checking/replugging in the ethernet connections on the robot, and rebooting the robot and computers. Eventually, we got the ability to download again. This problem still crops up every once in a while, but I haven't noticed a definitive pattern, and we do the above dance until it works again.

Phase 4: In trying to be able to download, I had commented out the vision code, so I re-added it, piece by piece. Once again, the video feed comes through without a problem, but this time when I add vision processing, there is a new problem. Either the drive/servos do not work and the camera continuously sends back pictures, or the drive/servos work and the camera breaks. When the drive breaks, it sometimes gives us an error message in Windriver and asks if we want to attach the debugger. I cannot remember exactly what the error message said, but it always mentioned one of the vision classes. At least twice, it was "GetImaqImage()" function of ImageBase.
This seems to be tied into the vision processing code fairly reliably, but I can't find anything that explains how to do it right. The example in the First Forge document doesn't even compile.

We modified the BuiltinDefaultCode example to use an iterative robot. We declare the image with the other objects at the start of the class, and while I don't know if we need to, initialize it in the constructor as well. We then attempt to get an image from the camera in TeleopPeriodic:

Code:
AxisCamera& camera;
HSLImage *image;
...
BuiltinDefaultCode(void):
camera(AxisCamera::GetInstance())
{
...
image = new HSLImage();
}
...
void TeleopPeriodic(void) {
...
camera.GetImage(image);
image->ThresholdRGB(5, 250, 5, 250, 5, 250);
...
}
I've also tried changing image to a ColorImage instead of HSLImage, although my understanding of inheritance makes me think that's not at all necessary.

That's about all I can think of. If anyone can help us with our vision or networking problems, or both, or explain how they're interconnected, we would really appreciate it.
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2011, 06:38
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Vision Processing / Networking Problems

I guess my advice is to isolate your problems.

If WR pops up a dialog about investigating a crash, that is a good opportunity to look around for stale pointers, divide by zero, etc. Your code crashed and WR is telling you how.

If you have networking problems and can't ftp, use the DS and ping to identify the IP addresses. I'm pretty sure that once ping works to the cRIO, ftp will too.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2011, 23:52
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: Vision Processing / Networking Problems

So, I am/was unable to work much on the robot today or tomorrow, but thanks for the quick response. Unless the error is in the vision WPILib, there aren't any obvious bugs like divide by zero. I'm not sure what a stale pointer is, so I suppose that's possible, but I don't think so. I couldn't understand the error, but next time we get it, I'll be sure to post it here. Also, I was recently pointed in the direction of possibly better documentation (haven't had a chance to look into it yet - darn school), so here's hoping that helps.

For now though, I'm taking your advice and trying to isolate the problems. So, we've temporarily taken out the vision code to solve the wireless problems. Can you explain how to use ping to identify IP addresses? I know the form "ping 10.xx.yy.n" but I don't see exactly how that helps. Some of the errors for this reference values with 'n's that I don't recognize, and I've double checked on all the computers to make sure no adapter has that IP set. I believe one of those numbers might have been 21, but not sure. When ping works, FTP does as well, but I don't understand how to use ping to make FTP work.

Thanks for your help.
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2011, 08:57
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Vision Processing / Networking Problems

ping will not fix networking problems, but acts as a connectivity test. If you can ping .02 (the cRIO), things should work. If not, can you ping something in the middle? I believe the dlink is .04, so can you ping it? Generally, ping lets you test the links in the chain to see where it is broken.

That is why ping is built into the DS, on the diagnostic tab. The top light tells you if you have a cable connected, the next is I believe the DS router, if used. The next is the bridge, and finally the cRIO.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2011, 12:52
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Vision Processing / Networking Problems

No, I think the D-Link is .01. I may be mistaken but I think the idea of using the D-Link this year is that there is no .04 until you are at competition. At competition, you put the D-Link in bridge mode and the field will provide .04 so that your classmate PC will plug into the field to control your robot. But when you are testing or practicing, you put the D-Link in AP mode so that your laptop can control the robot directly via the D-Link AP. So you can't ping .04. Please correct me if I am wrong because I can't find anything that mentions we need to use last year's Linksys AP/router (which is the .04).
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2011, 00:13
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: Vision Processing / Networking Problems

mikets, you're right in that it is .01, not .04 and that we don't need to use last years router. I haven't looked into the competition format yet, but what you said sounds right.

Greg, the odd thing is that when we are unable to download/ftp (and I don't think we can ping either, though not positive on that), we still have communications on the driver station and can use whatever the last code was on the bot.
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2011, 07:53
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Vision Processing / Networking Problems

Sorry for the incorrect IP.

So, it sounds like the DS works, but the development computer doesn't. Is that right? What is the IP of the dev computer. You can look in the adapter settings under IPV4 in the control panel, or often it is easier to type ipconfig into a command window.

Remember that you don't want any two devices with the same IP, or you'll have problems if they are on the network at the same time.

Also, if a laptop has wireless and wired ethernet, it actually has two IP addresses, one for each Network Interface Card or NIC. Actually, record the IP for both interfaces on the programming laptop.

You should be able to set the programming computer to something like .07 and have it and the DS on at the same time.

Greg McKaskle
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2011, 20:33
CodeMonkeyMatt CodeMonkeyMatt is offline
Registered User
FRC #2605
 
Join Date: Jan 2011
Rookie Year: 2008
Location: WA
Posts: 46
CodeMonkeyMatt is on a distinguished road
Re: Vision Processing / Networking Problems

Thanks for your help.

The DS and development computer in this context are one and the same. I can drive the robot, but not FTP it from the same computer.

I am aware that two computers shouldn't have the same IP address, and I know the wired and wireless have different IP's. That's what I was trying to convey with "I've double checked on all the computers to make sure no adapter has that IP set". I've tried combinations of .5, .6, .21, and several other random ones that I can't remember since they were simply high random ones that I was pretty sure weren't in use.

The networking problems seems to be working itself out though. I'm not sure why, but I'm not exactly complaining. However, the vision's gotten worse. I can get it to send pictures back (which is what I'm trying to do), but as soon as I try to drive the motors, the camera goes out.

Code:
#include "WPILib.h"
#include "Vision/AxisCamera.h"
#include "Vision/PCVideoServer.h"
#include "Vision/AxisCameraParams.h"


/**
 * This is a demo program showing the use of the RobotBase class.
 * The SimpleRobot class is the base of a robot application that will automatically call your
 * Autonomous and OperatorControl methods at the right time as controlled by the switches on
 * the driver station or the field controls.
 */ 
class RobotDemo : public SimpleRobot
{
	RobotDrive myRobot; // robot drive system
	Joystick stick; // only joystick

public:

	RobotDemo(void):
		myRobot((new Victor(1)), (new Victor(2))),	// these must be initialized in the same order
		stick(1)		// as they are declared above.
	{
		//myRobot.SetExpiration(1);
	}

	/**
	 * Runs the motors with arcade steering. 
	 */
	void OperatorControl(void)
	{
		//myRobot.SetSafetyEnabled(true);
		AxisCamera& camera = AxisCamera::GetInstance();
		printf("Setting camera parameters\n");
		camera.WriteResolution(AxisCamera::kResolution_160x120);	
		camera.WriteCompression(20);
		camera.WriteBrightness(0);
		camera.WriteMaxFPS(5);
		
		Wait(3.0);
		while (IsOperatorControl())
		{
			printf("Teleop");
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
	}
};

START_ROBOT_CLASS(RobotDemo);
This fails with the myRobot.SetExpiration(1); and myRobot.SetSafetyEnabled(true); commented out or not. I wasn't sure what they did, so I tried both. I can't find them in the code. Thanks again, this is really frustrating me.

Edit: Forgot to mention. We opened up the target console in windriver and looked at the processes. When the camera gets knocked out, the "FRC_PCVide>" task gets an error number of 3d0004 if that helps.

Last edited by CodeMonkeyMatt : 20-01-2011 at 20:49.
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 15:05.

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