Go to Post I feel like I need to rinse out my brain with drain cleaner - dlavery [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 29-08-2012, 11:28
996rookie 996rookie is offline
Registered User
FRC #0996
 
Join Date: Jan 2012
Location: Arizona
Posts: 8
996rookie is an unknown quantity at this point
Joystick Controls

Hi,
This yeara to prep for FRC, our team is building a model airplane from scratch to fly. The problem I am facing as a programmer is to set the rudders and such to the joystick so that if i move it partially to the left and hold it, the rudders will only turn that much, stay there, and nothing more.
Right now, if I set them to the joystick, they continue to turn, and damage the servo's.
Can anyone help?
Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 29-08-2012, 12:03
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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: Joystick Controls

The servos controlling the flight surfaces could just be set to the angle of the joystick.

Convert the joystick value to be in the same range as the servo, e.g., (joy+1)/2 = servo position
This is assuming you use 0 to 1 as the servo Set Position. If you use Set Angle instead, then convert the joystick to the angle range you defined or defaulted to in your Servo Open instead.

P.S.
Probably need to set max/min limits to the servo motion as well, so they don't try to move past mechanical limits.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-08-2012 at 13:22.
Reply With Quote
  #3   Spotlight this post!  
Unread 29-08-2012, 15:56
996rookie 996rookie is offline
Registered User
FRC #0996
 
Join Date: Jan 2012
Location: Arizona
Posts: 8
996rookie is an unknown quantity at this point
Re: Joystick Controls

So I think a more difinitive explanation of my problem is that when I lean the Joystick to the left, the motor continues to turn past the angle I want. The more I lean it, the faster it turns. I want to set it so that it only turns to the angle that the Joystick is.
Reply With Quote
  #4   Spotlight this post!  
Unread 29-08-2012, 16:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,100
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Joystick Controls

Quote:
Originally Posted by 996rookie View Post
So I think a more difinitive explanation of my problem is that when I lean the Joystick to the left, the motor continues to turn past the angle I want. The more I lean it, the faster it turns. I want to set it so that it only turns to the angle that the Joystick is.
Tell us what part number servo you are using.


Reply With Quote
  #5   Spotlight this post!  
Unread 29-08-2012, 16:25
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
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: Joystick Controls

Are you sure that it's really a servo?
Is it a continuous rotation or is it limited in it's rotation?

The servo model will tell us what we want to know.

If you think it's a code problem, then post a snippet of the code reading the joystick and setting the servo.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-08-2012 at 16:29.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-09-2012, 01:20
996rookie 996rookie is offline
Registered User
FRC #0996
 
Join Date: Jan 2012
Location: Arizona
Posts: 8
996rookie is an unknown quantity at this point
Re: Joystick Controls

No, it's not the servo, its the code. I honestly just don't know how to set the angle of the rudder to the angle of the joystick.
Reply With Quote
  #7   Spotlight this post!  
Unread 01-09-2012, 02:13
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: Joystick Controls

When you say "servo", what exactly are you referring to? Your first post suggests that you might be using it to mean something other than what I think of.

Also, what are you using as your control system? A cRIO and its supporting electronics are rather heavy to be using in a model airplane.
Reply With Quote
  #8   Spotlight this post!  
Unread 01-09-2012, 11:10
Dexterium's Avatar
Dexterium Dexterium is offline
Registered User
AKA: Adam Poindexter
FRC #1208 (Metool Brigade)
Team Role: Programmer
 
Join Date: Sep 2012
Rookie Year: 2011
Location: United States
Posts: 24
Dexterium is an unknown quantity at this point
Talking Re: Joystick Controls

your problem is the code. Whenever you move the joystick you are sending a constant value to the motor/servo/whatever. That constant value is causing the whatever to constantly turn. What you need to do is use the servo set position this takes a value from 0 to 1 from an input and matches it to the servo's position. use this along with some math and the joystick to make it work. Lets say that your servo range (the range of possible/wanted motion) is 90 degrees. You would specify this in the begin vi with servo open. For this to work right you would want is set up like this:

0 degree position(all the way in one direction)=0 servo position=(-1) Joystick position

45 degree position(straight/level)=.5 servo position=0 Joystick Position

90 degree position (all the way the other direction)=1 servo position=1 Joystick position

The degree refrences don't really matter for the sake of the programming they are just there for refrence. What you really need to do is find some math(i have no clue what) to put between the joystick output value and the servo input value that makes 0=-1, .5=0, and 1=1. Once you do this your home free.

See below

Last edited by Dexterium : 01-09-2012 at 11:34.
Reply With Quote
  #9   Spotlight this post!  
Unread 01-09-2012, 11:33
Dexterium's Avatar
Dexterium Dexterium is offline
Registered User
AKA: Adam Poindexter
FRC #1208 (Metool Brigade)
Team Role: Programmer
 
Join Date: Sep 2012
Rookie Year: 2011
Location: United States
Posts: 24
Dexterium is an unknown quantity at this point
Re: Joystick Controls

Quote:
Originally Posted by Dexterium View Post
\What you really need to do is find some math(i have no clue what) to put between the joystick output value and the servo input value that makes 0=-1, .5=0, and 1=1. Once you do this your home free.
Found the math:
x=Value from the joystick
y=Value to the servo position

x(1/2)+1/2=y

Examples:

-1(1/2)+1/2=0
-.5(1/2)+1/2=.25
0(1/2)+1/2=.5
.5(1/2)+1/2=.75
1(1/2)+1/2=1
Reply With Quote
  #10   Spotlight this post!  
Unread 01-09-2012, 22:30
996rookie 996rookie is offline
Registered User
FRC #0996
 
Join Date: Jan 2012
Location: Arizona
Posts: 8
996rookie is an unknown quantity at this point
Re: Joystick Controls

Thanks!! That really helped. Going to try it as soon as possible.
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 21:51.

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