Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Autonomous Mode (http://www.chiefdelphi.com/forums/showthread.php?t=52869)

Slick 27-01-2007 11:56

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?

xrabohrok 27-01-2007 12:23

Re: Autonomous Mode
 
You aren't trying to use default_routines in autonomous are you? That might do it.

Slick 27-01-2007 12:45

Re: Autonomous Mode
 
Explain further please. All we did was comment out the default routine in the users_routines.c file.

xrabohrok 27-01-2007 13:12

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.

Slick 27-01-2007 15:08

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....

ace123 27-01-2007 17:49

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()

Mark McLeod 27-01-2007 23:03

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()?

Render 28-01-2007 12:19

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.

Slick 28-01-2007 12:41

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....

Slick 28-01-2007 12:50

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????

DanDon 28-01-2007 12:51

Re: Autonomous Mode
 
Do you have the joysticks mapped to the correct PWM outs?

Mark McLeod 28-01-2007 15:39

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.

Kevin Watson 28-01-2007 16:22

Re: Autonomous Mode
 
Quote:

Originally Posted by Mark McLeod (Post 566928)
...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

Slick 28-01-2007 18:46

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....

DylanRoss 29-01-2007 01:44

Re: Autonomous Mode
 
Quote:

Originally Posted by Kevin Watson (Post 566950)
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...


All times are GMT -5. The time now is 04:05.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi