ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

PRO
France
#1  

@Athena thanks for the answer, I want to do more than control the speed of the servo in position mode. What I need to do is put the servo in a different operational mode by writing to the mode control register. Specifically I need to set the servos to speed mode and then move all the servos to initialise. How can I write to a specific register in the servo?

PRO
Canada
#2  

Below is some information on how you might approach writing directly to a servo register for your Feetech servo:


1. Outof-the-Box Capabilities

The Feetech Serial Bus servo skill included with ARC is built around the standard commands (position, speed, acceleration, and so on) and does not expose a direct method to write arbitrary values to internal registers such as the mode control register. In other words, you can control key parameters-but there isn’t a built-in function to send a "raw" register write command via the standard skill config or scripting.


2. Customizing or Creating Your Own Skill

If you need to change the servo’s operation mode (for example, setting it to speed mode by writing to a specific register), you have two main options:

  • Extend the Existing Skill:
    You might explore modifying the Feetech Serial Bus servo skill code (if you have access) to expose an extra function that allows you to send a custom command. This would involve using the servo’s protocol (typically documented by FeeTech) to send a command packet that writes the desired value into the mode control register.

  • Create a Custom Robot Skill:
    If modifying the existing skill is not an option, you can create your own custom skill that directly communicates over the serial (or UART) line with your servo. You would construct the command packet (using the servo documentation) that writes to the control register. For guidance on creating a robot skill, take a look at our guide:
    How to Create a Robot Skill.

In your custom skill script, you would typically:

  1. Format your command packet. For example, many servo protocols require a header, servo ID, command type, register address, data, and a checksum.

  2. Send that packet over the appropriate communication channel (either via the EZB’s serial send functions or a COM port if you’re using an external controller).

  3. After writing the register, you can then send further commands (such as a speed command) to initialize movement.


3. Scripting Example (Conceptual)

Below is a simplified JavaScript pseudo-code example that outlines what such a command might look like, assuming you know the exact protocol format:

// Example: Constructing a register write command packet

// Define your servo parameters and protocol constants
var servoId = 1;              // Adjust as needed, servo ID (corresponds with virtual port, e.g., V1)
var registerAddress = 0xXX;   // Replace 0xXX with the correct register address for mode control
var modeValue = 0xYY;         // Replace 0xYY with the value that sets "speed mode"
var header = 0xFF;            // Example header - check your servo documentation
var command = 0x10;           // Example command identifier for "write register"

// Function to calculate checksum (this is just illustrative)
function calculateChecksum(packet) {
    var checksum = 0;
    for (var i = 0; i < packet.length; i++) {
        checksum += packet[i];
    }
    return (~checksum) & 0xFF;
}

// Build the packet array
var packet = [header, servoId, command, registerAddress, modeValue];
var checksum = calculateChecksum(packet);
packet.push(checksum);

// Convert packet array to byte format if needed (depends on your implementation)
// Now send the packet over the serial link
// Example using ARC EZBManager's SendSerial method (modify as appropriate):
ARC.EZBManager.SendSerial("D3", EZBUART_BAUD_RATE_ENUM._1000000, packet);

// Log for debugging
print("Sent register write to servo: " + packet.toString());

Note: The above code is conceptual-you will need to match the exact protocol specified by FeeTech for writing to the mode control register. The key takeaway is that ARC does not directly provide a "write register" command in the current Feetech skill, so a custom solution is required.


4. Next Steps & Follow-Up

  • Review the Feetech Documentation: Make sure you have detailed documentation from FeeTech about the servo command protocol. This will tell you the correct format for a register write.

  • Decide on a Skill Approach: If you’re comfortable with scripting and the ARC API, you might implement this as part of your own custom robot skill. Otherwise, modifying the existing skill code (if permitted) may be another route.

  • Ask for Guidance if Needed: Do you need further details on how to set up a custom skill for sending custom serial commands? I can help guide you through the process or answer additional questions if you’d like.

Let me know if you need more help or further clarification on any of these steps!


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.