Go to Post ... hey which end of the robot faces the wall anyways? Oops.... :rolleyes: - dhitchco [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 03-02-2008, 10:48
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,721
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Danger in Disconnected IR Receiver

I've been concerned about the inherent dangers inadvertently introduced by Team Update #6's ruling that the IR Receivers must be physically disconnected from the robot while in the Pit.

The intent is admirable, however, the execution method is dangerous.

Every programmer should be aware that a physically disconnected IR Receiver will look to the code as if every IR command has been simultaneously selected.

The danger of course is that if your code simply checks to see if a pin is ==1, then you'll begin executing the first command you check. If you plan to use the IR in Teleop mode, then your robot will take off as soon as you turn it on in the pit. If you use IR only in Hybrid mode, then your robot will take off as soon as the Competition Port Auto switch is thrown.

Please design your code to check for and reject multiply selected IR commands.

P.S. And stand clear of the team in the next pit who won't test this ahead of time and will find out the hard way Thursday morning of the Regional.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 03-02-2008 at 12:08. Reason: mistyping
  #2   Spotlight this post!  
Unread 03-02-2008, 10:54
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Danger in Disconnected IR Receiver

I already made code that handles this well, and will blink the 4 red LEDs on the OI when the IR receiver is disconnected. I have posted this code in another thread, and have referred to it numerous times. It is really dangerous not to use some sort of safety code if the IR sensor becomes disconnected or it breaks. Here is my code I made:

Code:
//Variables should be declared at the beginning at the program
int mode = 0; //Set it to zero so the robot won't move!
int modea;
int irerror;
int errorloop;



//Switches off all the LEDs on the OI
Switch1_LED = 0;
Switch2_LED = 0;
Switch3_LED = 0;
Relay1_red = 0;
Relay2_red = 0;
Relay1_green = 0;
Relay2_green = 0;
Pwm1_green = 0;
Pwm2_green = 0;
Pwm1_red = 0;
Pwm2_red = 0;
/*The following code will check to make sure the IR sensor is not malfunctioning, 
or it is not disconnected, as no more than one button can be triggered at a time.*/
mode = 0; //If there is no signal from the IR board later in the code, then disable the robot
irerror = 1;
if ((rc_dig_in03 + rc_dig_in04 + rc_dig_in05 + rc_dig_in06) < 3) 
{ 
	irerror = 0; //Tells the disable program that there is no error detected
	if (rc_dig_in03 == 1)
	{
		modea = 1;	//Set to Mode 1 (1st button)
	}
	if (rc_dig_in04 == 1)
	{
		modea = 2;	//Set to Mode 2 (2nd button)
	}
	if (rc_dig_in05 == 1)
	{
		modea = 3;	//Set to Mode 3 (3rd button)
	}
	if (rc_dig_in06 == 1)
	{
		modea = 0;	//EMERGENCY STOP (4th button)
	}
	mode = modea;
}
//The following are the certain autonomous programs
//Each mode acts like a different program.  

if (mode == 1) //Mode 1
{
	printf("Mode 1 %d\r");
	Switch1_LED = 1;
//Put your custom programming here, this will execute when the first button is pressed			
}




if (mode == 2) //Mode 2
{
	printf("Mode 2 %d\r");
	Switch2_LED = 1;
//Put your custom programming here, this will execute when the second button is pressed
}





if (mode == 3) //Mode 3
{
	printf("Mode 3 %d\r");
	Switch3_LED = 1;
//Put your custom programming here, this will execute when the third button is pressed
}

 


//Leave the following code at the very end of the autonomous cycle, so it is sure to execute when and if it is needed.
if (mode == 0) //EMERGENCY STOP
{
	printf("Mode: Disabled %d\r");
	pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
  	pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
	relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
	relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
	relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
	relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;	
	//The following code shows all the red lights
	//on the OI to tell the drivers that the autonomous
	//has been disabled
	Pwm1_red = 1;
	Pwm2_red = 1;
	Relay1_red = 1;
	Relay2_red = 1;
	if (irerror == 1) //If the IR has an error, then flash
	{
		printf("IR Sensor Problem, Check connection %d\r");
		errorloop++;
		if (errorloop > 5)
		{
			Pwm1_red = 0;
			Pwm2_red = 0;
			Relay1_red = 0;
			Relay2_red = 0;
		}
		if (errorloop > 9)
		{
			errorloop = 0;
		}
	}
}
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #3   Spotlight this post!  
Unread 03-02-2008, 14:45
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: Danger in Disconnected IR Receiver

knowing about all the IR jamming etc, i'm almost thinking about not even using IR, but instead doing some kind of deak-reckoning autonomous code, where the IR only modifies what it does. Teams (IMHO) who are thinking of doing teleoperated-like handling with a TV remote should seriously reconsider. I can only imagine the damage some teams will cause because of a robot going out of control because another robocoach is on the same frequency and their robot picks it up....
__________________


  #4   Spotlight this post!  
Unread 03-02-2008, 15:27
Samuel H. Samuel H. is offline
Registered User
no team
 
Join Date: Dec 2005
Rookie Year: 1000
Location: World
Posts: 40
Samuel H. has a spectacular aura aboutSamuel H. has a spectacular aura about
Re: Danger in Disconnected IR Receiver

Thank you for posting the code to help other teams. Just a quick quibble: the line 'printf("Mode 1 %d\r");' does not do what you want as there is no value to substitute for '%d'. You probably meant 'printf("Mode 1\r");'.

Thank you again and good luck.
  #5   Spotlight this post!  
Unread 05-02-2008, 22:05
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Danger in Disconnected IR Receiver

You're right... I'm still new to programming. It doesn't hurt the code at all to have it there, it will only clean it up by taking it out. Thanks for the suggestion.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #6   Spotlight this post!  
Unread 05-02-2008, 22:09
blaxbb blaxbb is offline
Ohio State Engineering Scholar
AKA: Brian Barrett
FRC #2331
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Vernon, New Jersey
Posts: 131
blaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really nice
Re: Danger in Disconnected IR Receiver

wow nice catch

every team make sure you have safe code, so a robot doesn't go flying out of the pits (dragging the OI behind)
__________________
"Whether you think you can or think you can’t, you’re right." - Henry Ford
www.vthsrobotics.org
  #7   Spotlight this post!  
Unread 06-02-2008, 07:49
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Danger in Disconnected IR Receiver

I'm designing IR capability into the code but I'm not counting on it. The last time IR was involved in the game (2004) it was pretty much a failure. If I didn't see IR for another four years it would be okay with me.

Yes, pun intended.
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
  #8   Spotlight this post!  
Unread 06-02-2008, 07:56
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Danger in Disconnected IR Receiver

Ditto on having it ready but not counting on it. I think it's going to be a bunch of jumbled IR by the time it reaches the robots with so many remotes/bright stage lights pointed all over the place. Ours stops working if we just shine a flashlight somewhere near it, let along one of those tens of spotlights FRC puts on the field. Also, if two remotes are pointed somewhere near the reciever, this also makes it stop working.

Putting a tube on it to confine the beam again renders it almost useless, since you have to have your robot essentially pointing right at you for it to work, and the point of the remote anyhow is to (perhaps) guide the robot back to straight from a misalignment... so you might not get any signal in the first place.

*sigh* but that's ok... that adaptive cruise control's starting to work miiiighty good....

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
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
Reliable way to detect disconnected controller heydowns Control System 4 13-02-2007 08:30
Possible danger using default camera code Mike Programming 3 07-02-2006 23:28
Team in Danger! Jill1022 General Forum 36 13-01-2006 00:57
Please help a class in danger! MattK Chit-Chat 0 12-12-2005 20:40
FIRST in Danger Robocardgrl5 General Forum 49 29-07-2003 13:45


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

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