Go to Post "The world is not idiot-proof. Pay Attention." - DonRotolo [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 22-02-2009, 22:23
DWirth DWirth is offline
Registered User
FRC #2509
 
Join Date: Feb 2009
Location: Hutch
Posts: 10
DWirth is an unknown quantity at this point
Exclamation Moving Camera Servos With Joystick Button

Hello, I am looking for help on how to program in LabView how to move the servo with 2 joystick buttons. What I want it to do is move the camera servo 1 degree/increment everytime a press a joystick button. I could not figure this out on my own and any help or ideas would be greatly appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 22-02-2009, 22:42
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: Moving Camera Servos With Joystick Button

Create a setpoint for the servos using either a control, a shift register, or a feedback variable. Depending on the buttons, either increment or decrement the value of the setpoint. Then add the function to update the servo to the setpoint.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 23-02-2009, 07:54
DWirth DWirth is offline
Registered User
FRC #2509
 
Join Date: Feb 2009
Location: Hutch
Posts: 10
DWirth is an unknown quantity at this point
Re: Moving Camera Servos With Joystick Button

Thanks for the speedy reply. That is what I thought needed to happen. Im still a little confused by what you said, could you show me a screenshot of that code please?
Reply With Quote
  #4   Spotlight this post!  
Unread 23-02-2009, 08:38
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: Moving Camera Servos With Joystick Button

Sorry, I'm not at a PC right now. The code I'd write first is the joystick stuff. Inside the teleop you are either unbundling buttons already, or you are about to. Use the buttons to affect the servo setpoint with + or -. Then add a shift register to the loop initialized to centered I guess. Run the shift register wire to the cases doing the + and -. Prove the wire and test it out. Once you are happy with it, connect up the servo open, close, and the write angle.

Greg McKaskle
Reply With Quote
  #5   Spotlight this post!  
Unread 23-02-2009, 11:02
Luke Pike's Avatar
Luke Pike Luke Pike is offline
Programmer
FRC #1501 (THRUST)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Huntington
Posts: 114
Luke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to allLuke Pike is a name known to all
Re: Moving Camera Servos With Joystick Button

What Greg suggests will work great, just be careful about how often you change the angle. If you change the servo setpoint whenever the button is held down, then the servo will almost instantly go to it's extreme angle. The reason being that the loop runs really fast, so you increment the setpoint very fast and it builds up to the max quickly.

I would check the time and only do the servo code when a certain amount of time has passed.
__________________
Twitter Profile
Reply With Quote
  #6   Spotlight this post!  
Unread 23-02-2009, 12:19
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Moving Camera Servos With Joystick Button

Quote:
Originally Posted by Luke Pike View Post
I would check the time and only do the servo code when a certain amount of time has passed.
It might be easier to learn how to use a feedback node to remember what the state of the joystick button was the previous time through the code. I don't have a copy of LabVIEW available, so I'll see what I can do to describe a good way to react just once to a joystick button being pressed.

Wire the Joystick Get "Buttons" output to an "Unbundle by name" and select the desired button from the unbundle's popup menu.
Wire the unbundle's boolean output to one input of a boolean And gate, and also to the input to a feedback node.
Wire the output of the feedback node to a boolean Not.
Wire the output of the boolean Not to the other input of the boolean And.

The output of the boolan And will be true only during the single loop when the joystick button has changed from false to true.

You can use that single-time signal as the select input to a Case structure which passes a numeric input straight through to its output when false, and increments it by one when true.

Duplicate this entire process for another joystick input and another Case that decrements the numeric value.

Wire a numeric value through both Case structures and a shift register on the surrounding While loop. That way the joystick buttons will bump the value up or down by one each time one gets pressed. Use that value as the input to the Servo Set Angle. If you feel like it, run the value through a range check and coerce on its way through the process so that it never exceeds the proper range for a servo angle.
Reply With Quote
  #7   Spotlight this post!  
Unread 25-02-2009, 21:50
DWirth DWirth is offline
Registered User
FRC #2509
 
Join Date: Feb 2009
Location: Hutch
Posts: 10
DWirth is an unknown quantity at this point
Re: Moving Camera Servos With Joystick Button

Thanks for all the help, still a bit confused, but having LabView in front of me will help. Alan, where exactly do I set a constant of the angle I want the servo to be at? It sounds like I create a constant then run a wire to the border of a case structure. I am also confused on what a feedback node is. Is it in the same menu as Not, And, Or functions?
Reply With Quote
  #8   Spotlight this post!  
Unread 26-02-2009, 21:35
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Moving Camera Servos With Joystick Button

Quote:
Originally Posted by DWirth View Post
Thanks for all the help, still a bit confused, but having LabView in front of me will help. Alan, where exactly do I set a constant of the angle I want the servo to be at? It sounds like I create a constant then run a wire to the border of a case structure.
The only constant you will want is the one connected to the left side of the shift register you create on your outermost while loop. The shift register will remember the angle you set the previous time through the loop so you can either use it as is or bump it up or down by one before using it. The input to the shift register sets the initial value it will have the very first time through the loop; you will probably want to choose a value that centers the servo.

Quote:
I am also confused on what a feedback node is. Is it in the same menu as Not, And, Or functions?
You won't find it in the boolean menu, because it isn't a boolean operator. It works with booleans, but it also works with integers, floating point numbers, strings, enumerated values, bundles, basically whatever kind of data you feed it. I can't remember exactly what the name of the palette is where it resides. Now is as good a time as any to learn how to use the search feature in the palette. Type in "feedback" and see what it finds.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Servos not moving Marlfox Electrical 2 09-02-2009 18:24
joystick button furiousgeorge Programming 5 07-02-2009 15:57
Programming a joystick button... programmr Programming 2 05-01-2009 16:13
using servos with camera team877 Programming 2 01-02-2007 21:26
Moving robot while tracking with camera questions... Steve Orr Programming 6 02-02-2006 22:24


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

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