Go to Post Im ready for anything. - davidthefat [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 05-02-2009, 14:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Limit Switchers Logic Problem

I didn't say to set the value to zero when limit was pressed. One limit switch forces positive motor input to zero but leaves negative alone, the other forces negative and leaves positive alone.

To handle the button toggles, I'd add a state variable. The buttons update the state variable, then the state variable selects positive, zero, or negative speed, then the limit switches pin as described above. The state variable obviously needs to be in either a shift register, a local, or something that maintains state data.

Greg McKaskle
  #2   Spotlight this post!  
Unread 05-02-2009, 15:17
Pasha Pasha is offline
Registered User
None #1403
 
Join Date: Jan 2008
Location: Ukraine
Posts: 8
Pasha is an unknown quantity at this point
Re: Limit Switchers Logic Problem

Quote:
Originally Posted by Greg McKaskle View Post
I didn't say to set the value to zero when limit was pressed. One limit switch forces positive motor input to zero but leaves negative alone, the other forces negative and leaves positive alone.

To handle the button toggles, I'd add a state variable. The buttons update the state variable, then the state variable selects positive, zero, or negative speed, then the limit switches pin as described above. The state variable obviously needs to be in either a shift register, a local, or something that maintains state data.

Greg McKaskle
But once the limit switch is pushed and it starts to feed positive values. It'll forever continue to force positive values. Even I press another button to go left, it won't because it'll be continuosly fed positive values.
  #3   Spotlight this post!  
Unread 05-02-2009, 15:38
Pasha Pasha is offline
Registered User
None #1403
 
Join Date: Jan 2008
Location: Ukraine
Posts: 8
Pasha is an unknown quantity at this point
Re: Limit Switchers Logic Problem

Hmm, is there anyway to set something just once. Like let's say the limit switch becoems true, is there a way to set motor speed to 0, ONCE, and not continuously locking up the device.

edit: @DarkOrono, I can't hold it. I need to be able to press and go. I cannot have it have the need to be held.

Last edited by Pasha : 05-02-2009 at 15:45.
  #4   Spotlight this post!  
Unread 05-02-2009, 15:47
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: Limit Switchers Logic Problem

What you want to do is:

- If no limit switches are pressed, do whatever the joystick says.
- if left limit switch is pressed, two cases:
a.If joystick wants to move lazy susan left, keep motors at 0.
b.If joystick wants to not move or move right(or the "else" case for a.), do as joystick wants.
- if right limit siwthc is pressed, two cases:
a.If joystick wants to move lazy susan right, keep motors at 0.
b.If joystick wants to not move or move left(or the "else" case for a.), do as joystick wants.
- if both limit switches are pressed ( ), stop motors - sirious error! (or someone is cheating )

There's a way where you can put all of these in one big case structe, and in each case ("true" and "false") have another case structre with "true" or "false".
__________________
TEAM 2230 ZECHARIA'S ANGELS

2009 Microsoft Israel FRC Regional Winners!
2009 Microsoft Israel FRC Regional Chairman's Award Winners!!!
---------------------------------
2008 Microsoft Israel FRC Regional semi-finalist.
2008 Microsoft Israel FRC Regional Delphi's "Driving Tommorow's Technology" Award winner.
2008 Robot Driver
---------------------------------
2007 GM/Technion Israel FRC Regional semi-Finalist.
2007 GM/Technion Israel FRC Regional Xerox Creativity Award winner.
2007 Robot Driver.
  #5   Spotlight this post!  
Unread 05-02-2009, 16:32
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Limit Switchers Logic Problem

Quote:
Originally Posted by Bomberofdoom View Post
What you want to do is:

- If no limit switches are pressed, do whatever the joystick says.
- if left limit switch is pressed, two cases:
a.If joystick wants to move lazy susan left, keep motors at 0.
b.If joystick wants to not move or move right(or the "else" case for a.), do as joystick wants.
- if right limit siwthc is pressed, two cases:
a.If joystick wants to move lazy susan right, keep motors at 0.
b.If joystick wants to not move or move left(or the "else" case for a.), do as joystick wants.
- if both limit switches are pressed ( ), stop motors - sirious error! (or someone is cheating )

There's a way where you can put all of these in one big case structe, and in each case ("true" and "false") have another case structre with "true" or "false".
This is exactly what the vi. I posted earlier in this thread will do. It does not do the button latching he is requesting, that will need to be defined prior to my vi.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #6   Spotlight this post!  
Unread 05-02-2009, 18:27
Pasha Pasha is offline
Registered User
None #1403
 
Join Date: Jan 2008
Location: Ukraine
Posts: 8
Pasha is an unknown quantity at this point
Re: Limit Switchers Logic Problem

What is button latching?

Also if you guys know how to just run a piece of code once, when a limit is pressed instead of continuously that would help.
  #7   Spotlight this post!  
Unread 05-02-2009, 20:41
DarKCroNo's Avatar
DarKCroNo DarKCroNo is offline
Registered User
FRC #2670
 
Join Date: Dec 2007
Location: Toronto
Posts: 37
DarKCroNo is an unknown quantity at this point
Re: Limit Switchers Logic Problem

OK so um heres the vis, but the vi is not complete to be able to use as a sub vi you have to do that wire thing for the block icon. Anyway the way i programmed it was at home so its not part of the robot coding, so using the switches on the front panel it'll simulate the desired affect.

Now to briefly describe wats going on... ( I don't have much time right now since i have 2 tests tommorow to study for, however if u have any problems just tell me and i'll reply later on)
okay so for the Toggle program

What I did was simply put a variable that is set to 1 while the button is pressed and then if pressed again it'll change to 0. So if the variable is 1 it'll do something and if the variable is 0 it'll do another task. Now if u imagine wat is going on, if the button is pressed the value is 1, so every millisecond it is pressed it'll continueally set it to 1 and than 0 than 1 than 0. To stop this i put a delay, meaning once u press the button u have to let it go after a certain time. Anyway to observe this, just like a joystick button, on the front panel when u run continuesilly you have to press the trigger and then press the trigger again so that the button simulates the joystick button being let go. Hopefully you can understand wat i said, so basically when u press the trigger u have to press it again right away so that u let go of the button. Now if done correctly u will see the motor value changing from 127 to 0 every time u do so. But there is a limitation to the programming, you must not hold the joystick button for any longer than the delay, if the button is kept held it will continually toggling between the 2 instructions. Now with regards to the limit switches, there is a way around this problem.

So with the gateway vi...
First a few things must be explained, for our mechanism we wanted a gateway to rise and fall so that the balls can be rolled out, and we wanted one button to do it. So for your purposes there is alot u'd need to change since u would want 3 different buttons. But first thing u need to understand is that if no limit switches are tripped than they will continually provide a True statement. So when u run continuesilly on the front panel u must set upper and lower limit on true. Now when the program runs, simply press the trigger and once again to simulate pressing a button. wat u will see is that the motor speed will be positive simulating that its raising. Now if u imagine the gateway touching a limit switch, the upper limit switch will be turned into false, so on the front panel u have to turn it off manually. Once that becomes tripped u will see the motor speed set to 0. Now if you were to press the trigger button again and once more to simulate the joystick button, you will see the motor speed will be negative which simulates the gateway moving downwards. Now if u imagine when the gate moves down, it will let go of the upper limit switch and so u must turn the upper limit back on manually, and so both limits will be true and than if u imagine as it continues to lower it will trigger the lower limit. So if u manually turn the lower limit to false u will see again the motor speed will become 0. you can continually do this and you will see you will get the desired affect so long as u can simulate wat is happening. Now to explain wat i meant of going around the delay problem, If you look at the coding I've set it so that once the trigger is turned on it will set the a variable to a value. Now i put an if statement if that variable is that value than it will do a task. The solution is that at the END of the task I reset the variable back to 0. This way instead of pressing the trigger again to set it to 0, it will be set back to 0 when the instructions are done.
I really hope u can understand what I've said, and I'm sure this is wat your looking for just if you cud get the front panel to work. The rest of the stuff for the gateway vi i can explain later if you want(like the block diagram stuff, because I don't really understand it very well, I started out well and kept getting errors, after alot of debugging it worked but I had to add a whole lot to make it work. So as a whole i cannot explain but parts i can.
Attached Files
File Type: zip Toggle and gateway.zip (37.3 KB, 31 views)
  #8   Spotlight this post!  
Unread 14-02-2009, 10:40
Pasha Pasha is offline
Registered User
None #1403
 
Join Date: Jan 2008
Location: Ukraine
Posts: 8
Pasha is an unknown quantity at this point
Re: Limit Switchers Logic Problem

Alright thanks a lot guys. A lot of your ideas helped us get stuff working. Your vis helped too with the range and conerce ideas. Eventually we got it working with the motors, now we just have to see it reacts on the robot.
Thanks again for your help, and input.
  #9   Spotlight this post!  
Unread 05-02-2009, 16:28
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Limit Switchers Logic Problem

I'll describe it again. One limit switch allows positive, but negatives are disallowed and are forced to zero. This means that once a limit switch goes true, it disallows further movement in one direct, but allows movement to unpress the limit.

Greg McKaskle
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
Fuzzy Logic? skidmarks NI LabVIEW 1 25-01-2009 09:36
Limit Switch Problem Boydean Programming 3 13-02-2008 16:32
Using a limit switch to limit motion ManicMechanic Programming 16 20-12-2007 00:54
Logic Question aubinhick990 Website Design/Showcase 2 11-03-2006 16:45
Why I hate Logic EnderofDragon Chit-Chat 2 19-02-2002 21:02


All times are GMT -5. The time now is 02:20.

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