Asked
Resolved Resolved by Athena AI!

Linking Opposite Rotating Servos

, i built an robot arm, the shoulder rotates using 2 servos connected on port D0 and D1 on an iotiny. Both servos are mirrored. it means when D0 rotates CW ,D1 must rotates CCW to have the arm moves in the same direction. I made a test using the skills horizontal servo with advanced mode. D0 is the master D1 is the "slave" and i checked invert. It works fine, both servos rotates in the opposite direction. D0 rotates CW, D1 rotates CCW.  I'd like to use auto-position skill. I created an image, i added 2 servos D0 and D1. I can control each servo individually. Is it a way to "link" both servos ? When the servo D0 rotates, the servo D1 must rotate in the opposite direction.


Related Hardware EZ-InMoov Robot Head
Related Control Relative Servos

ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

PRO
Canada
#1  

Hi there,

Linking servos so one servo mirrors the other (i.e. rotates in the opposite direction) is definitely achievable in ARC. While the Auto Position skill itself doesn’t include a builtin linking option, you can accomplish this using the Relative Servos skill. Here’s how you can set it up:


Using the Relative Servos Skill

  1. Add the Relative Servos skill

    • Open your ARC project.
    • Go to Project Add Skill servo Relative Servos.
  2. Configure the Master Servo

    • In the Relative Servos skill settings, designate servo D0 as the Master.
    • Ensure its settings (min/max values, inverted or not) match what you want for the base movement.
  3. Add the Slave Servo

    • Click Add Servo to attach a slave servo.
    • Set servo D1 as the slave.
  4. Set the Relative Ratio

    • In the slave’s settings, set the Ratio to -1.
      For example, if D0 rotates to position 30, with a ratio of -1, D1 will move to -30 (within the configured min/max limits).
      If you need a different scaling, adjust accordingly (e.g., -2 for double the movement in the opposite direction).
  5. Test the Setup

    • In the skill’s main window, move the master servo (D0) and observe if D1 moves in the opposite direction as expected.
    • Adjust any limits if the servo stops moving due to min/max constraints.

Integrating with Auto Position

Since you’re already using an image in your Auto Position skill, you have two options:

  1. Overlay with the Relative Servos Skill:

    • Use the Relative Servos skill to continuously update D1 based on the changes in D0’s value set via the Auto Position skill.
    • This means you keep your Auto Position skill for visual control of D0, and the Relative Servos skill will handle the linked movement for D1 automatically.
  2. Scripted Linking (Alternative Approach):

    • If you prefer to keep everything in one skill, you could add a JavaScript snippet in the Auto Position skill’s script area. For example:
    // Get master servo position (D0)
    var masterPos = getVar("$D0_Position", 0); // Ensure your  Auto Position skill stores the value in a variable
    // Calculate slave servo position (invert the value)
    var slavePos = masterPos * -1;
    // Update D1 using the built-in ARC function
    setServo(d1, slavePos);
    
    • Make sure that the variable name ($D0_Position in the example) matches the one being updated by the Auto Position skill.
    • This approach requires that you manage the value propagation manually but offers more flexibility if needed.

Final Thoughts

Using the Relative Servos skill is generally the easiest route because it’s designed exactly for this kind of servo linking. If you haven’t already, check out the Relative Servos documentation for more details.

Does this approach work for your robot arm setup? Let me know if you have any questions or need further assistance!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Germany
#2  

perfect it works well. I am using Overlay with the Relative Servos Skill. In the auto-position skill , if i modify the servo "master" D0, the servo D1 will move in the opposite direction. The only thing is that, on the image, D1 is not updated. The servo D1 moves, that the most important but the value on the image does not change. D0 value does change. Perfect, really good. The power of skills within ARC  is amazing.

PRO
Canada
#3  

That's great to hear, and I'm glad it's working for you! In ARC, when you use an overlay with the Relative Servos skill, the auto-position skill only updates the master servo's UI display (in your case, D0). The slave servo (D1) is updated behind the scenes via Relative Servos, but its UI value isn't refreshed by the auto-position skill.

This behavior is expected since the auto-position skill isn’t designed to monitor slave servo values-it only tracks the master’s value. The physical movement of D1 is what counts, and as long as it’s moving as expected, you’re in good shape.

If you’d like the D1 value on the image or UI to update as well, you have a couple of options:

  1. Custom Scripting:
    You could add a JavaScript snippet within your auto-position skill or within a script that runs after servo updates. For example, you might add code that calculates the slave value from the master value and then updates a UI element. Here’s a small example:

    // Get master servo D0 position from a global variable or from the skill value
    var masterPos = getVar("$D0_Position", 0);
    
    // Compute the slave servo position (with inversion)
    var slavePos = masterPos * -1;
    
    // Update D1 directly (this moves the servo even though Relative Servos is doing it; 
    // it's just to update the UI number if you have a text control linked, for instance)
    setServo(d1, slavePos);
    
    // Optionally, if you have a text control to display the value, update it:
    // setProperty("txtSlaveValue", "Text", slavePos);
    

    In this script, replace "$D0_Position" with the appropriate variable name that holds your master value and modify the target property (txtSlaveValue) if you have a custom UI element showing the D1 value.

  2. Unified UI Update:
    If updating the D1 value in the same control is critical, consider creating a custom control or overlay where both values can be displayed and updated synchronously by your scripts. This way, you can keep the master and slave values in sync on-screen.

Let me know if this helps or if you’d like to explore one of these options in more detail. The power of skills within ARC indeed opens up lots of possibilities-if you run into any more challenges, feel free to ask!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Germany
#4  

i will leave as it is. As long the movement of D1 follows the master D0, it is ok for me.

PRO
Canada
#5  

That's totally fine-if the physical movement is as expected, that's what matters! It's always good to know you have options if you ever decide you need the UI display for D1 to update as well.

Feel free to reach out if you have any other questions or need further assistance with your ARC projects. Enjoy exploring the power of ARC!


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.