All Tutorials / DJ Sures / How To Make An EZ-Builder Plugin

How To Make An EZ-Builder Plugin

Custom Movement Control

The EZ-Builder software uses controls that register themselves as a Movement Panel. This allows your plugin to listen to movement requests from other controls. When any control or ez-script calls for a movement direction (i.e. Forward, Left, Stop, etc), your plugin can be responsible for moving the robot.

To understand more about how Movement Panels work, read this tutorial.

Here is an example of how to implement code which will respond to movement requests.

Code:


public FormMain()
: base() {

InitializeComponent();

// assign the movement and speed events
// these events will be called when another EZ-Builder control requests a movement direction
EZBManager.EZBs[0].Movement.OnMovement += Movement_OnMovement;
EZBManager.EZBs[0].Movement.OnSpeedChanged += Movement_OnSpeedChanged;
}

private void Movement_OnSpeedChanged(int speedLeft, int speedRight) {

// do something with the speed change
}

private void Movement_OnMovement(EZ_B.Movement.MovementDirectionEnum direction) {

// do something based on the direction

if (direction == EZ_B.Movement.MovementDirectionEnum.Forward) {

// handle custom Forward movement

} else if (direction == EZ_B.Movement.MovementDirectionEnum.Reverse) {

// handle custom Reverse movement

} else if (direction == EZ_B.Movement.MovementDirectionEnum.Right) {

// handle custom Right movement

} else if (direction == EZ_B.Movement.MovementDirectionEnum.Left) {

// handle custom Left movement

} else if (direction == EZ_B.Movement.MovementDirectionEnum.Stop) {

// handle custom Stop movement

}
}