Go to Post Brandon, it's not an issue... but the fortune cookie thing that you get when you give someone rep is a little creepy... - Beth Sweet [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 17-02-2002, 21:50
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Need help with 255 Variable

I know never to allow a pwm to reach or exceed 255 due to the serout command. However can I create a variable and allow that variable to exceed 255? Also do i need to assign it as a word instead of a byte to allow it to work?

The reason i need this is for the pump delay I created. It currently uses 2 variables which both max out at around 240. The way its set up it gives me 11 seconds between times the pump cycles. The problem is I only lose 3psi in 11seconds from full (115 psi). I want to increase the delay without adding a 3rd variable.

Another question... With my current code the pump doesn't turn on until 11 seconds into the match (due to the variables counting up). Is there a way to start the variables at a certain value other than zero so that the pump turns on right away and then returns to its normal delay cycle?
__________________
One Team, One Bot, One Fleet of Ambulances!
  #2   Spotlight this post!  
Unread 18-02-2002, 00:30
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
You don't need to create a variable that's a word. If all you need is a counter, you can simulate a word with 2 bytes. You'll be able to count up to 65536.

pseudocode:

byte i, j

i = 0
j = 0


main loop:

if (i < 255)
{
i++
}
else
{
i = 0
j++
}

Mike
  #3   Spotlight this post!  
Unread 18-02-2002, 09:00
Unsung FIRST Hero
Nate Smith Nate Smith is offline
FRC Key Volunteer Trainer
AKA: CrazyNate
no team
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Old Town, Maine
Posts: 1,029
Nate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to beholdNate Smith is a splendid one to behold
Send a message via AIM to Nate Smith Send a message via Yahoo to Nate Smith
Re: Need help with 255 Variable

Quote:
Originally posted by Joseph F
I know never to allow a pwm to reach or exceed 255 due to the serout command. However can I create a variable and allow that variable to exceed 255? Also do i need to assign it as a word instead of a byte to allow it to work?
1. If you're exceeding 255 in any variable and don't want loss of data to occur, it needs to be a word variable.

2. The RC itself can handle any PBasic supported type of variable in your code. Where you run into the problem is if you try to put that variable in Serin or Serout. So, if the variable in question is in neither of these lines, you can do whatever you want with it.
__________________
Nate Smith
nsmith@smythsoft.com
12 seasons, 4 teams, and more time logged behind the scorekeeper's table than I care to remember...
returning for 2011? only time will tell...
  #4   Spotlight this post!  
Unread 18-02-2002, 09:09
JHBurch JHBurch is offline
Registered User
#0045 (TechnoKats)
 
Join Date: Nov 2001
Location: Kokomo, IN
Posts: 10
JHBurch is an unknown quantity at this point
>...can I create a variable and allow that variable to exceed 255? Also do i need to assign it as a word instead of a byte to allow it to work?

Never increment a byte variable past 255. If you do it will wrap around, i.e. 255+1=0. If you need to hold a larger number, declare it as a word. This lets you count up to 65535 before wrapping around to zero. One variable declared as a word takes up exactly the same amount of variable space as two variables declared as bytes.

If this still isn't enough, you can add a bit or two from another variable that you're not using all of. For example if you're using a byte variable for something that never gets higher than 15, declare it as a nibble instead (4 bits) and then use the other half of the byte to extend your count. Each added bit doubles how high you can count, but you'll have to increment it manually when you detect that your word variable is going to roll over.

>The reason i need this is for the pump delay I created.

Isn't there a pressure switch in the kit that you can feed back into one of the digital or analog inputs? Maybe someone else can add more details on this approach.

>Is there a way to start the variables at a certain value other than zero so that the pump turns on right away and then returns to its normal delay cycle?

Yes. Before your main loop you can initialize the variable to one less than the max number, that way the next time it gets incremented you'll turn on your pump and reset the count back to zero. Just make sure that the initialization statement is BEFORE "MainLoop:".
__________________
Jeff Burch
TechnoKats #45
  #5   Spotlight this post!  
Unread 18-02-2002, 22:15
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Thanks... heres what I did

Thanks everyone for your speedy replies. I'll post what I did so that anyone else with a similar question or whoever is curious can see the program.

After posting I went into the stamp editor and created a test program. I checked back today for the answers and then double checked my program. I finally ended with...

in the Declare Variables Section
longpump Var word 'pneumatic pump delay


in the Initialize Inputs & Outputs Section
longpump = 870

Below the PWM Output Section I created a new Pnuematic Pump Delay Section In it read:

longpump = longpump + 1
if rc_sw1 = 0 then nopump
if p4_sw_aux1 = 1 then pumpon 'pump turns on when pneumatics fired
if p4_sw_aux2 = 1 then pumpon 'pump turns on when pneumatics fired
if longpump < 900 then waitpump
if longpump > 799 then pumpon
nopump:
longpump = 0
waitpump:
relay6_fwd = 0
relay6_rev = 0
goto pumpdone
pumpon:
longpump = 810
relay6_fwd = 1
relay6_rev = 0
pumpdone:


Since the delay was so long I added a feature that would automatically turn the pump on whenever I fired the cylinders. FYI our system only leaks about 3psi every 20-30 seconds which is why I needed such a large delay.. I may make it even larger.

My old code for anyone interested used variable coun and pump (both bytes) and read

'coun = coun + 1
'if rc_sw1 = 0 then pump_off
'if coun < 220 then pump_off2
'if coun < 250 then pump_on
'pump_off:
'coun = 0
'pump = 0
'pump_off2:
'relay6_fwd = 0
'relay6_rev = 0
'goto nextstep
'pump_on:
'pump = pump + 1
'if coun < 235 then extr1
'coun = coun - 1
'extr1:
'if pump < 220 then nextstep
'relay6_fwd = 1
'relay6_rev = 0
'coun = coun - 1
'pump = pump - 1
'nextstep:

(of course without the ' marks). It took the same amount of variable space but gave a much smaller maximum pump delay (only 11 seconds as set up, max of roughly 15-20 seconds)
__________________
One Team, One Bot, One Fleet of Ambulances!
  #6   Spotlight this post!  
Unread 18-02-2002, 22:17
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
i forgot to add. both these programs are tested and work as they are written in the manner in which they were intended. I have yet to find errors in either. (although there may be better ways of doing it).
__________________
One Team, One Bot, One Fleet of Ambulances!
  #7   Spotlight this post!  
Unread 23-02-2002, 23:55
kmcclary's Avatar
kmcclary kmcclary is offline
Founder 830/1015;Mentor 66/470/1502
FRC #0470 (Alpha Omega Robotics)
Team Role: Engineer
 
Join Date: Aug 2001
Rookie Year: 1994
Location: Ann Arbor, MI
Posts: 491
kmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond repute
Hardware solution is easier

OOC, Why are you using the delay method? We're given TWO sensors in this year's kit. You use both, and tie them to a pair of input bits. Simply set one to the high shutoff value you wish, and the other to the low turn on value.

Now your code is a couple line hysteresis routine, and you're done!

The code for this was given both in several threads here, as well as in one of the team updates.

- Keith McClary, Advisor, Huron High 830 Rat Pack
__________________
Keith McClary - Organizer/Mentor/Sponsor - Ann Arbor MI area FIRST teams
ACTI - Automation Computer Technologies, Inc. (Sponsoring FIRST teams since 2001!)
MI Robot Club (Trainer) / GO-Tech Maker's Club / RepRap-Michigan) / SEMI CNC Club
"Certifiably Insane": Started FIVE FRC teams & many robot clubs (so far)!
2002: 830 "Rat Pack" | 2003-5;14: 1015;1076 "Pi Hi Samurai" | 2005-6: 1549 "Washtenuts"/"Fire Traxx"
2005-(on): 1502 "Technical Difficulties" | 2006-(on): FIRST Volunteer!
2009-(on): 470 "Alpha Omega" | WAFL | Sponsor & "Floating Engineer" for MI Dist 13 (Washtenaw Cnty)
2011: 3638 "Tigertrons" | 2013-(on): 4395 "ViBots" | 2014-(on) 66 "Grizzlies"
"Home" Teams: 66, 470, 1076, 1502, 4395
Local FIRST alumni at or coming to Ann Arbor (UM/EMU/WCC/Cleary)?
...We Want YOU as a Mentor! Please email me for info!
Support CDF Reputation - If a posting helped, thank 'em with rep points!
"It must be FRC build season when your spouse and children become 'Action Items 8 & 9'..."
  #8   Spotlight this post!  
Unread 24-02-2002, 04:15
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
One team near mine only got one pressure switch, so I helped them with a timer.

It sounds like the thread was started by some one using the pressure switch to turn off the compressor. What happens if you have a little leak and never get that high a pressure ?

Perhaps you should readjust the switch to turn _on_ the compressor at some user-selected lower pressure, and use the software timer to turn it back off. That way, if your pump can get the pressure above the low set point, the pump will turn off sometime, and you'll still have some pressure.
  #9   Spotlight this post!  
Unread 24-02-2002, 07:12
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Quote:
It sounds like the thread was started by some one using the pressure switch to turn off the compressor. What happens if you have a little leak and never get that high a pressure ?
Yes. I am using the switch to turn off the compressor. We don't have any trouble with leaks in our system currently, in fact it takes us roughly 20-30 seconds to lose 3 psi due to leaks. The compressor can easily overcome that to fill the system. Plus if we do use the pressure switch to turn on the compressor and a timer to turn it off, what happens if we misjudge the timer? The system will go above 120psi and the safety valve will pop (and i believe the valve is a one-use valve). I may be wrong about the valve, but thats my current understanding.

Quote:
OOC, Why are you using the delay method? We're given TWO sensors in this year's kit. You use both, and tie them to a pair of input bits. Simply set one to the high shutoff value you wish, and the other to the low turn on value.
Sodder breaks, programs don't. I am worried with 2 switches that its twice as much sodder that can come lose and cause a wire to slip out messing up the system. In a 2 switch system if the high switch loses connection the system will cycle at the low pressure. If the low switch loses connection the pump will cycle at the high pressure. This can overheat the pump and kill the battery very quickly. In a single switch system if the switch loses connection the pump shuts off. While this does lose all our pneumatics for that round, we aren't totally dependent on them and can do quite a bit without them.
__________________
One Team, One Bot, One Fleet of Ambulances!
  #10   Spotlight this post!  
Unread 24-02-2002, 09:25
thedillybar thedillybar is offline
Registered User
#0894 (Chargers)
 
Join Date: Jan 2002
Location: Flint, MI
Posts: 56
thedillybar is an unknown quantity at this point
Send a message via AIM to thedillybar
If you exceed 120 psi, the valve starts leaking. When you drop back under 120, the valve closes again.
  #11   Spotlight this post!  
Unread 24-02-2002, 15:07
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Quote:
If you exceed 120 psi, the valve starts leaking. When you drop back under 120, the valve closes again.
thanks for the clarification.
__________________
One Team, One Bot, One Fleet of Ambulances!
  #12   Spotlight this post!  
Unread 24-02-2002, 16:26
kmcclary's Avatar
kmcclary kmcclary is offline
Founder 830/1015;Mentor 66/470/1502
FRC #0470 (Alpha Omega Robotics)
Team Role: Engineer
 
Join Date: Aug 2001
Rookie Year: 1994
Location: Ann Arbor, MI
Posts: 491
kmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond repute
Quote:
Originally posted by Lloyd Burns
One team near mine only got one pressure switch, so I helped them with a timer. [...] What happens if you have a little leak and never get that high a pressure?
If the leakage is THAT bad, you've got OTHER problems! But to answer your question, the compressor keeps running, and the overpressure valve keeps you limited to 120psi. In any case, two minutes of the compressor running and popping the safety valve isn't going to kill you, nor your battery.

Quote:
Perhaps you should readjust the switch to turn _on_ the compressor at some user-selected lower pressure, and use the software timer to turn it back off. That way, if your pump can get the pressure above the low set point, the pump will turn off sometime, and you'll still have some pressure.
Now it DOES makes sense to use a timer as a failsafe, but it is really not necessary for normal operation. You can simply limit the maximum on time of the pump for any one "air request" and lock it off until either a pressure switch toggles, or a driver "manually override resets it" by some action on the OI such as running an unused thumbwheel up and down once.

Quote:
Originally posted by Joseph F
[Solder] breaks, programs don't.
LOL! You never heard of a program breaking under "unexpected conditions"??? It's called a "bug". (Maybe he's never programmed, nor tried to run a Microsoft product before... ). Seriously though, in industry we more often use HARDWARE to protect us from SOFTWARE bugs than the other way around! Most of the time for cost savings Consumer software only does "sanity checks" to keep an eye on the hardware, and simply alerts the user to problems. In military and automotive programming though we do often spend the extra time, money, and effort to try to "program around failed hardware".

Quote:
{I'm worried about [solder] joints failing, and here are the failure modes} [...]
Actually, a good solder joint is VERY reliable, as long as you have a good mechanical initial connection before soldering, and strain relief on the harness. In fact, they'll normally far outlast the rest of the system (including the computer) by decades!

BTW... That's not how a two switch system works, nor how it would fail.

You have a one bit variable as a "memory", that decides if the pump should run or not. It will be sent to the pump control at the end of each main loop. For system insurance in case everything fails, you initially set it to ON in the initialization routine so in the absence of any other signal it tries to start up.

During the loop, the High switch turns the pump bit OFF when pressure EXCEEDS it's setpoint. The Low switch turns it ON when it drops BELOW its set point. Between it the "memory" keeps the same condition. This gives you your hysteresis. The Low and High switches are set at something like 110 and 120 PSI respectively, so if you have a failure mode that causes an oscillation around EITHER ONE, you're still fine.

Seriously though, you're talking only TWO solder joints per switch. That's EASY to inspect. You can use input bits on opposite ends of the connector if you're nervous. If you're uncomfortable soldering, just let someone who is used to doing it make the joints. Now for the switch, just make sure you add some lock washers under the switch screws, and that will be secure.

If I remember correctly, these are normally closed switches that open when you exceed the pressure on a diaphragm. Switches CAN fail open or closed mechanically, but the most likely failure mode will be open from a loss of a connection, with a failed closed condition from a diaphragm break in the switch running a FAR second place. These switches are designed for millions of operations, and the mechanics in them don't break often.
Shorted electrical connections would normally be obvious during testing.

Let's look at the failure modes:

CASE 1 - HIGH switch disconnects or fails OPEN: depending on which switch is checked first in your logic, the pump either never starts up, or the pressure oscillates around the low pressure switch's pressure. Assuming you've set the low switch to something like 110 PSI (10 PSI hysteresis), if it is oscillating around that value you've still got FULL pressure to do things because the rules say your pneumatics must run at 60 PSI max. However you ARE allowed to start with full pressure, so if you set the logic so that this mode causes full failure and this happened before the start of the round, you'd notice your pump wasn't running then and have a chance to fix it. If it happens DURING the round and your pneumatics are only used for deployment and not motion, then given enough air storage you may not even NOTICE things stopping! Either way, no robot damage.

CASE 2 - HIGH Switch shorts or fails CLOSED: The pump keeps running, and the safety valve keeps popping, limiting the pressure limited to 120 PSI. That is noticeable, but your robot keeps running just fine. This won't damage the pump. For two minutes, since it won't even stall the pump from overpressure, it probably won't even impact your battery significantly. No robot damage, and you keep running just fine.

CASE 3 - LOW Switch disconnects or fails OPEN: Depending on the logic, either the pump never starts up, or else you go up ONCE, but never turn back on again after the first fillup when the pressure comes down. Similar situation to Case 1.
No robot damage, and you may not even notice it at first.

CASE 4 - LOW Switch connection shorts or fails CLOSED: The pump will run up to the high pressure once, then oscillate around the high pressure switch. This case DOES use up more battery, but again you've got full pressure so the robot runs fine. As before, no damage, and this would be noticeable on the Tether so you can correct it for the next round.

NONE of these situations are destructive to the robot, and you can operate just fine in several of them. You can INSTANTLY tell which switch failed by the pressure it oscillates around, if it doesn't restart, or it doesn't shut off and pops the valve.

If you've added enough air storage, and only use the pneumatics for "deployment" instead of something cyclical like "walking", there's a good chance you may not even run out of air before the round ends.

I still feel two switches is MUCH simpler. However, I do like your concept of using timers to limit effects as a backup.

Of course if you wish (and are REALLY bored), you can always review each case, and create the logic to test and handle error cases. For example, if you see the LOW switch thinks the pressure is too low AND the HIGH switch thinks it is too high, something is not right. Watching which one the pressure toggles around tells you the OTHER switch failed, and you fall back to a timer method using the good switch. The two switches now gives you REDUNDANCY.

But that makes the whole simple thing complicated again! The point here is that using two switches is SIMPLE, and it won't damage anything in ANY of the failure cases.

If you are REALLY worried about an automatic pressure control failing, then simply give your driver an "override switch". You run a "monitor" timer in the RC, and have it turn on a driver's LED if the program thinks the pump "has run too long". The driver then has an ON/OFF/ON SPDT Override Switch for manual pump control. Run the center to ground, and each of the two ends to to an input bit on the OI. Center = "Automatic", up = Manual On, and down = Manual Off. You can also do this with an unused thumbwheel as well by dividing its possible position value into thirds.

- Keith McClary, Advisor Huron High 830 Rat Pack
__________________
Keith McClary - Organizer/Mentor/Sponsor - Ann Arbor MI area FIRST teams
ACTI - Automation Computer Technologies, Inc. (Sponsoring FIRST teams since 2001!)
MI Robot Club (Trainer) / GO-Tech Maker's Club / RepRap-Michigan) / SEMI CNC Club
"Certifiably Insane": Started FIVE FRC teams & many robot clubs (so far)!
2002: 830 "Rat Pack" | 2003-5;14: 1015;1076 "Pi Hi Samurai" | 2005-6: 1549 "Washtenuts"/"Fire Traxx"
2005-(on): 1502 "Technical Difficulties" | 2006-(on): FIRST Volunteer!
2009-(on): 470 "Alpha Omega" | WAFL | Sponsor & "Floating Engineer" for MI Dist 13 (Washtenaw Cnty)
2011: 3638 "Tigertrons" | 2013-(on): 4395 "ViBots" | 2014-(on) 66 "Grizzlies"
"Home" Teams: 66, 470, 1076, 1502, 4395
Local FIRST alumni at or coming to Ann Arbor (UM/EMU/WCC/Cleary)?
...We Want YOU as a Mentor! Please email me for info!
Support CDF Reputation - If a posting helped, thank 'em with rep points!
"It must be FRC build season when your spouse and children become 'Action Items 8 & 9'..."
  #13   Spotlight this post!  
Unread 24-02-2002, 19:07
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
Quote:
LOL! You never heard of a program breaking under "unexpected conditions"??? It's called a "bug". (Maybe he's never programmed, nor tried to run a Microsoft product before... ). Seriously though, in industry we more often use HARDWARE to protect us from SOFTWARE bugs than the other way around! Most of the time for cost savings Consumer software only does "sanity checks" to keep an eye on the hardware, and simply alerts the user to problems. In military and automotive programming though we do often spend the extra time, money, and effort to try to "program around failed hardware".
I wasn't talking about all programming. I'm talking specifically about the robot program. The conditions of the match shouldn't be far enough outside the realm of normal capabilities that it would cause the program to crash.


Quote:
Actually, a good solder joint is VERY reliable, as long as you have a good mechanical initial connection before soldering, and strain relief on the harness.
Given the specifics of the competition odds are a wire will be ripped off long before the program gets confused enough to crash. Plus we dont have anyone who actually 'knows' how to sodder propperly, so our joints are probably sub-standard.

Quote:
If you are REALLY worried about an automatic pressure control failing, then simply give your driver an "override switch".
I did program in an ovverride that turns the pump on whenever the pneumatics are fired. As for a manual on/off/auto switch its a good idea I hadn't concidered. I'll probably set up as much of it as I can until I actually get the robot back.

Quote:
You can also do this with an unused thumbwheel as well by dividing its possible position value into thirds.
A good idea, unfortunately our control board has all but 1 switch in use currently. I programmed in a turn corrector controlled by our last availible wheel (our robot turns right for some odd reason).

Quote:
Of course if you wish (and are REALLY bored), you can always review each case, and create the logic to test and handle error cases. For example, if you see the LOW switch thinks the pressure is too low AND the HIGH switch thinks it is too high, something is not right. Watching which one the pressure toggles around tells you the OTHER switch failed, and you fall back to a timer method using the good switch. The two switches now gives you REDUNDANCY.
wow. um. I am going through robot withdrawal currently but I havn't achieved that level of desperation just yet.... Actually its probably not as bad as it sounds, but of course this would assume I put in and soddered up the second switch. I might write the program for this eventually anyway, just for future refrence.

Thanks for all the help. I'll be printing out this thread eventually to keep all this usefull information.
__________________
One Team, One Bot, One Fleet of Ambulances!
  #14   Spotlight this post!  
Unread 24-02-2002, 20:52
kmcclary's Avatar
kmcclary kmcclary is offline
Founder 830/1015;Mentor 66/470/1502
FRC #0470 (Alpha Omega Robotics)
Team Role: Engineer
 
Join Date: Aug 2001
Rookie Year: 1994
Location: Ann Arbor, MI
Posts: 491
kmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond reputekmcclary has a reputation beyond repute
Quote:
Originally posted by Joseph F
The conditions of the match shouldn't be far enough outside the realm of normal capabilities that it would cause the program to crash.
I've never seen the robot program actually CRASH before. Stuck in infinite loops maybe, run out of time and miss a packet maybe, but have you actually had the computer CRASH on you?

What I'm talking protecting against in a program are LOGICAL errors. For example, if a timer variable is not checked correctly, it wraps around (overflow/underflow) forever and therefore never switches things to the next state.

Quote:
Given the specifics of the competition odds are a wire will be ripped off long before the program gets confused enough to crash.
Hmmm... Well, that may or may not be true, because boy oh boy, have I seen some real doozies that passes for "software" in my day... ... But, you've got a very good point that this IS a physical event and wiring COULD get ripped out. That's why we tried to run things where any Battle Bots present couldn't get at them. You'd have to break the chassis apart (or go at it with diagonal cutters in the cranny of some L-channel from the INSIDE of the robot) to get at some of our wiring.

Quote:
Plus we dont have anyone who actually 'knows' how to sodder propperly, so our joints are probably sub-standard.
Have your Electronics teacher check your work. If HE (or SHE) can't tell a good from a bad soldering joint, you've got OTHER problems at your school...

(BTW... it is "soldering", not "soddering"... )

Here are a few links for you on soldering to get you started:
http://www.circuittechctr.com/guides/7-1-1.htm
http://www.epemag.wimborne.co.uk/solderfaq.htm
http://www.aaroncake.net/electronics/solder.htm
There are lots more good references on the web. BTW, for practice, I'd recommend simply taking an old PCB and some wire out of some dead home electronics appliance or toy, and solder wires onto it anywhere until you're comfortable that you can attach and detach a wire cleanly to a board or a connector.

Quote:
I did program in an ovverride that turns the pump on whenever the pneumatics are fired.
What turns it off? Only time, or does it go back across the high pressure setting then run the clock again? BTW, watch out for the logical possibility of the pump trying to switch on from your override, then off because the high pressure switch has not responded yet due to lags and thinks it is still "at pressure now", then back on again once the pressure switch responds a fraction of a second later. That quick "ON/OFF/ON" cycling COULD stall the compressor if the back pressure is too great from the first short "on" burst.

Quote:
As for a manual on/off/auto switch its a good idea I hadn't concidered. I'll probably set up as much of it as I can until I actually get the robot back.
If we're allowed to do it NOW (are we?), I'd just recommend making a switch with a connector on it to plug in to an unused OI port (or if you don't have an unused one make a male & female "feed through" connector to stick in series with one of the current joystick connectors to tap off the AUX1 and AUX2 pins you need for the switch). I'm not sure if that is legal now that the six weeks is over. Someone please comment on that.

BTW, we planned ahead JUST for THIS kind of problem. Our auxilary control box brought out a LOT of extra signals "just in case". We're only using three of the ports, so we fanned out an ENTIRE port connector (4 pots and 5 bits) onto a terminal strip in our Aux box, so in case of emergencies like this one we already have extra controls available and wired at our panel, ready to instrument program fixes. If we need a new control at the contest site, we drop another pot or switch of the right type with short wires hanging off the back into the box panel, connect the wires to some unused bits on the terminal strip, label it in magic marker, and just USE it... NO soldering required. All of the rest of the current controls (other than Flightsticks) are also taken to lugs and a terminal strip inside the Aux box, with spare wire length, so we can move things around to reassign them to ANY aux channel, if necessary, in only seconds. Theoretically, other than punching the new hole for the control in the box, ANY control mods OR ADDITIONS should only take minutes on site.

Quote:
A good idea, unfortunately our control board has all but 1 switch in use currently. I programmed in a turn corrector controlled by our last availible wheel (our robot turns right for some odd reason).
You've used up ALL FOUR PORTS??? WOW! You must be controlling an OCTOPUS!

Does that include fanning out the extra pot and the two aux bits for the CH Flightsticks as well??? (A port has four pots and four digital bits, but a CH Flightstick only uses three pots and two of the bits). If so, that's a LOT of controls!!! (SIXTEEN pots and SIXTEEN bits!) If not though, you've got two extra bits and an extra pot available on EACH joystick that you can tap. Add an "inline feedthrough" connector (male/female pair) to a port which just brings each wire across to its counterpart for the original device plugged into it, and tap off whatever signal you need. FRCtech2002 ruled we can secure wiring with hot melt glue, so encase the entire thing in hot melt to form an insulator and make a "brick" out of it. Now you can tap into ANY unused signal pin without disturbing the thing orignally plugged into it.

Quote:
wow. um. I am going through robot withdrawal currently but I havn't achieved that level of desperation just yet....
<chuckle>...

Quote:
Actually its probably not as bad as it sounds, but of course this would assume I put in and soddered up the second switch. I might write the program for this eventually anyway, just for future refrence.
As I said, the program is already written for you in Team Update #5. It is only a TWO LINE program! (Plus a couple of aliases...) Just drop it in now, assign the right input bits for it, and comment it out for the time being so it's ready to roll if other things don't work out.

Quote:
Thanks for all the help. I'll be printing out this thread eventually to keep all this usefull information.
Hey, no problem! Although this is our team's first FIRST contest, I've been a professional programmer and a robotics hobbyist for a LOT of years. If there is anything else I can do to help, please feel free to drop me a line.

Later!

- Keith McClary, Advisor Huron High 830 Rat Pack
__________________
Keith McClary - Organizer/Mentor/Sponsor - Ann Arbor MI area FIRST teams
ACTI - Automation Computer Technologies, Inc. (Sponsoring FIRST teams since 2001!)
MI Robot Club (Trainer) / GO-Tech Maker's Club / RepRap-Michigan) / SEMI CNC Club
"Certifiably Insane": Started FIVE FRC teams & many robot clubs (so far)!
2002: 830 "Rat Pack" | 2003-5;14: 1015;1076 "Pi Hi Samurai" | 2005-6: 1549 "Washtenuts"/"Fire Traxx"
2005-(on): 1502 "Technical Difficulties" | 2006-(on): FIRST Volunteer!
2009-(on): 470 "Alpha Omega" | WAFL | Sponsor & "Floating Engineer" for MI Dist 13 (Washtenaw Cnty)
2011: 3638 "Tigertrons" | 2013-(on): 4395 "ViBots" | 2014-(on) 66 "Grizzlies"
"Home" Teams: 66, 470, 1076, 1502, 4395
Local FIRST alumni at or coming to Ann Arbor (UM/EMU/WCC/Cleary)?
...We Want YOU as a Mentor! Please email me for info!
Support CDF Reputation - If a posting helped, thank 'em with rep points!
"It must be FRC build season when your spouse and children become 'Action Items 8 & 9'..."
  #15   Spotlight this post!  
Unread 24-02-2002, 22:36
CaptainPlaid's Avatar
CaptainPlaid CaptainPlaid is offline
Registered User
#0314 (Megatron Oracles "Big MO")
 
Join Date: Jan 2002
Location: Flint, MI
Posts: 60
CaptainPlaid is an unknown quantity at this point
The auto/off/on option is a very good one. We have used it the past two years and it is very useful. I did it this year by using a two-position rotary switch for the Auto/Off selection. (The rotary switch was solely for looks. A toggle switch works fine.) Use a momentary pushbutton for the On function. This is useful if you lose a pressure switch (which I have never had happen) and also for testing things in the pits. If you are testing out the drive train and don't want your pump coming on every 20 seconds you can switch it to off. You will also want to use a momentary switch for the On function so you do not inadvertantly run the pump all the time. Check out our control system here. This is the code I use for the OI pump control:


if sw_pump_auto = 0 then end_override: 'OI Pump Switch set to Automatic (UP position)
if sw_pump_on = 1 then run_pump: 'OI Pump ON Override Switch is pressed

pump_on = 0 'OI Pump Switch is Off
goto end_override:

run_pump:
pump_on = 1
goto end_override:

end_override:



As far as one pressure switch or two we started this year with two and decided to go with one for weight. (Hey, 15 lbs over with cause desperate measures.) Regardless, we have noticed no change in performance. Here is the code we use for the one pressure switch control:



'Pressure Switch Program adapted from David Mittelman
'This program will allow us to bring the pressure up to 120psig
'and at the same time not overwork the pump
'For this program to work to variables need to be declared and have the following values:
'lastpressure = 1
'pneum_counter = 0

relay1_rev = 0

if pressure_115=0 then switchopen: 'Is the switch closed right now?
pump_on = 1 'compressor on
goto endroute: 'goto A
switchopen:


if lastpressure=0 then nochange: 'Was the switch closed before?
pneum_counter = 0 'reset counter
goto endroute: 'goto A
nochange:


if pump_on=0 then endroute: 'Is the compressor even on?
if pneum_counter < 220 then pumpitup: 'Is the counter equal to the time?
pump_on=0 'compressor off
goto endroute: 'goto A

pumpitup:
pneum_counter = pneum_counter + 1 'increments counter

endroute: 'A
lastpressure = pressure_115 'lastpressure = Switch value



I hope this helps. Any questions, post them here.
__________________
I have not failed. I have just found 10,000 ways that won't work.
Thomas Edison
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
Why can't you use 255 in PWM? Andrew Technical Discussion 4 29-05-2003 14:50
variable? manodrum Programming 11 01-04-2003 17:20
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
what teams have a variable transmissions? Greg Perkins Technical Discussion 4 06-03-2002 06:10
Pbasic argument question... Ghetto_Child Programming 10 18-02-2002 09:23


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

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