Commanding Maxon Motors EPOS2 Motor Controller from MATLAB

Version 2.0 (226 KB) by Eugenio
These are some files for commanding a Maxon Motors EPOS2 motor controller from MATLAB
1.4K Downloads
Updated 15 Jan 2019

View License

Sometimes is desired to control inside MATLAB a Maxon Motor connected to a EPOS 2 motor controller. It is possible to do that with this files, and the submitted tool differs from other in that it uses USB bus. This tool is primary targeted to the study and research in Robotics, where it is wanted to move a custom robot using inverse kinematics without worrying about low level communication and real time performance.
1) For proper use, first download and install the EPOS2 libraries,

In Linux:
- Download and install in the system the libraries: libEposCmd.so and libftd2xx.so
http://www.maxonmotor.com/medias/sys_master/root/8815100330014/EPOS-Linux-Library-En.zip

In Windows:
- Download and install EPOS2 USB driver following the link,
http://www.maxonmotor.com/medias/sys_master/root/8811482415134/EPOS-USB-Driver-Installation-En.zip
- Download and copy to directory "Epos2Windows" the files,
EposCmd.dll, EposCmd.lib
EposCmd64.dll, EposCmd64.lib
vxlapi.dll, vxlapi64.dll
http://www.maxonmotor.com/medias/sys_master/root/8815100133406/EPOS-Windows-DLL-En.zip

2) Next, compile the files calling the script "Make". The script requires that "mex" was properly setting up.

Example of use:

Files "test_epos.m" and "test_epos2.m" contain some example of controlling EPOS2 Motor Controller.

Examples:

Examples:

From "test_epos.m",

>> a = OpenCommunication;

Connecting to node 1

>> b = GetErrorState(a, 1);
>> ClearErrorState(a);
>> EnableNode(a, 1);

Setting Node 1 to "Profile Position" type >> help SetOperationMode for further information

>> SetOperationMode(a, 1, 6);

Profile veloctiy of 300 rpm and profile acceleration of 300 rpm/s

>> SetProfilePositionData(a, 1, 3000, 3000);

Move 132000 quadrature pulse in absolute position

>> MoveToPosition(a, 1, 132000, 1);

Stop

>> QuickStop(a, 1);

Close

>> CloseCommunication(a);

From file "test_epos2.m",

Motor1 = Epos2(1);
If (Motor1.IsInErrorState)
Motor1.ClearErrorState;
End
Motor1.EnableNode;
Motor1.SetOperationMode( OperationModes.ProfilePositionMode );
Motor1.MotionInPosition( 132000 );
Motor1.MotionInPosition( -132000, 4000, 6000, 1);
Motor1.Stop;

delete Motor1

Cite As

Eugenio (2024). Commanding Maxon Motors EPOS2 Motor Controller from MATLAB (https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Communities

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
2.0

Added Win2Linux.h and manuals in spanish

1.0.0.0