|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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.
Last edited by EagleS!! : 04-02-2010 at 08:49. |
|
#2
|
||||
|
||||
|
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 ... |
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
||||
|
||||
|
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%. |
|
#5
|
|||
|
|||
|
Re: NEED HELP WITH SERVOS!!
we are trying some code but it isn't working. Could you tell me where is the mistake.
|
|
#6
|
|||||
|
|||||
|
Re: NEED HELP WITH SERVOS!!
Quote:
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. |
|
#7
|
||||||
|
||||||
|
Re: NEED HELP WITH SERVOS!!
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.
|
|
#8
|
||||
|
||||
|
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.) |
|
#9
|
|||
|
|||
|
Re: NEED HELP WITH SERVOS!!
Quote:
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 |
|
#10
|
|||||
|
|||||
|
Re: NEED HELP WITH SERVOS!!
Quote:
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |