Go to Post [A screen shot] is very helpful - I've sent Brandon many of those the various times I've broken ChiefDelphi.com! - Jessica Boucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-03-2013, 17:54
ChrisArmour ChrisArmour is offline
Registered User
FRC #3133
 
Join Date: Feb 2010
Location: scottsdale
Posts: 14
ChrisArmour is an unknown quantity at this point
Autonomous limit switch

I have been having trouble trying to make my autonomous work. The idea being that the shooter spin while our feeder will run three times. Going forward until hits limit switch then it will reverse until it hit seconds and stops, waits 2 seconds and repeats. Now I was able to get that to work in teleop just fine, I just can't seem to simulate the button press and release correctly so it will continue to the limit switches.

Thanks in advanced
Attached Files
File Type: vi Autonomous Independent.vi (37.5 KB, 29 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 12-03-2013, 21:51
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,833
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 limit switch

Autonomous Independent is not run 50 times a second like Teleop is.
You'll need to add a While or For loop around your switch checks and motor set, so that the code keeps checking for them.

What's the deal with that Time Delay inside the For loop at the start?
It basically waits 2 seconds, then waits two seconds again, then picks .6 for a motor speed, sets the motor then that's it.
So the shooter motor and the feeder motor are left running until Teleop takes over.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 12-03-2013 at 21:54.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-03-2013, 23:06
ChrisArmour ChrisArmour is offline
Registered User
FRC #3133
 
Join Date: Feb 2010
Location: scottsdale
Posts: 14
ChrisArmour is an unknown quantity at this point
Re: Autonomous limit switch

Well what I am trying to do is simulate three button presses so that it would run through the feeding three times, but have not been able to do so. This is my first year using limit switches, so I am kinda lost for the autonomous part. The feed motor will stop when the second limit switch is pressed. Shooter right now is going to run until autonomous is over but I am not worried about that for now.

Last edited by ChrisArmour : 12-03-2013 at 23:09.
Reply With Quote
  #4   Spotlight this post!  
Unread 13-03-2013, 10:12
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,833
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 limit switch

Aside from the loop problems, it seems like the First Limit Switch always starts off as pressed and will immediately override the .6 motor speed setting right in the beginning.
The motor needs some time to run before you start checking that first limit switch.

Also, make sure that the limit switch wiring matches the way it is checked in the code. Limit switches can be wired either Normally-Open (NO) or Normally-Closed (NC) and the code check might be reversed. I've had new electrical crew members wire one switch one way and the next switch the opposite, so double check. It's best to run in debug the first time and probe the value you are getting.

I'd think this process would be better described as a flat sequence.
Attached Thumbnails
Click image for larger version

Name:	ShootingSequence.png
Views:	61
Size:	45.2 KB
ID:	14339  
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 13-03-2013 at 10:35.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-03-2013, 17:53
team2830prgrmr team2830prgrmr is offline
Registered User
FRC #2830
 
Join Date: Jan 2013
Location: Milwaukee
Posts: 6
team2830prgrmr is an unknown quantity at this point
Re: Autonomous limit switch

That 2000 ms delay will make the vi wait 2000 ms, then run. You should try setting a for loop to run 2000 times, and putting a 1ms delay in that loop. I don't know about the limit switches, last time we ran a while loop in autonomous it didn't work and we never investigated why, we just use for loops for everything in autonomous now.
__________________
Rapper. Poet. Photographer. LabView programmer. Ask me for the rest of the story...
Reply With Quote
  #6   Spotlight this post!  
Unread 17-03-2013, 18:48
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,752
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: Autonomous limit switch

The coment makes it sound as if you want to swap the motor set and the delay. The code is delaying 2000 ms, then setting the motor and immediately moving on. Put the motor set before or in parallel with the delay.

A while loop is nothing special. It is perfectly valid if you program it correctly and no worse than an incorrectly programmed for loop or other code.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 18-03-2013, 18:56
ChrisArmour ChrisArmour is offline
Registered User
FRC #3133
 
Join Date: Feb 2010
Location: scottsdale
Posts: 14
ChrisArmour is an unknown quantity at this point
Re: Autonomous limit switch

Thank you Mark that ended up working perfectly
Reply With Quote
Reply


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


All times are GMT -5. The time now is 22:55.

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