Go to Post All I wanted was a game hint.... :( - JohnBoucher [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 27-04-2010, 12:14
tanguma26 tanguma26 is offline
Registered User
FRC #3999
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Killeen
Posts: 48
tanguma26 is an unknown quantity at this point
Talking Servo on joystick

Hey Guys hope every one had a blast at competition, but now that is over is time to start thinking on next years possibilities. So my team is starting to develop a swerve drive, but they want to activate something (secret sorry) using a servo, so I was wondering how can you program a servo to work on a button for a joystick, I know it was posted some were but i cant find it, can some one help me.

Thanks
  #2   Spotlight this post!  
Unread 27-04-2010, 14:13
EricWilliams EricWilliams is offline
Registered User
FRC #2039 (Rockford Robotics)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2001
Location: Rockford, IL
Posts: 103
EricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of lightEricWilliams is a glorious beacon of light
Re: Servo on joystick

We've had success using the "One-shot Rising" VI in Labview for rotating a servo at the press of a button. There are most definitely much better ways to do this.
  #3   Spotlight this post!  
Unread 27-04-2010, 16:21
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,384
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: Servo on joystick

If you are using Labview, or any environment for that matter, it is quite simple. Check the state of a given input, in this case a button on the joystick. When the input is false, give one value to the servo. When that input is true, give a different value to the servo.

See the pictures below for an example.

In c it might be something like:

Code:
if digin1 == 1
{
  servo1 = 118;
}
else
{
  servo1 = 75;
}
Attached Thumbnails
Click image for larger version

Name:	False servo.JPG
Views:	71
Size:	23.3 KB
ID:	9063  Click image for larger version

Name:	True Servo.JPG
Views:	49
Size:	21.3 KB
ID:	9064  
__________________
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
  #4   Spotlight this post!  
Unread 27-04-2010, 17:50
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Servo on joystick

There's actually an easier way then that. Go into (I think it's Comparison) palette and look for a Switch. I forgot it's exact name, but basically it looks like a triangle with a T and F inputs on the top and bottom and a case on the middle. It just passes the data through depending on the value of the input.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #5   Spotlight this post!  
Unread 27-04-2010, 18:49
PAR_WIG1350's Avatar
PAR_WIG1350 PAR_WIG1350 is offline
Registered User
AKA: Alan Wells
FRC #1350 (Rambots)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2009
Location: Rhode Island
Posts: 1,190
PAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond repute
Re: Servo on joystick

Quote:
Originally Posted by apalrd View Post
There's actually an easier way then that. Go into (I think it's Comparison) palette and look for a Switch. I forgot it's exact name, but basically it looks like a triangle with a T and F inputs on the top and bottom and a case on the middle. It just passes the data through depending on the value of the input.
I don't really use lab view, but that sounds like a logic gate

in c++ you could do some thing similar with a boolean variable:
Code:
int main()
{
   bool virtualdigin1;
   if digin1==1
     {
        virtualdigin1=0;
      }
   else
     {
        virtualdigin1=1;
      }
}
__________________

Last edited by PAR_WIG1350 : 27-04-2010 at 18:56.
  #6   Spotlight this post!  
Unread 27-04-2010, 18:53
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Servo on joystick

It is. The solution proposed by Bill is a case structure, I proposed a switch.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #7   Spotlight this post!  
Unread 27-04-2010, 21:13
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,384
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: Servo on joystick

Here is a picture of what Apalrd suggested. He is right, it is even easier than what I suggested.
Attached Thumbnails
Click image for larger version

Name:	Comparitor Servo.jpg
Views:	79
Size:	21.1 KB
ID:	9069  
__________________
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
  #8   Spotlight this post!  
Unread 27-04-2010, 23:34
PAR_WIG1350's Avatar
PAR_WIG1350 PAR_WIG1350 is offline
Registered User
AKA: Alan Wells
FRC #1350 (Rambots)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2009
Location: Rhode Island
Posts: 1,190
PAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond repute
Re: Servo on joystick

Not that it won't work, but controlling a button with a servo seems like it's adding additional potential points of failure unnecessarily.Servo controlled features do have their place, but i'm not sure this is it.

If the servo and button are on 2 separate systems, then I suggest a relay instead of a button that must be physically connected with the servo and then made to work together.

on the other hand, if the system controlling the servo also receives the input from the button, the issue could probably be fixed in programming.

However, if you still feel these solutions won't work and you need some sort of electromechanical actuator, a solenoid might be better (assuming this isn't ON the robot, if it is, the input from the button and servo output are both handled by one system so you should fix it in the code)

of course, since this is a black project there could be some major detail I don't know about that makes this your only option, in which case, disregard this.
__________________

Last edited by PAR_WIG1350 : 27-04-2010 at 23:36.
  #9   Spotlight this post!  
Unread 28-04-2010, 07:54
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: Servo on joystick

Quote:
Originally Posted by PAR_WIG1350 View Post
Not that it won't work, but controlling a button with a servo seems like it's adding additional potential points of failure unnecessarily.
Controlling a button with a servo? I think you have it backwards. I hope you have it backwards. I'm pretty sure the question was how to control a servo with a joystick button.
  #10   Spotlight this post!  
Unread 28-04-2010, 12:20
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,384
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: Servo on joystick

Quote:
Originally Posted by tanguma26 View Post
...so I was wondering how can you program a servo to work on a button for a joystick,.....

Quote:
Originally Posted by Alan Anderson View Post
Controlling a button with a servo? I think you have it backwards. I hope you have it backwards. I'm pretty sure the question was how to control a servo with a joystick button.
I hope you are right Alan, I was going an the same assumption.

Although, when you read the OP's original question, you can see why there is room for confusion.
It's amazing how our language can open to so many different interpretations.
__________________
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
  #11   Spotlight this post!  
Unread 28-04-2010, 22:52
PAR_WIG1350's Avatar
PAR_WIG1350 PAR_WIG1350 is offline
Registered User
AKA: Alan Wells
FRC #1350 (Rambots)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2009
Location: Rhode Island
Posts: 1,190
PAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond repute
Re: Servo on joystick

...

http://www.chiefdelphi.com/media/photos/27192
__________________
  #12   Spotlight this post!  
Unread 30-04-2010, 11:40
tanguma26 tanguma26 is offline
Registered User
FRC #3999
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Killeen
Posts: 48
tanguma26 is an unknown quantity at this point
Re: Servo on joystick

Sorry guys that's what I ment, the button on the joystick to move the servo in different positions and come back to those positions. What we are trying is use a dewalt motor and we need to change gears and for that we need the servo to move the shifter on the dewalt.
  #13   Spotlight this post!  
Unread 30-04-2010, 17:38
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Servo on joystick

ooooohhh.. you're using a 3-speed DeWalt transmission... we've used those before.

This year we had two robots and only used gears 1 and 2 (only one shifter, it was for our arm).

In LabVIEW I created a 2x2 matrix for the shift states. The column was the numeric equivalent to the boolean robot variable (false for competition, true for practice). The row was the numeric equivalent to the boolean shift state variable. This worked just fine for only going from 1 to 2. I set the shift point when deploying so there was not much load on the arm at the time it shifted and it never missed a shift.

In the past, we have used all three gears (for drivetrains), and had the servo overshoot and come back when shifting into second, to make more certain the shift was successful (the shift from 2 to 3 at speed is kinda hard anyway).

The simple way to do this would be to use a state-machine and have a value for "Low", "Mid", and "High". This will make the robot stay in gear when you remove your hands from the buttons. To do this, create an Enum control, right-click, and hit "Edit Items". Then, type in your three states, preferably with Low as 0 and High as 2. Then, create an array and place a Numeric type inside, making a numeric array. This will store your shift points. There are three rows in the numeric array that we care about: the first three. The first one corresponds to Low (assuming Low is the 0 in the list), and so on. Servo values are between 0 and 170 in degrees. When you have set them (you can do this while the code is running), stop the code, right-click on the array, and go to Data Operations -> Make Current Value Default. Then, go to the place where you set the servo, get the array and enum, and Index the array (using Arrau->Index Array) where the index is the enum. This will give you the correct angle for the state that the Enum is set to, which you can set to your servo. Then, to set the enum, you can have a button for Low, Mid, and High. Just have a Switch for each button, and feed the current state of the enum into the False of the first one (then string the output of the first to the False of the second and so on). Then, set the True to the value of the button, either Low Mid or High. The output of the last one gets set to the enum. You could save buttons by having a Shiftup and Shiftdn button, but that would require an indicator of the current gear (Dashboard or LED) and a rising-edge trigger, both of which are more complex then you probably want. I would make pictures to go along with this but my LabVIEW laptop is broken.

Also, don't forget to remove the detent from the shifter (a little black tab that holds it in gear, it makes it harder for the servo to shift)
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
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
Servo control with a joystick Robototes2412 Java 5 09-05-2010 19:31
Joystick Read modification to breakout joystick buttons sparks-1784 NI LabVIEW 2 02-03-2010 14:54
Joystick-Servo control Lumit NI LabVIEW 1 08-02-2010 23:21
Camera servo control off of the Joystick axes m3rc1l3ss NI LabVIEW 5 13-03-2009 20:00
Servo behavior question / advanced servo/PIC programming question DanL Electrical 12 18-10-2005 18:33


All times are GMT -5. The time now is 03:44.

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