Make servos faster

Hey guys, our robot successfully tracks the target, but when it drives towards it in autonomous, if the speed is high, the robot is likely to lose its target, because the servos do not move fast enough to keep the target in the camera vision.
Is there any method to improve the servos’ speed?

Thanks.

I’m most familiar with the LV code, so that is what I’ll describe. The same stuff is often happening in the C++ example code too.

The servo control VI has proportional constants on its panel. I believe the LV ones are a dividing proportion, so smaller number will lead to bigger delta per pixel away from center. I’d keep the robot still, on blocks or unplugged in order to isolate the servos. Then decide on a repeatable movement, perhaps automated, perhaps approximated by a distance and tempo.

Lower the proportion number and you should see the servo speed up with small changes, and then become unstable as the servo overshoots and starts a feedback. The other thing you can do to speed it up is to turn off the smoothing, and perhaps the deadband. The smoothing will introduce a small lag, and the deadband will allow a small uncorrected error, but I wouldn’t expect either the slow the servo. On the other hand, doesn’t take long to test.

Beyond that, it is a function of the servo HW.

Greg McKaskle

The servos from the kit do there full rotation in something like a half a secound. So my guess is whats limiting you is the speed of your tracking code, not the servo itself.

this site may have the servos you want, im not really sure what some of the stuff means, but you could probably find what you need/want. http://servocity.com/html/servos___accessories.html

Jetweb, I agree, but how can I set the speed of the servos in C++?
In the CProgrammingReference.chm file I see that the Servo class implements a speed controller, but I don’t know how to interface that, partially because of the lack of documentation.

As far as i know there is no speed control for the servos, they will get to where you tell them to go as fast as mechanically possible.

The sad truth is whats slowing you down is the camera. you have to optomize your tracking code as much as you can but even then the image analyzation is still really slow in relitave term.

We moved the camera to the far back of the robot in toder to give it a better perspective and more time to react to changes.

sorry i cant be of more help, maybe someone else has a good idea.

This is not neccesarily true–one can program a servo to work at a certain speed. For example, if you wanted a servo to move to the position represented by 1.0 from the position represented by -1.0. You could do this by

  1. Setting the servo to 1.0
  2. Using a loop to set the servo to -0.9, then -0.8, etc

If you’re using the second method, you should be able to move your servos faster by increasing the amount they move per cycle.

Another thing to keep in mind is that if the you’re getting a low frame rate due to processing delay, it’s pretty easy for the target to leave the frame, since the system can’t update the servos. Something you might want to try is predictive tracking–say, if the 10 previous frames have involved the target moving in a given direction, you can make an assumption and move your camera before processing based on an estimation of the movement speed.

Could you explain more specificly how to do those changes in the VI (searched for “Servo Control.vi”, but realized it was “Set Position.VI”)? Some images of the explanation would really help.
Plus, how diffrent is Set Position.vi compared to the servo control loop in the Two Color Servo Camera Example?

Thanks. :slight_smile:

Greg,

I want to echo Nir’s question. When I open the front panel, I set a PWMDevRef with min’s, max’s, angular range and transforms, but no proportionality constant. I’m not sure we can can make changes there.

I can see how to add a proportionality constant to the set position vi, but then we would be writing to a library VI, which would be overriden with an update.

Greg’s changes were in the Gimbal Control VIs in the camera examples. (The OP’s question was really how to search for the target faster, not how to make servos faster, so that is what Greg answered).

If you are using the servo commands directly (and applying a big enough change), you can’t make the physical system any faster.

I’m sorry for the cofusion, but I wasn’t referring to the Set Angle subVI. I was really referring to the control VI for the servos. It is called Servo Tracking State Machine.

It is an example of taking the current image results, combining it with info from previous results and robot state to determine how best to control the servo based gimbal.

The proportional values are on that panel.

The difference between set position and set angle is that one is integer degrees I believe, and the other is float -1 to 1 I think.

Greg McKaskle

I was wondering if somebody could post a print screen or give me the relative location of the Proportional constants (in LV) that the camera servo’s are using… also based on our programming teams understanding, the camera servo speeds up after every loop that the camera does not obtain a target, I was wondering if our understanding is correct.

We tried changing the numbers for some values which seem to be the proportional constants but we did not see any noticable difference in the speed of the servo. (there was one for the X servo and another for the Y servo… they were linked to a multiply function which was located in the middle loop of the Servo Tracking State Machine.

EDIT: Thanks for the help guys…

The control is called Proportional (div) which means that it is the divisor version. It is located on the Servo Tracking State Machine.vi. The default values are 15 for X and -13 for Y. If you make the numbers larger, the P term will actually be reduced. If you make them smaller, the P term will actually be larger. Feel free to type in fractions too.

If you negate the numbers, the servos will move the opposite direction for a given error – useful for upside down gimbals and such.

Greg McKaskle

I’m currently using a mechnical method of timing the time it takes for the servo to reach from one side to the other by measuring the time from the moment the joystick button was pressed and untill the camera touched a microswitch located at the edge of the camera’s servo opposite side.

I know there are the data sheets, but you can’t always trust things to work the way they say it should work, right? :slight_smile:

If there is another way to check this, please advise.

Thanks,