Log in

View Full Version : Camera servo


mcristina444
12-02-2010, 16:46
im trying to move the camera using the 2nd joytick. we want to make button 8 make it go left and button 9 go right. then for up and down we want the thing that is between them to make it go up and down. anyone know how to do this?

Greg McKaskle
12-02-2010, 17:12
I think there was a thread that went into details on this recently. Basically you want to set the servo to a value each time through the loop. In front of this, you take the values sent last time and optionally increment, decrement, or leave alone. The value also needs to be remembered again until the next teleop message. The value can be fed back using a feedback node, it can use a shift register, a local variable, or even a global variable.

Greg McKaskle

Alan Anderson
12-02-2010, 21:49
The value also needs to be remembered again until the next teleop message. The value can be fed back using a feedback node, it can use a shift register, a local variable, or even a global variable.

The servo itself remembers its value, so you can just Get Position, add to or subtract from it, and Set Position each time through.

Ziaholic
12-02-2010, 22:15
The "thing" between buttons 8 & 9 is called the Throttle ... a.k.a Axis-3.

It goes from -1 to 1 ... but IMO, it goes the wrong way. You can wire the Axis3 (throttle) axis directly into the Tilt servo's SET POSITION. You might want to throw a "negate" in between if it acts backwards.

umangv620
13-02-2010, 00:11
The "thing" between buttons 8 & 9 is called the Throttle ... a.k.a Axis-3.

It goes from -1 to 1 ... but IMO, it goes the wrong way. You can wire the Axis3 (throttle) axis directly into the Tilt servo's SET POSITION. You might want to throw a "negate" in between if it acts backwards.

That is actually a good idea! I never knew that little thing on the front of the joystick was Axis 3.

btw(by the way), i created a post JUST like this, but I have code that does work(with the lightbulb on). I am still trying to figure out why the camera servo itself isnt working when we deploy the code.

mcristina444
13-02-2010, 00:53
Thanks for all the quick replies! sorry i cant take screen shots of the programming i have already done. what i basically set up was button 8 going into a case structure. (in true) i called up the Get angle then added 10 to it the put that value into Set Angle. it showed a red dot at Set angle. we deployed this code and nothing happened. is there a way to fix the red dot or should we use another Vi such as Set Position and Get position?:confused:
Also i did get the Throttle to work. all we added was a negate because it was backwards. :)
Again thanks for all the help. This is the second year I have been on the team and i am already the head programmer on my team.

Alan Anderson
13-02-2010, 08:35
i called up the Get angle then added 10 to it the put that value into Set Angle. it showed a red dot at Set angle. we deployed this code and nothing happened. is there a way to fix the red dot or should we use another Vi such as Set Position and Get position?:confused:

The dot is because Get Angle provides an unsigned 16 bit integer, and Set Angle wants a signed 32 bit integer. They are compatible, but not identical. You are right to be concerned about it, but this particular red dot is to be expected and causes no problems.

Alan Anderson
13-02-2010, 08:36
I am still trying to figure out why the camera servo itself isnt working when we deploy the code.

Do you have the 6v power jumper installed next to the PWM pins going to the servo?

mcristina444
13-02-2010, 09:36
The dot is because Get Angle provides an unsigned 16 bit integer, and Set Angle wants a signed 32 bit integer. They are compatible, but not identical. You are right to be concerned about it, but this particular red dot is to be expected and causes no problems.

If there is compatibility then why isnt our robot responding? do i need to add a converter Vi in between that? or is there something else wrong with our code?:confused:

umangv620
13-02-2010, 18:13
The "thing" between buttons 8 & 9 is called the Throttle ... a.k.a Axis-3.

It goes from -1 to 1 ... but IMO, it goes the wrong way. You can wire the Axis3 (throttle) axis directly into the Tilt servo's SET POSITION. You might want to throw a "negate" in between if it acts backwards.

We got our camera servo working using axis 3.
to take into account the -1 to 1, the value given by the axis was divided by 4, and then added .5, so the total value would go from .25 to .75(since we dont need the camera to go up and down all the way)

Alan Anderson
14-02-2010, 00:43
If there is compatibility then why isnt our robot responding?

I don't know why your robot is not responding. You haven't given enough information about how you're trying to make it do what you want it to.

ecnahc515
14-02-2010, 01:26
That is actually a good idea! I never knew that little thing on the front of the joystick was Axis 3.

btw(by the way), i created a post JUST like this, but I have code that does work(with the lightbulb on). I am still trying to figure out why the camera servo itself isnt working when we deploy the code.

Make sure you have a jumper on the pwm channel your using for the servo.

Also I have a question:

Im using axis 3 as a throttle to control the speed for our robot. Basically I wana be able to move it down to make our robots motors run slower so going over the bump isnt so fast and reckless.

I did it with controls, but I wana do this with the actual axis 3 button.

How would I go about doing it. These two are what I have:


http://img130.imageshack.us/img130/7972/throttlecontrol2.th.png (http://img130.imageshack.us/i/throttlecontrol2.png/)

http://img403.imageshack.us/img403/6982/throttlecontrol.th.png (http://img403.imageshack.us/i/throttlecontrol.png/)

umangv620
14-02-2010, 23:12
Make sure you have a jumper on the pwm channel your using for the servo.
That wasnt the problem. Our original code had button 2 moving the camera up and button 3 moving the camera down, and that was not moving the camera for some reason. Without touching the electrical board, we changed the camera servo code so that it moves according to the values given by Axis 3, the camera started moving. I dont know why it didnt work before, but it works now, which is one less thing for us to worry about :)