PDA

View Full Version : [Question(s)] phidgets servo range



seesoe
04-13-2009, 03:11 AM
hello, im trying to build a paintball turret, i have the gun mounted and working, but im having problems controlling the pan tilt servos

im using the following servos for the pan and tilt http://servocity.com/html/spg785_pan.html (http://servocity.com/html/spg785_pan.html) i have the first 2:1 ratio servo and those servos are connected to the phidgets 4 servo controller.

im trying to understand how to mess with the range of travel. for now im working with roborealm, and i can set the servos at 0 min and 255 max, however the behavior of the servos is weird... i haven't really messed with servos before.

if its on 31 it will stop completely, if its on 0 it will spin full range, and if its on 255 it will spin like 6 times then resides. the lower range number have different positions then the higher range numbers.

im trying to put a range on the pan and tilt so that it wont spin fully and move up and down fully.

essentially i want to control the servos with a usb joystick in the range that i have to have, if at all possible.

seesoe
04-13-2009, 03:41 AM
could something like this be helpful?
http://cgi.ebay.com/HITEC-HPP-21-PC-PROGRAMMER-FOR-HITEC-DIGITAL-SERVO_W0QQitemZ200327192275QQihZ010QQcategoryZ1200 QQssPageNameZWDVWQQrdZ1QQcmdZViewItem

nagmier
04-13-2009, 09:14 AM
The phidgets should be all you need there.

I'm not great with the code, I just received my Phidgets Advanced Servo Controller a couple weeks ago, But if you post some code we might get a better idea of whats going on. Also how are you programming/interacting with your servos, VB.Net C# Python etc???

seesoe
04-13-2009, 10:16 AM
im using roborealm at the time, they have a phidgets plugin, and in roborealm there is a vb script plugin, that i put the following in

320x240 resolution camera ' initialize starting servo values
pan = GetVariable("PAN_SERVO")
tilt = GetVariable("TILT_SERVO")
steering = GetVariable("STR_SERVO")
throttle = GetVariable("THR_SERVO")
' get the size (width or height) of the current bounding box
size = GetVariable("COG_BOX_SIZE")
' if it is equal to "" then no object was detected
if size <> "" then
' get the horizontal center of gravity
cogX = GetVariable("COG_X")
' pan left
if cogX < 140 then
pan = pan - 2
end if
' pan right
if cogX > 180 then
pan = pan + 2
end if
' get the vertical center of gravity
cogY = GetVariable("COG_Y")
' tilt down
if cogY < 100 then
tilt = tilt - 2
' tilt up
end if
if cogY > 140 then
tilt = tilt + 2
end if
'steer where it looks
'adjust 300 accordingly, 300 is due to the steering servo being offset
steering = 300 - pan
'get the distance variable to control the movement
cogSize = GetVariable("COG_BOX_SIZE")
' forward
if cogSize < 30 then
throttle = 130
' reverse
elseif cogSize > 45 then
throttle = 160
else
throttle = 150
end if
SetVariable "STR_SERVO", steering
SetVariable "THR_SERVO", throttle
SetVariable "PAN_SERVO", pan
SetVariable "TILT_SERVO", tilt
end if
this code is from roborealm its self as one of the examples they offer, but this slightly modified one is from
http://www.endurance-rc.com/tracking.html
its diffrent in a sense that it has 2 extra servos to control the robots posstion relative to the turret and the red object.

seesoe
04-18-2009, 12:38 AM
is there a way to hookup an external pot or change the internal one so it wont be more than 360? or like a way to reprogram the servo's?

be cause setting the limit in roborealm works but works kind of messed up, because the gun will go back to the starting position, and when it gets near the max range that i set then it gets slower till it gets there, then when i let go of the joystick it goes back to the starting spot.

anyone have any suggestions or ideas that can help? i have been trying to fix this mess for a very long time now, i can't think of anything.

lnxfergy
04-18-2009, 04:11 PM
OK... so those servos are supposed to rotate up to 630 degrees... don't really see how you are getting 6 rotations.

That said... RoboRealm is just outputting a value to move. Using this (http://www.roborealm.com/help/Phidgets.php) you should leave the min set to 0 and max set to 255, and use the slider to move the servos and find what values correspond to the actual limits you want.

As for the joystick, why don't you post the actual code you are using, we can't just guess and hope to hit the problem on the head....

-Fergs

seesoe
04-18-2009, 06:09 PM
OK... so those servos are supposed to rotate up to 630 degrees... don't really see how you are getting 6 rotations.

That said... RoboRealm is just outputting a value to move. Using this (http://www.roborealm.com/help/Phidgets.php) you should leave the min set to 0 and max set to 255, and use the slider to move the servos and find what values correspond to the actual limits you want.

As for the joystick, why don't you post the actual code you are using, we can't just guess and hope to hit the problem on the head....

-Fergs
well its not really 6 rotations but its like really 3 or 4, i don't know how and why its going like this.
i have tried setting the min and max to 0 and 255 and finding the range i want but the issue is like i said in the previous post is that when the turret gets close to the max point or the point to go to then it goes slower, and when i let go it goes back to the starting point which is the min value set for some reason..

the only sort of code that i am working with is the vb script that i already posted in post 4.

Adrenalynn
04-18-2009, 11:18 PM
Because, as Fergs pointed out, it's a 630 degree servo. It's only rotating 2 times and change, not six times, not three times, not four times.

It slows down so that it doesn't overshoot its mark. That's expected behavior.

Yes, when you let go, it goes back to the starting point because the input recenters itself. Again, expected behavior. Either physically fix the input device not to do that, or fix your code to somehow decide what you're thinking rather than what you're doing.

seesoe
04-19-2009, 05:25 PM
OK... so those servos are supposed to rotate up to 630 degrees... don't really see how you are getting 6 rotations.

That said... RoboRealm is just outputting a value to move. Using this (http://www.roborealm.com/help/Phidgets.php) you should leave the min set to 0 and max set to 255, and use the slider to move the servos and find what values correspond to the actual limits you want.

As for the joystick, why don't you post the actual code you are using, we can't just guess and hope to hit the problem on the head....

-Fergs
well its not really 6 rotations but its like really 3 or 4, i don't know how and why its going like this.
i have tried setting the min and max to 0 and 255 and finding the range i want but the issue is like i said in the previous post is that when the turret gets close to the max point or the point to go to then it goes slower, and when i let go it goes back to the starting point which is the min value set for some reason..

the only sort of code that i am working with is the vb script that i already posted in post 4.