For the past three years now me and my team have been trying to set our joystick to be able to move our servos on camera and any other place on bot. Can anyone help me to a) move them with the axis of the joystick or b) press a button to move it to one position?
There are a number of good ways of doing this, but perhaps what you want is to identify an initial servo setting, say 90 degrees. Pressing a button adds a delta, say 10 degrees to the number and updates the servo. Perhaps another button will subtract 10. Alternatively, you could use buttons to simply set the number to a special number.
The code for this would look similar to the attached image. Note that I duplicated the case diagrams near it as printing would. They are actually stacked in the code as individual diagrams.
greg McKaskle
Okay, that makes sense, but in the picture, what are the blocks to the right of the button cluster? and the the right of the True? ANd the blue thing above the top most case structure?
my team and I
Can anyone help me to a) move them with the axis of the joystick or b) press a button to move it to one position?
Attached is an example from team358.org
*
Sorry about that. I wasn’t sure how much LV you knew.
I attached the VI, and you can now show the help window and idle the mouse over each of the nodes to see what they are and what they do.
To answer you questions anyway:
The buttons I was interested in are indexed from the cluster and placed into an array. The array is searched for True to see which is pressed. The node with the magnifying glass is the search. The blue arrow box above the case is called a feedback node and is used to keep values from call to call. This “remembers” the value from last time. The case structure code updates it.
Greg McKaskle
Untitled 1.vi (7.66 KB)
Untitled 1.vi (7.66 KB)
I have seen and tried that bit of program to no avail.
Did you install the servo power jumper on the pins next to the PWM output on the Digital Sidecar?
No. I’m not even sure what that is. Would that be why no servo programming I do ever works?
Probably, it happened to us before too. They basically wouldn’t receive any input when the jumper is not connected.
As a rule of thumb, when you try to learn how to use a new component you’ve never used before, I suggest utilizing the appropriate LabVIEW example first, and consulting one of your fellow teammates from the electronics department (or a mentor if no other student knows), as the vast majority of “component not receiving/returning value” issues come from either faulty wiring or missing a certain VI that you wouldn’t think of when utilizing it by yourself.
The appropriate example here is “Servo Camera.lvproj”, you might want to combine it with the example “Rectangular Target - 2013” and integrate both of them into your code.
(Keep in mind that in my experience, the camera’s servos are incredibly unstable and unreliable, especially if you try to use to camera to “home in” on the target rather than an additional point of view for the drivers)
Each of the three-pin PWM OUT connectors on the Digital Sidecar is accompanied by a 2-pin PWM OUT +V header. The PWM OUT pins are SIG, PWR, and (-). The PWR pin is where a servo gets its power from, but it doesn’t actually provide any power until you put a jumper on the +V header pins.
Signs point to “yes”.
Thanks for the Vi and jumper note. We added them to our older robot today, and will be trying out my code tomorrow. You guys solved a three year old question for us!
I finally had the chance to deploy our code and with adding the jumpers it worked flawlessly! We can now move our servos with axis and buttons, thanks you guys!