Tag Archives: usb

Minimal c++ class for Maxon EPOS2

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

<Download>

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-

“Failed to open USBDynamixel” troubleshooting

Recently I met a problem while opening Dynamixel motors with USBDynamixel like the below picture.

My environment is Ubuntu 12.04 and patched with RT-preempted to make my PC real-time.

The solution is very simple, just use “sudo“.  You can see the result in the below picture.
Screenshot from 2014-11-04 12:52:52