![]() |
servo
if i want to program a servo to move say 5 degrees up when i push a button on the joystick, how do i do that, specificly in teleop (a diagram would be nice)
|
Re: servo
the way i have it wired now is from the name to joystick vi's, to unbundled y axis, to case structure (true). here is where i have trouble, i can't connect the wiring to any of the servo vi's, set position, get position, you name it. that is my problem. How do i wire this so when i push the axis or button, it moves how ever many degrees or speed. ive been looking in all the tutorials for awhile, that includes other websites.::rtm::
|
Re: servo
2 Attachment(s)
Have a feedback node keep the current value of the servo, which is always writing to it. Have a case structure so that when you press the button, it adds five to the value.
With that setup, it will add 5 degrees every single time the loop runes (which is quite fast). If you want to wait for the button to release and then repress before it adds another five, you will have to add another feedback node. This one would keep the value of another case structure, around the first one. You wire the output of the feedback node into the input of the case structure. This would have several names as the cases: Try calling them "Button Pressed" and "Button Released" The button released state would look for the button to be pressed, and when that happens would send the +5 degree command and the "Button Pressed" constant to the feedback node. In the Button Pressed state, it would give either a value of "Button Pressed" to the feedback node if the button was pressed or a value of "Button Released" if the button was released. At that point, it would go back to button released and start over. I guess I'll attach some code.. One of them is how I said to do it in this post, and the "simplified" version is one that uses no case structures and very few functions. |
Re: servo
what program do i open the files with?
|
Re: servo
Quote:
|
Re: servo
maybe
|
Re: servo
Quote:
|
Re: servo
no problem, i wasn't sure if it was word or picture or something like that.
|
Re: servo
1 Attachment(s)
I hooked up your simplified version to the buttons. I've attached the vi below. It still does nothing. No servo moves at all when I press a button. I replaced a couple (+) vis with (-). I want to control up with 3, down with 2, left with 4, and right with 5. What's wrong with the program?
|
Re: servo
Quote:
Did you remember to install the 6v servo power jumper next to the PWM output pins on the Digital Sidecar? Without that jumper in place, the servo won't be powered and won't be able to move at all. |
Re: servo
Quote:
I could give you a few ways to make it either go +0, +5, or -5, but it looks like you really want to be able to hold down the button and have the camera move down. In that case, you can just have a selector or case structure with the input wired to the joystick button; the true case wired to "add five" and the false case have another identical case structure but with a "subtract five" in the true case and a "say the same" in the false case. Remember to use a feedback node to have the servo remember its current position. Sorry I can't give you another example, but I really have to do my homework and get to bed. |
Re: servo
I think this thread is getting more complicated then it needs to. The way I understand your question is that when a button is not pressed you want a servo to be at angle X, and when it is you want it to be at angle X+5. Is this right?
The way I would do this is by having a true/false case statement with the numeric constant X in the false case and X+5 in the true case. I would then feed this value in to the WPI servo .vi called "Set Angle". This code would make the servo go to one angle (in this case X) while the button is not pressed and another (in this case X+5) when it is. If you still don't see any movement try changing the values from X and X+5 to 0 and 170, it could just be to small a change to see. If there is still no servo movement after that, respectfully suggest to electrical it's their fault, calmly double check your code, then yell at electrical. |
Re: servo
What is this jumper everyone refers to? Is it a special piece that fits around the two prongs? Is it like the PWM cable only two wired, and if so where does the other end go to? I have looked all over the web and have only seen it refered to as jumper.
|
Re: servo
Quote:
|
Re: servo
1 Attachment(s)
This is what i have, what next? don't forget i want the arm to go up however fast however far when i push the y axis, i just want it to move. i also need to do the same thing with another part of the arm. i have also been told they will be used with denso motors, do i change the vi's at all for that? and i am confused on how to input what port/pwm the motor or servo is wired into for each specific servo or motor vi. if anyone can send me a copy of my attachment an example on how to do all of what i just stated, i should be good from there.
|
Re: servo
I am also having trouble connecting the unbundled buttons going through the case structure and into the motor set output vi. :confused:
|
Re: servo
Quote:
I don't have Labview in front of me here at work, but I would guess that it is in the Boolean palette and if I recall correctly has "0:1" on the icon. |
Re: servo
When you get the chance, can you modify the attachment i added before and show me that.:D
|
Re: servo
Quote:
|
Re: servo
that is great, thanks.
|
Re: servo
When i attach the green button wire to the sync group input on the set output motor vi, it just says that it's error wire. that the wire does not match the vi input.
|
Re: servo
any other homemade diagrams would be welcome too:D
|
Re: servo
1 Attachment(s)
A While Loop in Teleop set to run once with nothing passed in or out has no real purpose. I would remove it for ease of reading.
Your servo code creates a race condition. You are setting the value two separate times with two separate pieces of code. Where the servo will end up is not determinate and may not be consistent. I have shown one way of wiring the up and down commands using a single Servo Set VI. You should be able to follow that example to fix the left-right servo code. I have included an example of controlling a motor with a joystick y-axis, a button that runs it one direction and two buttons that run it in opposite directions. The PWM channels are specified when you open the device in Begin.VI. I have included an example of how to open a motor and set the refnum in the attached teleop file but this is NOT where that code should go in your project. It must be done in Begin. Sync groups are an advanced function used with CAN that you don't need to worry about right now. You want to be wiring into the terminal labeled "output" on the Motor Set Output VI. If you have any other questions or are having difficulty understanding any of the examples please feel free to ask. |
Re: servo
omg thank you so much!!!!you are awsome!!!!!!hopefully we will see you at the nationals.:D :D :D :D :D
|
Re: servo
And how do i program an arm in autonomous, example pleeeeeeeeeeeeease. say i want to wait 6 seconds for the arm to move up for 3 seconds.
|
Re: servo
and how do i make a motor move for some odd amount of seconds and then stop.
|
| All times are GMT -5. The time now is 20:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi