int HerkuleX::serialInitialize(std::string &devicePath, const int baud)
{
    int status = 0;

    if (serial != NULL)
    {
        serialTerminate();
    }

    // Instanciate a different serial subclass, depending on the current OS
#if defined(__linux__) || defined(__gnu_linux)
    serial = new SerialPortLinux(devicePath, baud, serialDevice, SERVO_DRS);
#elif defined(_WIN32) || defined(_WIN64)
    serial = new SerialPortWindows(devicePath, baud, serialDevice, SERVO_DRS);
#elif defined(__APPLE__) || defined(__MACH__)
    serial = new SerialPortMacOS(devicePath, baud, serialDevice, SERVO_DRS);
#else
    #error "No compatible operating system detected!"
#endif

    // Initialize the serial link
    if (serial != NULL && serial->openLink() == 1)
    {
        status = 1;
        TRACE_INFO(HKX, "> Serial interface successfully opened on '%s' @ %i bps\n", devicePath.c_str(), baud);
    }
    else
    {
        TRACE_ERROR(HKX, "> Failed to open serial interface on '%s' @ %i bps. Exiting...\n", devicePath.c_str(), baud);
    }

    return status;
}
HerkuleX::~HerkuleX()
{
    serialTerminate();
}
void DynamixelSimpleAPI::disconnect()
{
    serialTerminate();
}