Maxon EPOS2 Driver C++ Class using USB-CAN Gateway for Multiple Motor Actuation

I am sharing a C++ Class for multiple Maxon motor actuation by EPOS2 via USB-Can gateway.

The source code is written for two motors, but it is possible to modify easily to actuate multiple motors.


If you want to see a simpler version for one motor actuation, see this article. 

I hope this article makes your life easier.


7 thoughts on “Maxon EPOS2 Driver C++ Class using USB-CAN Gateway for Multiple Motor Actuation

  1. Pingback: Minimal c++ class for Maxon EPOS2 - Youngmok Yun: Roboticist in The Univ. of Texas at Austin

  2. Kamil ORMAN

    Hi, Thanks for this very useful work.
    Can you help me about: Maxon EPOS2 driver (MATLAB class) using USB-CAN for two maxon motor.
    i’m very happy if you have some code and send me,
    Best wishes

    Kamil ORMAN (PhD Student)

    1. admin Post author

      HI, Kamil. Have you tried to use the attached file? It includes a class for Maxon EPOS2 and a demo program. If you have a problem to use this, please let me know.

  3. Kamil ORMAN

    Hi Youngmok,
    I tried to test this code but I didn’t succeed. I’m very new at GNU licensed code.
    I know that bother you, but I’ll be very happy if you help me.
    I’m working on the system as follows: 2*maxon EC motors and 2*EPOS2 50/5 (AGV). I want to control this system with MATLAB.

    ->node1 connected to the computer via USB and node2 connected to node1 via CANopen. I tried this connection via Epos studio and i run both nodes. now I want to run in the MATLAB (real-time) or I can try with visual c++ 2010 express. (I haven’t tried yet the RS232 interface)

    if you send this code (you share it here) to me as Matlab code or as visual c++ project, I would be very pleased.

    Best wishes


    1. admin Post author

      Sorry I do not have visual studio, and MATLAB is completely different…. As long as I know, you may download some example files for those platform from Maxon website.

  4. Esa

    Hi ,

    Can you please describe the setup for this code to work?

    Does the computer link to one EPOS controller via USB ?

    Do you then you have a secondary EPOS controller connected to the first EPOS controller via the CAN interface connector ? J7 or J8 ?

    I am using the EPOS2 70/10

    Do we need to put these controllers in a specific mode/settings to get this code working ?


  5. Esa

    I also find this confusing

    PortName_MCP = “USB0″;
    PortName_PIP = “USB1″;

    nodeId_MCP = 1;
    nodeId_PIP = 1;

    ErrorCode = 0x00;

    Does that mean that the Computer is connected to both EPOS2 controller via 2 separate USB cables ?

    what does MCP and PIP stand for ? why do they have the same value?

    I managed get the simpler version of the code you posted (for one motor actuation) working without any issues.

    Any help would be much appreciated



Leave a Reply