0% found this document useful (0 votes)
294 views

Commanding Maxon Motors EPOS2 Motor Controller From MATLAB - File Exchange - MATLAB Central

Commanding Maxon Motors EPOS2 Motor Controller From MATLAB - File Exchange - MATLAB Central

Uploaded by

matheus_ccc2450
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
294 views

Commanding Maxon Motors EPOS2 Motor Controller From MATLAB - File Exchange - MATLAB Central

Commanding Maxon Motors EPOS2 Motor Controller From MATLAB - File Exchange - MATLAB Central

Uploaded by

matheus_ccc2450
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

File Exchange

Commanding Maxon Motors EPOS2 Motor 5.0


4 Ratings
Controller from MATLAB 29 Downloads 
version 1.0 (85.6 KB) by Eugenio Updated 29 Oct
2015
These are some files for commanding a Maxon Motors
View License
EPOS2 motor controller from MATLAB

Add to Watchlist Download

Overview Functions Models

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:

https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 1/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

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;

https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 2/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

delete Motor1

Comments and Ratings (10)


ivan riaño 
19 Mar 2018

ivan riaño im using matlab 2018 and work perfectly, the errors described before sounds like you are
19 Mar 2018 not adding the .dll and .lib files to the "Epos2Windows" folder

Camille same Problem,. Please help


Huber
26 Oct 2017

Joris Mens 


6 Oct 2017

Pedro Same problem as gergely and Cheng again. Any ideas? Thanks!
Muñoz
12 Jul 2017

T_R 
17 Jan 2017

Cheng Yuen I also have the same problem as gergely.. Could you pls help? Thank you!
Ong
20 Dec 2016

gergely racz Hello,


6 Aug 2016
Thank you for uploading, It does not run for me.
First it could not detect the win64 as "computer" so I set win64 to 1 and win 32 to 0. Then I
got this message during compilation:

C:\MATLAB\R2013B\BIN\MEX.PL: Error: Compile of 'OpenCommunication.c' failed.

Unable to complete successfully.

Error in Make (line 59)


eval( char(strcmd) )

Plus a ton of other error in communication within the Definition.h file. Please let me know.
Thank you for your help, much appreciated. I also have EPOS 24 not EPOS P. Does that
matter just to retrieve position information?

behzad 
3 Aug 2016
Thanks a lot.

Vahid Hi,
Mehrabi
27 Apr 2016 I have a problem in making the code in MATLAB UBUNTU. It gives me error as below:
/Epos2/Epos2/OpenCommunication.c:12:23: fatal error: Win2Linux.h: No such file or
directory compilation terminated.
https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 3/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

I would appreciate if you could help me.


Thanks
Vahid

Requires
MATLAB

MATLAB Release
MATLAB 8.2 (R2013b)

Tags
epos2 motor contr...

Cancel Save

Acknowledgements
Inspired: EPOS2 Support for Simulink Coder in Linux and Raspberry PI

MATLAB Online Live Editor Challenge


Win cash prizes and have your live script featured on our website

 Learn more

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Epos2/

Clean.m

https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 4/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

ClearErrorState(handle,delete *.mexa64
delete *.mexa32
nodeid) delete *.mexw32
delete *.mexw64

CloseCommunication(handle)

DisableNode(handle,
nodeid)

EnableNode(handle,
nodeid)

Epos2

FindHome(handle,
nodeID, type)

GetCurrent(handle,
nodeid)

GetErrorState(handle,
nodeid)

GetObject(handle,
nodeID,
Index,...

GetOperationMode(handle,
nodeid)

GetPosition(handle,
nodeid)

GetVelocity(handle,
nodeid)

HommingMethods

IsTargetReached(handle,
nodeid)

Make.m

MoveToPosition(handle,
nodeid, p...

MoveWithVelocity(handle,
nodeid,...
https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 5/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

OpenCommunication

OperationModes

QuickStop(handle,
nodeid)

SetCurrent(handle,
nodeid, value)

SetObject(handle,
nodeID,
Index,...

SetOperationMode(handle,
nodeid,...

SetPosition(handle,
nodeid,
pulses)

SetProfilePositionData(handle,
n...

SetProfileVelocityData(handle,
n...

SetVelocity(handle,
nodeid, velo...

test_epos.m

test_epos2.m

WaitForTargetReached(handle,
nod...

waitfortreal(tsim)

Epos2/

TestCurrentMotor.slx

testMaxonMotors.slx

https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 6/7
18/04/2018 Commanding Maxon Motors EPOS2 Motor Controller from MATLAB - File Exchange - MATLAB Central

mathworks.com
© 1994-2018 The MathWorks, Inc. MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or
registered trademarks of their respective holders.

https://www.mathworks.com/matlabcentral/fileexchange/53735-commanding-maxon-motors-epos2-motor-controller-from-matlab 7/7

You might also like