Asked

How To Send 'Controlcommand' Via Custom Skill C# Code?

how to send 'ControlCommand' via custom skill c# code? I'm trying to add Talk servo v2 skill, then add my custom skill, and in code use:


base.SendCommand("Talk servo v2", "Speak", transcribedText);


but it not working, how to use sendcommand to send command to another skill in c#?


Related Hardware EZ-InMoov Robot Head
Related Control Talk Servo v2

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
Canada
#1  

To send a ControlCommand to another skill from your custom skill written in C#, you need to use the EZ_Builder.Scripting.Executer class available in the Synthiam ARC SDK. The Executer class provides methods to execute EZ-Script commands programmatically from within your C# code, including sending ControlCommand to other robot skills.

Here's a step-by-step guide on how to do it:

  1. Add a Reference to the ARC SDK: Ensure your custom skill project references the necessary Synthiam ARC SDK libraries. This is crucial for accessing the Executer class and other ARC functionalities.

  2. Using the Executer Class: In the part of your code where you want to send the ControlCommand, you'll use the Executer class to execute the command as a string. The ControlCommand should be formatted just like how you would use it in an EZ-Script.

  3. Example Code: Below is an example of how you might write the code in your custom skill to send a ControlCommand to the "Talk servo v2" skill to execute its "Speak" command.

using EZ_Builder.Scripting;

public void SendTalkServoCommand(string textToSpeak) {
    // Format the  ControlCommand as a string
    string command = string.Format("ControlCommand(\"Talk servo v2\", \"Speak\", \"{0}\")", textToSpeak);

    // Use the Executer class to run the command
    Executer.ExecuteScript(command);
}
  1. Calling the Method: You can now call the SendTalkServoCommand method from anywhere within your custom skill code, passing the text you want the "Talk servo v2" skill to speak.
// Example usage
SendTalkServoCommand("Hello, I am your robot.");

This example demonstrates how to programmatically send a ControlCommand to the "Talk servo v2" skill to make it speak the text you provide. Make sure to replace "Talk servo v2" with the exact title of the Talk servo v2 skill in your ARC project if it's different. Also, adjust the command and parameters according to the specific ControlCommand you wish to send to other skills.

Remember, this approach requires that the "Talk servo v2" skill (or any other skill you're targeting) is already added to your ARC project and properly configured.


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
Synthiam
#2  

You can do what athena suggested but it's more effecient to send the command directly...

  1. base.controlcommad() of course isn't going to work because you're calling the base of the abstract class which your robot skill overrides

  2. the manual here says if you search for controlcommand: synthiam.com/Support/Create-Robot-Skill/ARC-Classes

Quote:

Method: ARC.FormMain.SendFormCommand( System.String, System.String, System.String[] )

Send a ControlCommand() to the specified control on any desktop.

I think the way to use it is something like...



EZBManager.FormMain.SendFormCommand();


There's also stuff in EZBManager.FormMain that lets you query all robot skills to find one by a specific type to ensure it's there..


      EZBManager.FormMain.GetControlsAllPages()