Go to Post Haha, I applaud your efforts to read into the actions of the GDC, but I feel like trying to do so is like shooting at a target, in the dark, at a mile away, with a sawed off shotgun. - ttldomination [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 14-04-2006, 00:11
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Can't get auto mode to run with OI switches

Hey all..

I have a potentiometer with detents that is mounted on the oi controller.

I have no idea whats going on.. I set up a static int newautoselect inside user_control.h,

int currentauto;

unsigned int autopos;
unsigned int temp_autopos;
int autocount;
autopos = p2_wheel;

autocount ++;

if(autocount >= 26)
{
autopos = currentauto;
}

if(currentauto > 20 | currentauto < 40)
{
newautoselect = 1;
}
else if(currentauto > 50 | currentauto < 60)
{
newautoselect = 2;
}
else if(currentauto > 100 | currentauto < 120)
{
newautoselect = 3;
}
else if(currentauto > 130 | currentauto < 150)
{
newautoselect = 4;
}
else if(currentauto > 160 | currentauto < 190)
{
newautoselect = 5;
}
else if(currentauto > 200 | currentauto < 250)
{
newautoselect = 6;
}

why doesnt auto mode pick this up?
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #2   Spotlight this post!  
Unread 14-04-2006, 00:15
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
Re: Can't get auto mode to run with OI switches

When the OI is switched into autonomous mode it no longer reads input from the joystick ports. All input values get zeroed (127 for analogs) until it is placed back into standard operating mode. What you'll want to do is read the input value only when the robot is not in auto mode, then evaluate it when the robot is. Otherwise it will always read 127 as the selector input, no matter what position it's in. Remember that the OI can receive input from the ports when the robot is disabled, which means that you will be able to set the autonomous mode selector at any point before the match begins.
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #3   Spotlight this post!  
Unread 14-04-2006, 00:41
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: Can't get auto mode to run with OI switches

Quote:
Originally Posted by kiettyyyy
I have a potentiometer with detents that is mounted on the oi controller.

I have no idea whats going on.. I set up a static int newautoselect inside user_control.h,

why doesnt auto mode pick this up?
Also, use "extern int newautoselect;" in the header,
and use "int newautoselect = 0;", outside of any routine,
in one of the files that the header is included in. If you
use "static int newautoselect;" in the header a different
instance of newautoselect is what you will get in each file the
header is included in and desired communication will not occur.
  #4   Spotlight this post!  
Unread 14-04-2006, 01:02
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Can't get auto mode to run with OI switches

You need to save the value of the OI reading the last cycle before you enter autonomous.

I recommend creating a char to hold the state of the OI input and updating it in Process_Data_From_Master_uP() as long as the autonomous_mode flag is not set.

Code:
unsigned char currentauto = 0; //Set outside function to make it global

void Process_Data_From_Master_uP(void)
{
	Getdata(&rxdata);

	if(!autonomous_mode)
		   currentauto = p2_wheel;

	// Remainder of function
}
Then in user_routines_fast you'll need:

Code:
extern unsigned char currentauto;
to access it.

The only thing, I'm not sure if the name of the flag (autonomous_mode) is right, I don't have code to reference at the moment.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #5   Spotlight this post!  
Unread 14-04-2006, 01:32
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Can't get auto mode to run with OI switches

Okay,

I just put in

Getdata(&rxdata);

if (!autonomous_mode)
{

blha blah blah;
the other stuff up there goes here!

}

See, i moved the int declarations and that other stuff.. and moved it up to the top of the user_routines.c

int currentauto;
int newautoselect;
unsigned int autopos;
unsigned int temp_autopos;
int autocount;



Now in user_routines_fast.c,

extern unsigned char currentauto;
extern unsigned char newautoselect;

WHAT IS WRONG!!?!?!
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #6   Spotlight this post!  
Unread 14-04-2006, 01:47
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Can't get auto mode to run with OI switches

Quote:
Originally Posted by kiettyyyy
...why doesnt auto mode pick this up?
First of all, comments by others above me certainly apply. However, there is a more fundamental problem:

Code:
	autopos = p2_wheel;

	autocount ++;

	if(autocount >= 26)
	{
		autopos = currentauto;
	}
autopos is set to p2_wheel and then set to currentauto which has never been set...

I believe that that (last) line should be "currentauto = autopos;"...

Regards,

Mike
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #7   Spotlight this post!  
Unread 14-04-2006, 02:03
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Can't get auto mode to run with OI switches

Okay,

Based on a if and elseif statement, the bot would read the potentiometer on the OI which is p2_wheel, called autopos.

Autopos is going to equal to currentauto within 26 ms. once that happens, current auto is compared using a little deadband then setting newautoselect.

newautoselect is now supposed to be pulled from the user_routines.c

now newautoselect is put into a little if and then and then the new auto mode is supposed to be selected.

Shouldnt that code already work?
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #8   Spotlight this post!  
Unread 14-04-2006, 09:16
Imajie Imajie is offline
Registered User
AKA: James Letendre
FRC #0195 (Cyber Knights)
Team Role: Electrical
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Southington
Posts: 114
Imajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud ofImajie has much to be proud of
Send a message via AIM to Imajie
Re: Can't get auto mode to run with OI switches

Quote:
Originally Posted by kiettyyyy
Hey all..

I have a potentiometer with detents that is mounted on the oi controller.

I have no idea whats going on.. I set up a static int newautoselect inside user_control.h,

int currentauto;

unsigned int autopos;
unsigned int temp_autopos;
int autocount;
autopos = p2_wheel;

autocount ++;

if(autocount >= 26)
{
autopos = currentauto;
}

if(currentauto > 20 | currentauto < 40)
{
newautoselect = 1;
}

why doesnt auto mode pick this up?
Wouldn't you want to use AND not OR because it would always evaluate as true with OR since it is either greater than 20 OR less than 40.
  #9   Spotlight this post!  
Unread 14-04-2006, 09:29
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Can't get auto mode to run with OI switches

Indirectly related, but you should also code for the in-betweens: What If currentautro were to evaluate at, say 45? At least trap and manage the error.

Don
__________________

I am N2IRZ - What's your callsign?
  #10   Spotlight this post!  
Unread 14-04-2006, 10:33
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Can't get auto mode to run with OI switches

Quote:
Originally Posted by Imajie
Wouldn't you want to use AND not OR because it would always evaluate as true with OR since it is either greater than 20 OR less than 40.
I second that. Also, if you are meaning to do a logical OR, you need to be using a double pipe (i.e ||) not a single (i.e. |). The single pipe represents a bitwise OR, which can give you drastically different results. If you switch over to the AND, make sure that you use a double ampersand (i.e. &&) for the same reason.

You can find more information about bitwise operations here
  #11   Spotlight this post!  
Unread 14-04-2006, 16:21
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Can't get auto mode to run with OI switches

Yeah.. I forgot about using &, the code has been replaced. I'm going to write the newautomode into the eraseable memory because im having SO much trouble with this.. Hopefully that would work.
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com
  #12   Spotlight this post!  
Unread 15-04-2006, 00:05
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: Can't get auto mode to run with OI switches

Quote:
Originally Posted by kiettyyyy
See, i moved the int declarations and that other stuff.. and moved it up to the top of the user_routines.c

int currentauto;
int newautoselect;
unsigned int autopos;
unsigned int temp_autopos;
int autocount;



Now in user_routines_fast.c,

extern unsigned char currentauto;
extern unsigned char newautoselect;

WHAT IS WRONG!!?!?!
You have a type miss-match between your extern declarations
and the definitions in user_routines.c You need them to be
consistent. If you put the extern declarations in a common header
file that is also included in user_routines.c the compiler will catch
this sort of error for you.
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
A statistical analysis of the "autonomous advantadge" Greg Marra General Forum 51 25-03-2006 21:09
Favorite Autonomous Mode George A. General Forum 49 12-05-2005 15:33
I fail to see the point.. randomperson Programming 14 27-03-2003 11:38
picking auto program Mike375 Programming 19 03-03-2003 15:47
Need help with 255 Variable Joseph F Programming 18 26-02-2002 14:49


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

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