### leonardo46

I'm experimentig the interesting relative servos function, and I don't understand the mathematical relationship between master and slave servo positions . Can some ezb expert write some equation or a flow-chart describing what the position of slave servos will be, in function of the master servo position ? considering that each servo has its max-min limits and each slave servo has a ratio and could be also inverted ? And what values may "ratio" assume, in what range? entire numbers or decimal ? Such parameters may be quite different among the various servos causing an hardly predictable behavior. Example: Master servo limits :50-160 slave servo1 limits : 1-70 ratio =2 slave servo2 limits: 90-180 ratio=1 slave servo3 limits: 45-80 , inverted , ratio=1,5 What will happen in this case ?

#1If the ratio is 2, then the definition of ratio is applied to the slave servo from the master servo. 2 would be 2 times. That means multiplying something by 2 would be double the masters value. Here's an example...

If the master is in position 10 and the slave ratio is 2, the slave will be 20. If the slave min is 30, then the slave will be 30

Ratios or math multiplication can also be decimals using . (Point for decimal). That means you can have a ratio of 2.5, for example. 2.5 times 10 is 25.

Lastly, numbers can be negative values as well. This is done by putting a minus sign in front of the number. Such as -2.

So all slave servos move into a position relative to the master position * ratio. However, the slave position will never be lower or higher than its min/max, respectively.

#2Here's some additional info

Servo control tutorial: https://synthiam.com/Tutorials/Lesson/49?courseId=6

Relative servo control: https://synthiam.com/Tutorials/Help.aspx?id=158

#3ok,DJ, I'm starting to understand. But I have some more question.

If master is 10 and ratio is -2 slave will be -20 . Whatever position will the slave go to ? (servos can go from 0 to 180)

Where will the slave goto , if I check "invert" ? e.g. master=10, ratio=2 , invert=checked, slave =? It's the same as putting a minus sign to ratio ?

ratio can be any value ? e.g. 50 ? I think the slaves should move where is calculated, but only if they don't exceed their limits.

4)is there a way to monitor the number showing slave servos positions ? In the relative servos windows I can see only the same number of the master !

Thanks for your help.

#4hi leonardo

as they cannot go below the limit they will only remain in the min position, assuming initially it is in the min position. If the ratio is negative it will move in the opossite direction by that value.

The same applies here, if intverted is selected and the ratio is 2, then it is the same as having a -2 ratio

I think they can, but that depends on your application, a ratio of 50 is too big

It should, someone more experienced than me might be able to help you

correct me if I am wrong, I am just getting started

#5Use a servo summary, a servo control, or a script, or a virtual robot control to view servo positions: https://synthiam.com/Tutorials/Help.aspx?id=187

All answers to your questions are in my previous response and the referenced tutorial.

#6Hello, Mexican member. Here are my last discoveries about relative servos. Now I'm seeing what slave servos do, using the servo summary window.

Hi, Dj, the minus sign for "ratio" seems to have no effect. Simply it's ignored. Everything works as expected, except for the "invert" function, whose outputs for slave servos are quite strange. I don't understand what rules they follow :

limits=full range 1-180, ratio 1.5, invert=checked master :50 , 60,70,80,90,100 slave :105, 90,75,60,45,30

Dj, can you explain what's the rule ? What algorithm is used in the code for this function?

#7hi leonardo

It is not strange, it is just inverted

look:

for a master 50: slave should be 75(with 1.5 ratio), but with inverted checked the position is 105 that is : 180-75=105 the same applies to the other positions:

60 master , slave 90--------(180-90), (max value - non inverted position) 70 master , slave 75--------(180-105) 80 master , slave 60--------(180-120) 90 master , slave 45--------(180-135) 100 master , slave 30--------(180-150)

I hope it is clear now

#8It is clear , Juan. Now I know the relationship I was looking for, to calculate slave positions. Here it is : slave =master*ratio , if non inverted slave =180-(master *ratio) , if "inverted" is checked The minus sign for ratio has no effect. You gave the answer I was asking ! Thanks.