Asked — Edited

## Servospeed Questions And Questions

Whoops! The title was supposed to be ServoSpeed Questions and Issues Unfortunately you can't change the title so we are stuck with "Questions and Questions", Sorry

@DJ_Sures Lately, I and Mickey666Maus have been working with recording the movements from a virtual robot in 3ds with the purpose of playing them back in ARC. This we can do. The problem comes in the timing. That is to say, the length of time it takes to perform a movement in the 3ds animation vs recreating that same timing in ARC. I can break up a given servo movement command into smaller increments and come up with an approximation of the time needed by fooling with the number of incremental movements and, if needed, add some sleep in between. But that tends to introduce jitter in the actual robot and it defeats the purpose of sending larger servo movement commands to the ARC to achieve smoother movement of the servo. For example:

``````
#Assume we are starting at a servo position of 10 degrees.
Servo(D10,110) #Go to 110 degrees.
#The above command will move the servo smoothly.

#As opposed to:
Servo(D10,10)  #Sending out many smaller servo movements.
Servo(D10,12)
Servo(D10,13)
Servo(D10,15)
|
etc.
|
Servo(D10,110)

``````

The smaller increments solve the timing problem, but introduce jitter in the robot.

The obvious answer is to use the ServoSpeed instruction in EZ-Script. The current problem with that is the ServoSpeed has no fine increments between 0 and 1. You essentially go from full speed to less than 1/3 of full speed when going from ServoSpeed(D10,0) to ServoSpeed(D10,1). I did some time trials and found this relationship for the first 6 ServoSpeed numbers:

``````
# To move 179 degrees
# -------------------
#Servo Speed =0 =550ms   1.00x (Base Speed)                  3.07 ms/degree  0.326 Degrees/ms
#Servo Speed =1 =1940ms  0.28x (550)    0.28x (Base Speed)  10.84 ms/degree  0.092 Degrees/ms
#Servo Speed =2 =3880ms  0.50x (1940)   0.14x (Base Speed)  21.68 ms/degree  0.046 Degrees/ms
#Servo Speed =3 =5600ms  0.70x (3880)   0.10X (Base Speed)  31.29 ms/degree  0.032 Degrees/ms
#Servo Speed =4 =7400ms  0.76x (5600)   0.07x (Base Speed)  41.34 ms/degree  0.024 Degrees/ms
#Servo Speed =5 =9200ms  0.80x (7400)   0.06x (Base Speed)  51.40 ms/degree  0.019 Degrees/ms
#Servo Speed =6 =11100ms 0.83x (9200)   0.05x (Base Speed)  62.01 ms/degree  0.016 Degrees/ms

``````

As you can see it goes from full speed to 0.28% of full speed at a ServoSpeed of 1. That's a huge difference. The difference is not so much between the rest of the number settings.

All this leads to my question: Would it be feasible to break up the allowed values between 0 and 1 (at least) into finer increments? For example allowing decimal fractional values such as ServoSpeed(D10,1.2). ServoSpeed(D10,1.6) ... etc. ? This, so as to achieve more possible speed values between 0 and 1.

Using decimal fractions would maintain compatibility between the new and the old so no old scripts would be broken by such a modification

Also, a more general question: Is the servo movement operation independent of what is going on in ARC at any given moment. That is to say, is it running on a separate C# thread such that the servo will move at a constant rate regardless of the load on ARC? Within reason, of course.

Thank you.

### Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

PRO
USA
#1

Quick inline responses:

#### Quote:

Would it be feasible to break up the allowed values between 0 and 1 (at least) into finer increments? For example allowing decimal fractional values such as ServoSpeed(D10,1.2). ServoSpeed(D10,1.6) ... etc. ? This, so as to achieve more possible speed values between 0 and 1.

Can't be done

#### Quote:

Is the servo movement operation independent of what is going on in ARC at any given moment.

Yes

#### Quote:

That is to say, is it running on a separate C# thread such that the servo will move at a constant rate regardless of the load on ARC? Within reason, of course.

No, it runs on the EZB firmware.

Next post more details.

PRO
USA
#2

Analog servos, don't have speed control.

When you have an analog servo attached to a micro-controller, the basic operation is to tell the servo to move to a specific position (microseconds).

The speed is implemented on the EZB firmware, something like this (pseudo-code):

``````
for pos=currentPosition; pos&lt;requestedPosition; pos+=speedStep
begin
moveServo(pos)
sleep(speedMs)
end

``````

each speed (1-10) has different values for speedMs and speedStep.

ARC transmits to the EZB the servo speed (byte): 0 to 10 associated to the digital port.

check my post #4: https://synthiam.com/Community/Questions/9081

#3

@ptp Thank you very much for your reply. So the ServoSpeed thing is actually implemented in firmware on the EZB itself. Most unfortunate. For me that is. That leaves me with only couple of options. One, option being to implement it in a script. A method which will not be very accurate or repeatable. However, if the movements in the 3ds virtual robot can be constrained to a certain set of movement parameters, or made to fit those parameters as close to the desired movement as possible during post possessing, it may still work out. The trick will be coming up with those parameters.

The other option would be to write a C# program, either as a stand alone program or a Plug-in. At least that way I would have access to a real-time clock and interrupts. Choices, choices.

Thanks again!

#4

I have a question for the question. The servo travel is 0 to 180 degrees ( approx. ) ( x resistance for 0 to full travel). If additional gear reduction was added or the potentiometer value was changed in the servo ( doubled ), would the servo have a reduced travel, but finer steps? The position values would then be able to be larger. Would the jitter decrease? I am a mechanical guy just throwing a question in the mix. This may be dumb, but was just a thought.

Ron

#5

@Andy Roid.... No, same travel, same resolution only it will move slower.... As an example... My inMoov's joints go through a gear reduction gearbox or jack screw for mechanical advantage reasons... They can only travel the same distance (unless limited mechanically like inMoov's elbow) with the same 1 -180ish resolution... It's the potentiometer (and servo electronics) that control the resolution...

If you use a stepper motor instead you can get about 1600 micro steps per 180 deg rotation.... Over 8 times the resolution of a hobby servo

#6

As long as we are throwing around questions, I have another, totally unrelated to speed.

It is my understanding that each script, while executing, is running it's own underlying C# thread. Is that correct?

#7

I just thought the jitter would be reduced because the steps on the output would be finer. Thanks Richard

#8

WB, I asked this question a while ago. The answer was yes. Each script runs on it's own thread. I donβt know how many threads are available to ARC to run on. My understanding was that the multi threading was handled by windows.

PRO
Synthiam
#9

Ptp is correct - however I would like to reference how the Auto Position control works to aassist in this question. Move every position like you said, but increment larger positions when faster speed is necessary. To smooth out jerkiness, use a servo speed value of 1.

#10

@DJSures We were also figuring that driving the servo movement with ARCs AutoPosition opposed to using EZ-Script might have some effect on getting better results. Would it be possible to make an import function, just like the export function within the AutoPosition of ARC? To generate the code that is needed for import should not be a problem on our side!

Just something that crossed my mind...

PRO
Synthiam
#11

There already is an import - you can use an export to save as an .autoposition file and see the format. Then you can generate the xml to have it import.

#12

@DJSures Thanks....I was not aware it is already build in! Sweeeeet!

PRO
Synthiam
#13

Let me know if you have any questions regarding the XML .autoposition file. I can help you create an exporter. Or you can simply use the EZ-SDK in your app and populate the AutoPosition Action and Frame classes and export them as XML like so...

*where config == EZ_B.Config.Sub.AutoPositioner

``````
using (FileStream fs = new FileStream(&quot;myfile.autoposition&quot;, FileMode.Create, FileAccess.ReadWrite)) {

System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(EZ_B.Config.Sub.AutoPositioner));

xs.Serialize(fs, config);
}

``````
#14

@Dave_Schulpius Thank you for your response. Good to confirm that since it answers a question I had on using a counter as a timer instead of the Sleep instruction.

@DJ_Sures Thank you as well for your posts. The information you provided opens some new and intriguing possibilities. Likewise thanks for your offer to assist on an exporter.

#### Quote:

Move every position like you said, but increment larger positions when faster speed is necessary. To smooth out jerkiness, use a servo speed value of 1.
Of course! How stupid of me to not realize that. Forest for the trees kind of thing I guess.

Thanks again!

#15

WB, that servo setting info for the auto positioning control helps me also. I sometimes have jitter problems with my B9 robot arms if I try to move them to fast. I've been dealing with servo speed for years now and still struggle at times. Some things just don't come to me easley sometimes.

PRO
Synthiam
#16

Servo jitter can mostly be the cause of over powering after market servos (not ezrobot servos). Ezrobot servos are designed for 5-7.4 volt cells. Where aftermarket servos will not generally not support more than 6v. The jitter may be caused by over voltage - which is the most common symptom of aftermarket servos.

If your servos and voltage is within spec, disregard this post - however, keep it in mind for future reference.

#17

Humm, very good to know. Generally I try not to overvolt my servos but I do take them up to max ratings. Thanks!

##### Posting community content is currently offline as we upgrade our servers!

π Get ready for exciting new features with ARCx! From July 28th to August 3rd 2024, content posting is on a brief vacation, but you can still read existing posts.

##### Curious about the upgrades?

π Click the button below to learn about the upcoming ARCx, the next generation of Synthiam's robot softare platform. Thank you for your patience during this upgrade!