Go to Post Even our greatest idols make mistakes. The good ones, move on and continue to do great things. - Al Skierkiewicz [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 08-02-2012, 02:53
Luiz12 Luiz12 is offline
Registered User
FRC #4210
 
Join Date: Jan 2012
Location: South Gate
Posts: 45
Luiz12 is an unknown quantity at this point
Servo back and forth

Basically what I want my servo to do is start from 0 degree position, and when I press button one, I want it to travel the full 180 degrees but when I let go of the button I want it to return to its original position, here's so code I wrote down, I am an extremely rookie player so I barely have any knowledge on what to do but I gave it try. I'm currently using the HS-322HD servo.
  #2   Spotlight this post!  
Unread 08-02-2012, 05:36
ehochstein's Avatar
ehochstein ehochstein is offline
Coach, Volunteer & Mentor
AKA: Evan Hochstein
FTC #5943 (ESGM)
Team Role: Coach
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Bloomington, Minnesota
Posts: 933
ehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant future
Re: Servo back and forth

The -1 and 1 constants basically mean the motor is going in full reverse or full forward. I suggest adding something such as a wait command and time how long it takes to go that far. I'm not a guru when it comes to Labview but all you are doing right there is taking the maximum and increasing it by 85. I can probably take a screen shot tomorrow when I get in if you need an example.
__________________
Minnesota FIRST Senior Mentor | 2013-?

Stratasys Applications Engineering Technician | 2016-?

2009 Regional Win – 2470 @ 10k Lakes (Thanks 2826 and 1714)
2013 WFFA Recipient – 2470 @ 10K Lakes
2016 Ri3D: 'Snow Problem Reveal
2017 Ri3D: 'Snow Problem Reveal

The opinions expressed above are the personal opinions of the author and do not necessarily represent the views and opinions of any organization the author is affiliated with.
  #3   Spotlight this post!  
Unread 08-02-2012, 07:26
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: Servo back and forth

It's pretty simple actually. You just use that triangular chooser and choose between 0 and 170 (which I believe is that max angle of the servos, not 180, but I could be wrong), then hook up that value to the Servo Set Angle. I think you just made it too complicated the way you did it, and the problem you had was you tried to perform a Boolean operation on two numbers at the bottom there.
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


  #4   Spotlight this post!  
Unread 08-02-2012, 10:20
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: Servo back and forth

Quote:
Originally Posted by Wiifi View Post
The -1 and 1 constants basically mean the motor is going in full reverse or full forward. I suggest adding something such as a wait command and time how long it takes to go that far. I'm not a guru when it comes to Labview but all you are doing right there is taking the maximum and increasing it by 85. I can probably take a screen shot tomorrow when I get in if you need an example.
This is true for the Set Output vi for Motor Controls. The OP is using a Servo and is using the Set Angle.vi, which takes in a range of 0-360 degrees I believe (most Servo's have a usable range of 180 degrees or less, see your servo datasheet for this info).

As dbeckwith said, the first problem is the boolean operator on the floating point wires. I don't know how this would work, but I'm sure it's not what you intended. From what you stated you only want to have one button to control this, so you don't need to use the OR at all (If you want to use another button to control this, you can use the OR to select either buttons). On the input of your Select use your button and the values should be 0 and your other value (I assume 180). The output of that should go directly into the Set Angle.vi. Finally calibrate your servo down position by removing the screw holding the servo horn, rotating the output gear to it's maximum down position and reinstall the servo horn and screw.
__________________
  #5   Spotlight this post!  
Unread 09-02-2012, 00:31
Luiz12 Luiz12 is offline
Registered User
FRC #4210
 
Join Date: Jan 2012
Location: South Gate
Posts: 45
Luiz12 is an unknown quantity at this point
Re: Servo back and forth

Would anyone be willing to give me their email. I constantly have programing issues and I need someone to help me on the spot.
  #6   Spotlight this post!  
Unread 09-02-2012, 13:30
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: Servo back and forth

Attached is an example of what I was suggesting, using 2 joysticks. You can PM me if you still need more help.
Attached Files
File Type: vi Servo Code.vi (12.6 KB, 27 views)
__________________
  #7   Spotlight this post!  
Unread 09-02-2012, 14:07
slijin's Avatar
slijin slijin is offline
Pockets
AKA: Samuel Lijin
FRC #0694 (StuyPulse)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York City
Posts: 537
slijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to beholdslijin is a splendid one to behold
Re: Servo back and forth

Quote:
Originally Posted by dbeckwith View Post
You just use that triangular chooser and choose between 0 and 170 (which I believe is that max angle of the servos, not 180, but I could be wrong)
The maximum travel of the Hitec HS-322HD is 270 deg, not 170.
__________________

2010-12 CT Chairman's
2011 Galileo 5th seed
2010 NY Regional Winners
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


All times are GMT -5. The time now is 01: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