Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   I have a quistion about stopping the autonomous mode... (http://www.chiefdelphi.com/forums/showthread.php?t=51039)

razer 06-01-2007 12:56

I have a quistion about stopping the autonomous mode...
 
Hello

At the beggining of every round we have 15 seconds of autonomous code, and it need to be stopped somehow... Right?
This is my question: How to stop it? should I write at the end of the autonomous code in the "user_routines_fast.c" under
"User_Autonomous_Code()" the next line:

autonomous_mode=0;

thanks a lot,
Nir.

teh_pwnerer795 06-01-2007 13:24

Re: I have a quistion about stopping the autonomous mode...
 
you dont need to stop the auto mode... when u are at the competition.. ur I/O controller is hooked up to their computer...and they'll switch it on... .. if the switch is on... then User_Autonomous_Code(void) will be running... if the switch is off... then the User_Autonomous_Code(void) will not be running...

on the I/O u can trigger auto mode by connecting pins 5 and 8, i believe, on the port called "competition"

let me noe if that helps u

Davx 06-01-2007 13:25

Re: I have a quistion about stopping the autonomous mode...
 
User_Autonomouse_Code() gets called every loop until the flag set by the Master Proc is unset. You don't need to worry about ending your mode, it is done for you by the function no longer being executed. Get_Data_From_Master_uP() in User_Routines.c will be called once autonomous mode is over.

razer 06-01-2007 13:43

Re: I have a quistion about stopping the autonomous mode...
 
ok thanks... so i just need to write my code, and it will be ended automaticly? i wont have to end it? ok... that really helps.

thanks again, Nir.

Alexa Stott 06-01-2007 14:13

Re: I have a quistion about stopping the autonomous mode...
 
For testing, you can just get a dongle to plug into the competition port on your Operator Interface to turn the autonomous mode on and off.

Davx 06-01-2007 15:04

Re: I have a quistion about stopping the autonomous mode...
 
IFI has the pinout for the competition port available Here (PDF), if you'd like to construct a dongle. We used a dongle on 195, but I've heard it's just as easy (in a pinch anyway) to stick a wire between the pins to access disable or autonomous mode.

razer: Are you familiar with how programming for the FRC works? it's loop-based, not like any entry-level desktop programming (Visual Basic, .Net, PHP) you might have done. The loop is called every 23.6ms (is about, it's been a while). so your code is executed every loop, and when autonomous mode is over, the loop is no longer called.

Alexa Stott 06-01-2007 15:05

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by Davx (Post 548988)
razer: Are you familiar with how programming for the FRC works? it's loop-based, not like any entry-level desktop programming (Visual Basic, .Net, PHP) you might have done. The loop is called every 23.6ms (is about, it's been a while). so your code is executed every loop, and when autonomous mode is over, the loop is no longer called.

So basically, refrain from using loops within your code. You will not get the intended results.

Davx 06-01-2007 15:08

Re: I have a quistion about stopping the autonomous mode...
 
Correct, you (almost) never want to use a while loop in your code, since that's not how the logic is setup. The program is based on each loop getting new data from the OI at the beginning, and setting the outputs at the END, and ONLY at the end. (Yes you could call putdata yourself, but lets not go there) A while loop will do nothing but lock up your program and eventually the watchdog timer will shut off the User proc and you'll get a code error indicator.

Davx 06-01-2007 15:15

Re: I have a quistion about stopping the autonomous mode...
 
razer et al: These programming PowerPoints explain some of the basic concepts of programming for the FRC. They are somewhat outdated as they seem to apply to the 2004 controller mostly, but the only real difference between the 2006/7 is a memory upgrade. These PowerPoints go through how the programming structure works, and some important things to know about.

charrisTTI 07-01-2007 16:57

Re: I have a quistion about stopping the autonomous mode...
 
Look in main.c to see how the switch from autonomous to operator control is performed.

jgannon 07-01-2007 17:05

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by Davx (Post 548988)
We used a dongle on 195, but I've heard it's just as easy (in a pinch anyway) to stick a wire between the pins to access disable or autonomous mode.

...but don't make a habit of doing it that way. Get a dongle. Build one yourself, or order Andymark's. The competition port is not fused, and some pins are connected directly to the processor in the OI. If you touch the wrong two pins together, you may damage the OI.

Davx 07-01-2007 19:35

Re: I have a quistion about stopping the autonomous mode...
 
Hence 'in a pinch.'

Astronouth7303 07-01-2007 21:53

Re: I have a quistion about stopping the autonomous mode...
 
main.c determines how the autonomous code and the user code is called.

The autonomous routine actually has it's own internal loop (at least it did previously). The key is that the loop calls getdata() and putdata().

If you're new to this, just stick with this: never use a for() or a while().

If you've done this before: use only very short (eg, to iterate through an array of 5) for() and while()'s.

If you know what you're doing: just ignore me and do your thing.

Davx 08-01-2007 15:30

Re: I have a quistion about stopping the autonomous mode...
 
Astronouth7303: You can use for() and while() loops much longer than 5 executions. The watchdog timer doesn't seem to fire for a good 10ms or so. You can loop through more than 300 elements and write strings for each of them before the RC will reset itself. I'd be interested in knowing what the actual timeout is, but I don't have access to an RC this year.

Astronouth7303 08-01-2007 16:44

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by Davx (Post 551292)
Astronouth7303: You can use for() and while() loops much longer than 5 executions. The watchdog timer doesn't seem to fire for a good 10ms or so. You can loop through more than 300 elements and write strings for each of them before the RC will reset itself. I'd be interested in knowing what the actual timeout is, but I don't have access to an RC this year.

Yes, I'm quite aware of that. See the third item.

kaszeta 08-01-2007 17:31

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by jgannon (Post 550165)
...but don't make a habit of doing it that way. Get a dongle. Build one yourself, or order Andymark's. The competition port is not fused, and some pins are connected directly to the processor in the OI. If you touch the wrong two pins together, you may damage the OI.

That, and a dongle is a good safety mechanism to have handy. We've had more than a few "runaway bots" during autonomous testing, especially when someone disconnected the shaft encoders while adjusting wiring.

Heck, I'm tempted to make a "deadman's switch" dongle for some of our tests.

Astronouth7303 08-01-2007 22:01

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by kaszeta (Post 551425)
That, and a dongle is a good safety mechanism to have handy. We've had more than a few "runaway bots" during autonomous testing, especially when someone disconnected the shaft encoders while adjusting wiring.

Heck, I'm tempted to make a "deadman's switch" dongle for some of our tests.

Need I mention When Robots Attack?

bobmonkey836 08-01-2007 22:42

Re: I have a quistion about stopping the autonomous mode...
 
assume the worst. include a deadmans switch on the controller, just in case. that way, if the program works, you smile!:D

drakesword 08-01-2007 22:59

Re: I have a quistion about stopping the autonomous mode...
 
I made it a general rule that loops are NOT allowed in our code. If a loop is messed up then you have big problems on your hand. Besides why have a loop inside a loop to do the same functions a state machine can do or a timer variable

razer 09-01-2007 14:10

Re: I have a quistion about stopping the autonomous mode...
 
Ok but How can I test it at school?

Alan Anderson 09-01-2007 16:07

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by razer (Post 552199)
Ok but How can I test it at school?

Use a "dongle" on the competition port of the Operator Interface. You can enable/disable the robot, and you can switch between autonomous and teleoperated mode.

http://www.ifirobotics.com/docs/comp...guide-reva.pdf

razer 10-01-2007 16:07

Re: I have a quistion about stopping the autonomous mode...
 
and where do i connect the "dongle"?
1 side to the Competition Port at the Operator Panel.

where to connect the other side?

Alan Anderson 10-01-2007 21:31

Re: I have a quistion about stopping the autonomous mode...
 
There is no other side. It plugs into the OI's competition port, period.

razer 11-01-2007 00:21

Re: I have a quistion about stopping the autonomous mode...
 
uh? what do you mean "no other side"? how deos this "dongle" looks like?
i think i found PDFs which explains more about the competition port, and it says i have to bring an On/Off switch, and to connect pin 5, 6, and 8 (on the competetion port) to the switch.

is this what you say?

Alan Anderson 11-01-2007 07:52

Re: I have a quistion about stopping the autonomous mode...
 
One switch between pins 5 and 8 selects autonomous mode when closed, the other switch between pins 6 and 8 disables the robot when closed. The third switch on the drawing does nothing unless you're using a pre-2005 control system. http://www.ifirobotics.com/docs/comp...guide-reva.pdf tells you what you need to know.

With a DB15P connector, two SPST switches, some wire, and a box to mount the switches on, you'll be able to make a very useful tool for testing and operating your robot.

Astronouth7303 11-01-2007 15:43

Re: I have a quistion about stopping the autonomous mode...
 
Quote:

Originally Posted by Alan Anderson (Post 553799)
One switch between pins 5 and 8 selects autonomous mode when closed, the other switch between pins 6 and 8 disables the robot when closed. The third switch on the drawing does nothing unless you're using a pre-2005 control system. http://www.ifirobotics.com/docs/comp...guide-reva.pdf tells you what you need to know.

With a DB15P connector, two SPST switches, some wire, and a box to mount the switches on, you'll be able to make a very useful tool for testing and operating your robot.

If you don't understand what that means, hand the drawing to your Electrical mentor and ask him/her to build it.

Or go to AndyMark.biz and buy theirs.


All times are GMT -5. The time now is 08:36.

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