Minimal c++ class for Maxon EPOS2
I am sharing the minimal C++ class for Maxon EPOS2. It includes a basic “initialization”, “Move”, “Read position”, “Close device” functions. The program consists of a class called “cmaxonmotor”. You can download the class and demo program here
You can see a simple demo program here.
#include <stdio.h> #include <iostream> #include "cmaxonmotor.h" using namespace std; int main(int argc, char *argv[]) { CMaxonMotor motor("USB0",1); motor.initializeDevice(); // initialize EPOS2 long TargetPosition = -200000; int CurrentPosition = 0; motor.Move(TargetPosition); // move to the target position cout << "Press <Enter> to stop and quit..." << endl; getchar(); motor.GetCurrentPosition(CurrentPosition); // get the current position cout << "Current Position: " << CurrentPosition << endl; motor.closeDevice(); // close EPOS2 return 0; }
You can control one motor just via USB, and also able to control multiple motors via USB-CAN gateway. For this version, see this article.
I hope this helps your project.
-Mok-