Go to Post My wife just looked over my shoulder, shook her head, and said "Only engineers...." - Tom Line [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 27-01-2007, 11:56
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Autonomous Mode

We are having a problem. When we uncomment the Default_Routine our drives will not work in auto mode. But it will work with the joystick. If we leave it commented out, it will work in auto mode to drive the wheels, but the joystick will not drive the wheels when we come out of auto mode. Are we missing something?

Also, does anyone know the PWM outputs for the pan and tilt server in Kevin's "bells and whistles" 2.1 code? Is it the same as 2.0?
  #2   Spotlight this post!  
Unread 27-01-2007, 12:23
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
Re: Autonomous Mode

You aren't trying to use default_routines in autonomous are you? That might do it.
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.
  #3   Spotlight this post!  
Unread 27-01-2007, 12:45
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: Autonomous Mode

Explain further please. All we did was comment out the default routine in the users_routines.c file.
  #4   Spotlight this post!  
Unread 27-01-2007, 13:12
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
Re: Autonomous Mode

What do you have for autonomous code? There is no default autonomous. Anything you see there when you get the code should not be deleted. The Default_Routines function cannot be used in autonomous, due to its nature of interfacing with the joysticks and user input. Calling this function during autonomous is bad.

The default_Routines implementation is commented out for safety reasons. Scour the comments until you see the comment describing this, and follow the instructions. Un-commenting the function worked for us...

I can't comment further until I know the nature of your autonomous code. This seems to be a code problem.

When you say "our drives", do you mean the pwm motors? All input from the user is disabled during autonomous to keep to its namesake.
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.

Last edited by xrabohrok : 27-01-2007 at 13:15.
  #5   Spotlight this post!  
Unread 27-01-2007, 15:08
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: Autonomous Mode

Yes, we mean our drives. Example of our Auto mode:

{
if(Get_Tracking_State() == TARGET_IN_VIEW) /* make sure camera is tracking */
{
if(((((int)PAN_SERVO - 124) * 65)/124) > 20) /* check current pan servo position. 0 > is right, 0 < is left */
{
pwm15 = 167; /* do a left turn */
pwm13 = 87;
}
else if(((((int)PAN_SERVO - 124) * 65)/124) < -20)
{
pwm15 = 87; /* do a right turn */
pwm13 = 167;
}
else
{
pwm13 = 167;
pwm15 = 167;
}
}

This will work fine in Auto Mode (camera tracks, drives work perfectly) when we comment out the Default_Routine in user_routines.c file to look like this (// Default_Routine). Then when we try to use the joysticks after auto mode we cannot. If we go to user_routines.c file and uncomment out the Default_Routine this does not work and the joysticks work perfectly. What are we missing? Thanks for your help. If you don't want to put code on here send me a private message and we can talk that way. Thanks....
  #6   Spotlight this post!  
Unread 27-01-2007, 17:49
ace123's Avatar
ace123 ace123 is offline
Registered User
AKA: Patrick Horn
FRC #0008 (Paly Robotics - http://robotics.paly.net/)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Palo Alto, CA
Posts: 50
ace123 has a spectacular aura aboutace123 has a spectacular aura about
Send a message via AIM to ace123
Re: Autonomous Mode

Your problem may be that you are using PWMs 13-16 but are not generating the PWM signals for those ports.

If you are using Kevin's 2007 code, you must call the PWM(pwm13, pwm14, pwm15, pwm16) function as the very last line, just before the PutData() line.

If you are using IFI's code, you must call Generate_Pwms(pwm13, pwm14, pwm15, pwm16) in that place.

make sure you are using the correct PWM function. I would say for debugging purposes to use PWM's 9-12 or something like that, to make sure that it in fact is not the generated pwms that are the problem.

There could be many other problems as well... unfortunately I can't think of much else without seeing your entire loop in your Autonomous_Routine()
__________________
-Patrick Horn, Paly Robotics

Check out the space simulator called Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played Wing Commander, or especially Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods: Privateer Gemini Gold and Privateer Remake!
I'm working on adding multiplayer support this year...
  #7   Spotlight this post!  
Unread 27-01-2007, 23:03
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,856
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
Re: Autonomous Mode

It sounds like you're executing your autonomous code and immediately following with Default_Routine() in user_routines.c. The last one to be executed will set your pwm outputs and win.

How are you entering Autonomous mode?
Via a Competition Port dongle or one of the other possible methods?

Where have you placed your autonomous code?
In user_routines_fast.c's User_Autonomous_Code()?
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #8   Spotlight this post!  
Unread 28-01-2007, 12:19
Render Render is offline
Registered User
AKA: Robert Udicious
FRC #1885 (Robocats)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Haymarket, Virginia
Posts: 18
Render will become famous soon enoughRender will become famous soon enough
Re: Autonomous Mode

A much cleaner way to do that (and more precise) would be to have a proportional algorithm and as the degree value gets closer to 0 move less, farther from 0 moves more, etc.
  #9   Spotlight this post!  
Unread 28-01-2007, 12:41
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: Autonomous Mode

Mark...
How are you entering Autonomous mode? We are entering the Auto mode in user_routines_fast.c where they tell us to enter our code.
Via a Competition Port dongle or one of the other possible methods? Dongle switch....

Where have you placed your autonomous code? answered above.
In user_routines_fast.c's User_Autonomous_Code()? Yes...

Everything works perfectly in Auto mode, but when we come out of Auto mode the drives don't work with the joysticks???....

Thanks for the help....
  #10   Spotlight this post!  
Unread 28-01-2007, 12:50
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: Autonomous Mode

Also, if I go to the user_routines.c file and change the line:

pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
to
pwm13 = Limit_Mix(2000 + p1_y + p1_x - 127);

pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
to
pwm15 = Limit_Mix(2000 + p1_y - p1_x + 127);

This change causes the auto mode to work, but the joysticks do not. Remember the drives are wired to pwm13 and pwm15.... Looks like this should have nothing to do with it????
  #11   Spotlight this post!  
Unread 28-01-2007, 12:51
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Autonomous Mode

Do you have the joysticks mapped to the correct PWM outs?
__________________
  #12   Spotlight this post!  
Unread 28-01-2007, 15:39
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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,856
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
Re: Autonomous Mode

Do i understand correctly that you started with Kevin Watson's "bells and whistles" 2.1 code?

Used as is there seem to be conflicting calls to set PWMs 13,14,15,16 mixing a new method Kevin's introduced with an older unreliable method. Just an oversight.

In User_Autonomous() replace:
Code:
        Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
with
Code:
 PWM(pwm13,pwm14,pwm15,pwm16);
P.S. You also need to add #include "pwm.h" to user_routines_fast.c


There is also some extra code you should probably comment out in Default_Routine() just before pwms13,14,15,16 are set:
Code:
  p1_x = 255 - p1_y;
  p1_y = 255 - pwm05;

You might also try testing your output on pwms other than 13-16.

P.S. Remember you have to copy the camera calls from user_routines.c into your autonomous routine to keep the camera running during autonomous.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-01-2007 at 08:26.
  #13   Spotlight this post!  
Unread 28-01-2007, 16:22
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Autonomous Mode

Quote:
Originally Posted by Mark McLeod View Post
...There is also some extra code you should probably comment out in Default_Routine() just before pwms13,14,15,16 are set:
Code:
  p1_x = 255 - p1_y;
  p1_y = 255 - pwm05;
Yeah, this is pretty knuckle-headed. Before I call IFI, has anyone asked them why they added this "feature"?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #14   Spotlight this post!  
Unread 28-01-2007, 18:46
Slick Slick is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Martinsville, VA
Posts: 21
Slick is an unknown quantity at this point
Re: Autonomous Mode

Thanks Mark. I'll try this when I get my hands on the robot. I'll let you know if it works. I agree with you Kevin, this really through us for a loop. (No pun intended....) Thanks again guys....
  #15   Spotlight this post!  
Unread 29-01-2007, 01:44
DylanRoss DylanRoss is offline
Registered User
FRC #1987
 
Join Date: Jan 2007
Location: Lee's Summit, MO
Posts: 4
DylanRoss is an unknown quantity at this point
Re: Autonomous Mode

Quote:
Originally Posted by Kevin Watson View Post
Yeah, this is pretty knuckle-headed. Before I call IFI, has anyone asked them why they added this "feature"?

-Kevin
I've had TONS of trouble trying to figure out how their one-joystick drive code works. Our robot won't drive correctly if I take that bit out (because of the way one motor is mounted "backwards"), but in all the testing I do on the computer, the numbers come out way wrong.

Commenting out those two lines shouldn't change anything, should it? Because it keeps me from driving...
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
Autonomous Mode tysonwormus Rumor Mill 11 08-01-2004 22:59
Autonomous mode AntmanIV General Forum 1 17-02-2003 13:30
autonomous mode Stephanie Programming 2 25-01-2003 19:57
Autonomous Mode David Bryan Programming 1 21-01-2003 21:15
autonomous mode? bigwalt Technical Discussion 1 21-01-2003 01:14


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

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