#### Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Resolved by juansystem05!

## Relationship Between Master And Slave Servo Positions

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 ?

Related Content
Synthiam
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
PRO
Synthiam
#1
If 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.
#3
ok,DJ, I'm starting to understand. But I have some more question.

1) 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)

2) 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 ?

3) 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 !

#4
hi leonardo

1) 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.

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

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

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

correct me if I am wrong, I am just getting started
#6
Hello, 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?
#7
hi 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
#8
It 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.