NRMKFoundation framework with EtherCAT

From Neuromeka Wiki
Jump to: navigation, search


NRMKFoundation Framework with EtherCAT

Introduction

Framework Overview

First of all, you should be clear that the framework for a real EtherCAT system is different from the framework for simulation on CatKitViewer. In the framework for EtherCAT, the only role of AppManager is to visually mimic recent states of EtherCAT robot on CatKitViewer. In other words, AppManager is used for visualization but no longer for simulation. Consequently, in this case, we use Animation Socket instead of Control Socket.

NRMKFoundation Framework with EtherCAT

NRMKFoundation Framework with EtherCAT


Framework's File System

The below table describes elaborately the file system hierachy of AppManager and ControlClient respectively. Especially, RTControlClient for EtherCAT contains 2 files more than ControlClient for simulation. Those files are UniversalSystemInterfacePlanar2D.h, which is an interface to EtherCAT robot, and RTControlClientPlanar2D.cpp, which implements real-time control algorithm on Xenomai.

NRMKFoundation Framework with EtherCAT - File System

NRMKFoundation Framework with EtherCAT - File System


Generate RTControlClient for Xenomai (real-time control application)

  • Note:
    • In this tutorial, we used 2-DOF Planar for demostration.
    • We also assume that you already got used to working with NRMKFoundation framework for simulation. Therefore, we skip the section of creating AppManager.


1. Create new Visual Studio Project in the same location as AppManager

From the Framework's File System section, there are some common files such as DefinePlanar2D.h, NRMKFrameworkPlanar2D.h and NRMKFrameworkPlanar2D.cpp, which are used in both AppManager and ControlClient. Thus, we recommend you to put ControlClient and AppManager in the same location (or VisualStudio Solution) so that they can share the files with each other.

Visual Studio - Create new project for ControlClient

Visual Studio - Create new project for ControlClient

2. Specify name and location of ControlClient Project

In this step, you should name your ControlClient and leave the location as default. Moreover, the NRMKFoundation Simulation template is used as well.

VisualStudio - Specify name and location for ControlClient

VisualStudio - Specify name and location for ControlClient

3. Configure ControlClient Project

This step is very important because it impacts directly on the code generated by VisualStudio. Because the control application for EtherCAT will be compiled and executed in Ubuntu with Xenomai, you have to select Generate Xenomai Code option. Furthermore, choosing For ARM Board or For PC option is depended on your EtherCAT master, which is STEP-PC or STEP-iMX, respectively. Other parameters should be set in the same way as ControlClient for simulation.

VisualStudio - Configure ControlClient

VisualStudio - Configure ControlClient

4. ControlClient project after generated

The figure below shows the result after you successfully generate your own ControlClient whose files are listed in the Framework's File System section.

VisualStudio - Generate ControlClient Project

VisualStudio - Generate ControlClient Project

Integrate EtherCAT System Interface into NRMKFoundation Framework

1. Configure AppManager for Real-time EtherCAT Application

According to the Overview section, we know that AppManager for control application with EtherCAT is fairly different from AppManager for simulation. However, in order to ease user's task, we implemented our flexible framework so that user can switch between the senarios (EtherCAT or simulation) with as litte efforts as possible. As demonstrated in the following figure, what you have to do is simply add KIN_CONTROL and _USE_ANIMATION_SOCKET in the list of Preprocessor Definitions of AppManager project in VisualStudio.

VisualStudio - Configure AppManager for EtherCAT

VisualStudio - Configure AppManager for EtherCAT

2. Importing RTControlClient into Eclipse

[Pending for content...]

3. Configure RTControlClient on Eclipse for supporting EtherCAT

Basically, the default code of ControlClient is to work in simulation mode. Therefore, you must add _USE_ETHERCAT in the Preprocessor list of ControlClient project in Eclipse.

Eclipse - Config RTControlClient for supporting EtherCAT

Eclipse - Config RTControlClient for supporting EtherCAT

4. Integrate EtherCAT System Interface into RTControlClient

This is one of essential steps to integrate EtherCAT into control framework. What you have to do is to create a folder named EcatSystem in RTControlClient project and copy EtherCAT source code into this folder. Pleas note that the source code for EtherCAT must be generated by NRMKEtherCAT Config Tool, which consists of PDO Configuration and EtherCAT System Interface.

Eclipse - Integrate EtherCAT System Interface into RTControlClient

Eclipse - Integrate EtherCAT System Interface into RTControlClient

5. Compile & Execute RTControlClient

After successfully passing all previous sections, you can compile and run the control application on your EtherCAT Master (STEP-PC or STEP-iMX). In addition, do not forget to simultaneously execute other components of the framework including AppManager and CatKitViewer for further developing and experimentation.

Eclipse - Compile and Execute RTControlClient

Eclipse - Compile and Execute RTControlClient