Example: Custom Movement Panel
The ARC 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. There can only be one Movement Panel per robot project. This is because there is only one method of locomotion for a robot, which this Movement Panel would be responsible for.
To understand more about how Movement Panels work in EZ-Builder, read this tutorial.
What's In A Movement Panel? A Movement Panel will have buttons that lets the user specify directions that the robot should move. Your Movement Panel will be responsible for the robot moving. This means that anywhere a direction is specified, your control will be responsible for moving the robot. Generally a Movement Panel has speed controls in the form of trackbars of some sort.
Code Example Want to make your own movement panel? Here is an example of how to implement code which will respond to movement requests:
public FormMain()
: base() {
InitializeComponent();
// Assign this control as a Movement Panel so the software knows who owns the movements
EZ_Builder.FormMain.MovementPanel = this;
// Assign the movement locomotion style for this control.
// There are different kind of locomotion for your robot, and this helps other
// controls know what to expect when a movement is happening.
// Check out the ENUM to see what other locomotion styles there are that
// fits your Movement Panel type.
EZBManager.MovementManager.LocomotionStyle = LocomotionStyleEnum.GAIT;
// assign the movement event
// this event is raised when another ARC control requests movement
EZBManager.MovementManager.OnMovement2 += Movement_OnMovement2;
// assign the speed change event
// this event is raised when another control or user changes the speed
EZBManager.MovementManager.OnSpeedChanged += Movement_OnSpeedChanged;
}
private void FormModifiedServoMovementPanel_FormClosing(object sender, FormClosingEventArgs e) {
// Remove this control as a Movement Panel
EZ_Builder.FormMain.MovementPanel = null;
EZBManager.MovementManager.OnSpeedChanged -= Movement_OnSpeedChanged;
EZBManager.MovementManager.OnMovement2 -= Movement_OnMovement2;
}
private void Movement_OnSpeedChanged(int speedLeft, int speedRight) {
// do something with the speed change
}
private void Movement_OnMovement2(MovementManager.MovementDirectionEnum direction, byte speedLeft, byte speedRight) {
// **
// do something based on the speed
// handle speed change here
// **
// Now do something based on the new movement direction
if (direction == MovementManager.MovementDirectionEnum.Forward) {
// handle custom Forward movement
} else if (direction == MovementManager.MovementDirectionEnum.Reverse) {
// handle custom Reverse movement
} else if (direction == MovementManager.MovementDirectionEnum.Right) {
// handle custom Right movement
} else if (direction == MovementManager.MovementDirectionEnum.Left) {
// handle custom Left movement
} else if (direction == MovementManager.MovementDirectionEnum.Stop) {
// handle custom Stop movement
}
}
Is this out of date? There doesn't seem to be a GetConfiguration function within EZ_Builder.Config.Sub.PluginV1
Look at the tutorial step titled Code: Saving/Loading Configuration
The get and set configuration methods are overrides of the form. There’s a great video on the first step of this tutorial that demonstrates the step by step of building a plugin. I recommend watching that because it helps fill in any steps that were missed.
When you’ve done it once, it makes sense and voila, you can rinse and repeat
Excellent, thanks - I will do. I really must learn not to just jump ahead in the process
Hey no problem - I do it all the time, and end up frustrated because I dont know what it was that I missed. Excitement gets the best of me
Trying to follow the tutorials but can't find where the plugin page has gone. How do I add a new plugin to the ez-robot / Synthiam site to get the XML?
Never mind. Just found the "Create skill control" link
I am trying to follow the instructions for adding my own plugin but I cannot seem to find the place to register the plugin based on the instructions.
Any help is appreciated.
Thanks
The new button to create a plugin skill control is less than an inch below the button you pressed to create this question.