Go to Post What I want is to ultimately make it so that the programming is actually done before the robot is finished. Imagine that! - Danny Diaz [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 04-02-2010, 08:35
EagleS!! EagleS!! is offline
Registered User
FRC #3390 (Anatolian Eaglebots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Turkey
Posts: 20
EagleS!! will become famous soon enoughEagleS!! will become famous soon enough
NEED HELP WITH SERVOS!!

We have a problem about our servos. We are using them to control our camera system. The plan is to move the camera, using servos controled with joystick buttons. We tried some codes but they didn't work. We may need some advices.
Attached Thumbnails
Click image for larger version

Name:	Begin. vi.png
Views:	50
Size:	20.6 KB
ID:	8502  Click image for larger version

Name:	finish.jpg
Views:	34
Size:	95.0 KB
ID:	8504  Click image for larger version

Name:	teleop.jpg
Views:	42
Size:	109.3 KB
ID:	8505  

Last edited by EagleS!! : 04-02-2010 at 08:49.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2010, 09:02
Ziaholic's Avatar
Ziaholic Ziaholic is offline
Elec/SW Mentor
AKA: Marc
FRC #1164 (Project NEO)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2002
Location: Las Cruces, NM
Posts: 194
Ziaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the rough
Re: NEED HELP WITH SERVOS!!

You need to put some math in between your joystick button outputs, and the Servo Set Angle block.

That SetAngle SubVI is expecting a number between 0 and 180 degrees(typically), and not the simple true/false (boolean) that you're trying to connect in your 3rd image.

How do you want the button(s) to steer it? If you are controlling both the PAN and TILT motors, then you'd need at least 4 buttons to steer it left/right or up/down. Here's one idea, read the angles from the servos, then use some true/false statements from the buttons to either add or subtract some constant value (like 10 degrees) to the read angles, then set that new angle value into the motors. If none of the 4 buttons are pressed, simply pass the original value (Get Angle) to the new value (Set Angle).

There are many many options to do this ... this is just one ... tell us more about your intent ...
__________________
----
There are 10 types of people. Those who understand binary, and those that do not.
Team #1164 - Project NEO Robotics
Reply With Quote
  #3   Spotlight this post!  
Unread 04-02-2010, 09:40
EagleS!! EagleS!! is offline
Registered User
FRC #3390 (Anatolian Eaglebots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Turkey
Posts: 20
EagleS!! will become famous soon enoughEagleS!! will become famous soon enough
Re: NEED HELP WITH SERVOS!!

This is what we are trying to do. Here is a photo of our new code. But we can't figure out how to connect Button 8 to Servo GetAngle.
Attached Thumbnails
Click image for larger version

Name:	teleop2.jpg
Views:	52
Size:	76.6 KB
ID:	8506  
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2010, 09:50
Ziaholic's Avatar
Ziaholic Ziaholic is offline
Elec/SW Mentor
AKA: Marc
FRC #1164 (Project NEO)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2002
Location: Las Cruces, NM
Posts: 194
Ziaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the roughZiaholic is a jewel in the rough
Re: NEED HELP WITH SERVOS!!

You need to add some case structures around that "+10" area ...

Make some room in that area and drop down a case structure. Wire up the output of the joystick button to the little green control-box on the case structure. In the TRUE window, put your "+10" in there, in the FALSE case, simply wire the GET, thru the case, into the SET.

To get all 4 buttons to steer it up/down/left/right, you'll need to put more cases within that case.

This image doesn't do what you want to do, but you can see how we are taking buttons 3, 4, and 5 and wiring them into the cases to do different things. And we also are using button 1 to override the joystick throttle to 100%.
__________________
----
There are 10 types of people. Those who understand binary, and those that do not.
Team #1164 - Project NEO Robotics
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2010, 11:02
EagleS!! EagleS!! is offline
Registered User
FRC #3390 (Anatolian Eaglebots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Turkey
Posts: 20
EagleS!! will become famous soon enoughEagleS!! will become famous soon enough
Re: NEED HELP WITH SERVOS!!

we are trying some code but it isn't working. Could you tell me where is the mistake.
Attached Thumbnails
Click image for larger version

Name:	teleop3.jpg
Views:	42
Size:	116.6 KB
ID:	8507  
Reply With Quote
  #6   Spotlight this post!  
Unread 04-02-2010, 11:42
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: NEED HELP WITH SERVOS!!

Quote:
Originally Posted by EagleS!! View Post
we are trying some code but it isn't working. Could you tell me where is the mistake.
Saying "it isn't working" doesn't give a lot of information. What do you expect it to do, and what is it doing instead?

There's a red dot on the input of the Servo Set Angle vi. That means you're giving it a data type that it doesn't expect.

Your code will add ten every time Teleop is called -- which is fifty times a second. You probably don't want to do that.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-02-2010, 12:27
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: NEED HELP WITH SERVOS!!

Quote:
Originally Posted by Alan Anderson View Post
There's a red dot on the input of the Servo Set Angle vi. That means you're giving it a data type that it doesn't expect.
The coercion dot is because GetAngle outputs an unsigned 16 bit integer, while SetAngle accepts a signed 32 bit integer. Either one handles far more then the servo needs, and so the coercion dot shouldn't matter. Not sure why two different types are used by the library.
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2010, 13:37
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: NEED HELP WITH SERVOS!!

It might have just been the picture quality, but in your Begin it looks like it says "servc a" and not "servo a". Check that and watch the errors on the diagnostics tab of the Driver Station to see if you get any refnum errors, this will tell you if you have a typo somewhere.

As far as the datatype issue is, instead of using the blue constant (integer) use a orange constant (float), that should fix your datatype mismatch error (I think...No LV here to try it on.)
__________________
Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2010, 14:43
EagleS!! EagleS!! is offline
Registered User
FRC #3390 (Anatolian Eaglebots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Turkey
Posts: 20
EagleS!! will become famous soon enoughEagleS!! will become famous soon enough
Re: NEED HELP WITH SERVOS!!

Quote:
Originally Posted by Alan Anderson View Post
Saying "it isn't working" doesn't give a lot of information. What do you expect it to do, and what is it doing instead?

There's a red dot on the input of the Servo Set Angle vi. That means you're giving it a data type that it doesn't expect.

Your code will add ten every time Teleop is called -- which is fifty times a second. You probably don't want to do that.
I just expect code to move camera by 10 degrees when button8 is pressed. But when pressed, nothing happens.

Do you think red dot on the input can cause problem?

I will try any code changes tomorrow as it is night here now.

Thanks in advance
Reply With Quote
  #10   Spotlight this post!  
Unread 04-02-2010, 15:21
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: NEED HELP WITH SERVOS!!

Quote:
Originally Posted by EagleS!! View Post
I just expect code to move camera by 10 degrees when button8 is pressed. But when pressed, nothing happens.
Can you probe the values while the code is running to see if the input to the Set Angle vi is changing?

Is the robot enabled using the Driver Station?

Is the Robot Status Light on the Digital Sidecar on and winking off for a moment every second and a half?

Is the 6v power jumper installed for the PWM channel that the servo is connected to?

Is the 6v light on the Digital Sidecar lit?

If you try to turn the servo by hand, does it go where you put it, or does it resist motion and try to stay in the same position?



Once you get the servo to respond, you're only partway there. You will need to add something that only changes the servo angle when the button value changes from false to true. That means remembering the previous value so you can test against it. I use something called a Feedback Node to do that.



The red dot won't break anything. Apparently it's there because the Servo vi data types aren't consistent, and there really isn't much you can do about it.
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
Labview Servo Control Issue EricWilliams Programming 5 22-01-2010 14:24
Camera servo control off of the Joystick axes m3rc1l3ss NI LabVIEW 5 13-03-2009 20:00
Servo Control? mattg101 Technical Discussion 2 20-01-2007 13:12
Direct control of a Servo or Speed Controller Schmitty! National Instruments LabVIEW and Data Acquisition 3 06-03-2006 13:53
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 22:43.

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