Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.
Get Started

Asked

C# Question About Invoking A Custom Action

Trying to call

EZBManager.MovementManager.GoCustom("Bow");

from a button click to invoke the canned Bow action.  Does nothing.  What am I missing?


Related Hardware EZ-Robot JD Humanoid
AI Support Bot
Related Content
Synthiam
Synthiam
#1  
Here you go - you have to bind to the movement event and retrieve the name of the custom action.

Code:


using System;
using System.Windows.Forms;
using ARC;

namespace Custom_Movement_Example {

public partial class MainForm : ARC.UCForms.FormPluginMaster {

readonly string MOVEMENT_JUMP_ID = "Jump";

public MainForm() {

InitializeComponent();

// show a config button in the title bar. Set this to false if you do not have a config form.
ConfigButton = true;

// Bind to the movement event for every movement that is specified this will raise
EZBManager.MovementManager.OnMovement2 += MovementManager_OnMovement2;
}

private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {

// Unbind from the movement event when the form is going away
EZBManager.MovementManager.OnMovement2 += MovementManager_OnMovement2;
}

private void MovementManager_OnMovement2(MovementManager.MovementDirectionEnum direction, byte speedLeft, byte speedRight) {

if (direction == MovementManager.MovementDirectionEnum.Custom && EZBManager.MovementManager.GetCustomMovementId == MOVEMENT_JUMP_ID) {

// Handle the code here for the custom movement type
}
}

private void btnCustomMovement_Click(object sender, EventArgs e) {

// This will execute the custom movement action

EZBManager.MovementManager.GoCustom(MOVEMENT_JUMP_ID);
}
}
}