Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Jiggly servo (http://www.chiefdelphi.com/forums/showthread.php?t=82177)

grosh 08-02-2010 15:30

Jiggly servo
 
1 Attachment(s)
We have a two speed transmission that shifts with a servo. We want to press the trigger button to shift between high and low gear. We want the program to Get the Servo angle...decide if it is in high gear (45) or low gear (120)...then shift into the opposing gear.

The problem with the program- program attached below- is... when we pull the trigger button the servo JIGGLES before it decides what gear it sets in. Most of the time it chooses the correct gear but not always.

Are we taking the wrong approach?

EricVanWyk 08-02-2010 15:33

Re: Jiggly servo
 
You want to trigger the change when the button is pressed, but right now you are triggering the change whenever the button is down. This results in it flickering between the two states as fast as the program cycles, and will 'randomly' pick one when you let go.

Try to figure out how you can only trigger when the button wasn't pressed but now is - only once per button push.

You are really close, I'm sure you'll get it quickly.

As a hint, the "shift register" will remember something one time tick in the past.

Vikesrock 08-02-2010 15:38

Re: Jiggly servo
 
It is probably best to think about the problem Eric highlighted for a bit and see if you can solve it yourselves (you'll learn more), but if you get stuck you may find this thread of interest:

http://www.chiefdelphi.com/forums/sh...light=one+shot

Alan Anderson 08-02-2010 15:49

Re: Jiggly servo
 
Quote:

Originally Posted by grosh (Post 915827)
Are we taking the wrong approach?

I think you are. Using a "toggle" function to shift between high and low gear isn't the sort of thing I'd want to use if I were driving. I would want one control to select high gear, and another control to select low gear.

However, if you really do want to make it work that way, Eric and Kevin have good advice. The thread Kevin linked to can show you a simple fix for your code if you understand what's going on.

grosh 08-02-2010 16:11

Re: Jiggly servo
 
Alan, I agree. We did have two buttons setup for the drivers, but they asked for a single button shift.

I really did not understand the threads. We don't have any trained talent on the programming team. We don't offer a class at our high school and we don't have any outside mentoring to help us learn. Everything we know we have learned through LVMastery and ChiefDelphi.

We will try Alan's "rising edge" program. We don't understand the logic in it, but I have seen the icons before.

Vikesrock 08-02-2010 16:15

Re: Jiggly servo
 
Quote:

Originally Posted by grosh (Post 915854)
We will try Alan's "rising edge" program. We don't understand the logic in it, but I have seen the icons before.

The code Alan posted in that thread uses a feedback node to look at both the current value of the button and the last value of the button. The triangular gate is a NOT gate and inverts the true/false value coming out of the feedback node. The other gate is an AND gate which returns true if and only if both inputs are true.

So the code outputs true if and only if the button is pressed now and wasn't pressed the last time the code executed.


All times are GMT -5. The time now is 11:58.

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