Initial Fedora import

This commit is contained in:
Tim Niemueller 2009-09-14 22:25:05 +00:00
parent 07b8e19cf0
commit 0f92bb6c66
8 changed files with 1076 additions and 0 deletions

View File

@ -0,0 +1 @@
KNI_3.9.2.tar.gz

1
import.log Normal file
View File

@ -0,0 +1 @@
libkni3-3_9_2-12_fc11:HEAD:libkni3-3.9.2-12.fc11.src.rpm:1252967051

437
kni-3.9.2-ctor.patch Normal file
View File

@ -0,0 +1,437 @@
diff -urN KNI_3.9.2/include/KNI/cdlCOM.h KNI_3.9.2.ctor/include/KNI/cdlCOM.h
--- KNI_3.9.2/include/KNI/cdlCOM.h 2007-04-12 14:52:06.000000000 +0200
+++ KNI_3.9.2.ctor/include/KNI/cdlCOM.h 2009-06-12 16:44:42.000000000 +0200
@@ -107,7 +107,7 @@
* describes the desired serial port. An attempt to open a connection
* to the desired device will be tried.
*/
- CCdlCOM(TCdlCOMDesc ccd);
+ CCdlCOM(TCdlCOMDesc ccd, const char *dev_name = 0);
/*! \brief Destructs the class
*/ virtual ~CCdlCOM();
diff -urN KNI_3.9.2/src/Base/cdlCOM.cpp KNI_3.9.2.ctor/src/Base/cdlCOM.cpp
--- KNI_3.9.2/src/Base/cdlCOM.cpp 2009-06-12 16:44:03.000000000 +0200
+++ KNI_3.9.2.ctor/src/Base/cdlCOM.cpp 2009-06-12 16:45:02.000000000 +0200
@@ -23,8 +23,9 @@
#include "common/Timer.h"
#include <cstring>
+#include <cstdio>
-
+#include <cstdlib>
#ifdef WIN32
CCdlCOM::CCdlCOM(TCdlCOMDesc ccd) : _deviceName(""), _ccd(), _prtHdl(INVALID_HANDLE_VALUE), _oto() {
@@ -160,21 +161,24 @@
#else //LINUX
-CCdlCOM::CCdlCOM(TCdlCOMDesc ccd) : _deviceName(""), _ccd(), _prtHdl(-1), _oto() {
+CCdlCOM::CCdlCOM(TCdlCOMDesc ccd, const char *dev_name) : _deviceName(""), _ccd(), _prtHdl(-1), _oto() {
int prtHdl = -1;
- std::string deviceName;
struct termios nto, oto;
- char name[11];
+ char *name;
errno = 0;
- strncpy(name, "/dev/ttyS ", 11);
- name[9] = digit(ccd.port);
+ if (dev_name) {
+ name = strdup(dev_name);
+ } else {
+ asprintf(&name, "/dev/ttyS%i", ccd.port);
+ }
prtHdl = ::open(name, O_RDWR | O_NOCTTY | O_NDELAY| O_NONBLOCK);
_deviceName = name;
+ free(name);
if (prtHdl < 0) {
throw CannotOpenPortException(_deviceName, strerror(errno));
@@ -290,7 +294,6 @@
}
_prtHdl = prtHdl;
- _deviceName = deviceName;
_ccd = ccd;
_oto = oto;
}
diff -urN KNI_3.9.2/src/Base/cdlCOM.cpp.orig KNI_3.9.2.ctor/src/Base/cdlCOM.cpp.orig
--- KNI_3.9.2/src/Base/cdlCOM.cpp.orig 1970-01-01 01:00:00.000000000 +0100
+++ KNI_3.9.2.ctor/src/Base/cdlCOM.cpp.orig 2009-06-12 16:44:42.000000000 +0200
@@ -0,0 +1,369 @@
+/*
+ * Katana Native Interface - A C++ interface to the robot arm Katana.
+ * Copyright (C) 2005 Neuronics AG
+ * Check out the AUTHORS file for detailed contact information.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "KNI/cdlCOM.h"
+
+#include "common/Timer.h"
+#include <cstring>
+
+
+#ifdef WIN32
+
+CCdlCOM::CCdlCOM(TCdlCOMDesc ccd) : _deviceName(""), _ccd(), _prtHdl(INVALID_HANDLE_VALUE), _oto() {
+
+ DCB commDCB; //COM port parameters
+ COMMTIMEOUTS nto; //new timeouts
+ char comX[5];
+ char dcb[35];
+ int i, d;
+
+ std::string deviceName;
+ HANDLE prtHdl;
+ COMMTIMEOUTS oto;
+
+ strncpy_s(comX, "COM ", 5);
+ comX[3] = digit(ccd.port);
+ deviceName = comX;
+ prtHdl = CreateFile(comX,
+ GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_NO_BUFFERING, 0
+ );
+
+ if (prtHdl == INVALID_HANDLE_VALUE) {
+ throw CannotOpenPortException(_deviceName, "info from win32-system not yet available");
+ }
+
+ FillMemory(&commDCB, sizeof(commDCB), 0);
+ commDCB.DCBlength = sizeof(commDCB);
+ strncpy_s(dcb, "baud= parity= data= stop= ", 35);
+ for(i=5,d=100000; d>=1; d=d/10) {
+ if(d <= ccd.baud) {
+ dcb[i++] = digit((ccd.baud/d) % 10);
+ }
+ }
+ dcb[19] = ccd.parity;
+ dcb[26] = digit(ccd.data);
+ dcb[33] = digit(ccd.stop);
+ if (!BuildCommDCB(dcb, &commDCB)) {
+ CloseHandle(prtHdl);
+ throw CannotGetSetPortAttributesException(_deviceName);
+ }
+
+ commDCB.fAbortOnError = false;
+ commDCB.fInX = false;
+ commDCB.fOutX = false;
+ commDCB.fOutxCtsFlow = false;
+ if (!SetCommState(prtHdl, &commDCB)) {
+ CloseHandle(prtHdl);
+ throw CannotGetSetPortAttributesException(_deviceName);
+ }
+
+ PurgeComm( prtHdl, PURGE_TXABORT | PURGE_RXABORT | PURGE_TXCLEAR | PURGE_RXCLEAR);
+
+ GetCommTimeouts(prtHdl, &oto);
+ nto.ReadIntervalTimeout = MAXDWORD;
+ nto.ReadTotalTimeoutMultiplier = 0;
+ nto.ReadTotalTimeoutConstant = 0;
+ nto.WriteTotalTimeoutMultiplier = 0;
+ nto.WriteTotalTimeoutConstant = 0;
+ if (!SetCommTimeouts(prtHdl, &nto)) {
+ CloseHandle(prtHdl);
+ throw CannotGetSetPortAttributesException(_deviceName);
+ }
+
+ // Everything done, now we can change the state
+ _prtHdl = prtHdl;
+ _deviceName = deviceName;
+ _ccd = ccd;
+ _oto = oto;
+}
+
+CCdlCOM::~CCdlCOM() {
+ if(_prtHdl == INVALID_HANDLE_VALUE)
+ return;
+
+ FlushFileBuffers(_prtHdl);
+ SetCommTimeouts(_prtHdl, &_oto);
+
+ CloseHandle(_prtHdl);
+
+}
+
+int CCdlCOM::send(const void* buf, int size) {
+
+ if (_prtHdl == INVALID_HANDLE_VALUE) {
+ throw PortNotOpenException(_deviceName);
+ }
+
+ if(PurgeComm(_prtHdl, PURGE_TXABORT | PURGE_TXCLEAR) == 0) {
+ throw DeviceWriteException(_deviceName, "PurgeComm failed");
+ }
+
+ unsigned long readsz;
+ if (WriteFile(_prtHdl, buf, size, &readsz, 0) == 0) {
+ throw DeviceWriteException(_deviceName, "WriteFile failed");
+ }
+
+ if(readsz != static_cast<long>(size)) {
+ throw WriteNotCompleteException(_deviceName);
+ }
+
+ return (int)readsz;
+}
+
+int CCdlCOM::recv(void* buf, int size) {
+
+ if (_prtHdl == INVALID_HANDLE_VALUE) {
+ throw PortNotOpenException(_deviceName);
+ }
+
+ unsigned char* tmp = static_cast<unsigned char*>(buf);
+ unsigned long readsz = 0, readsz_temp = 0;
+ KNI::Timer timeout(_ccd.rttc);
+ timeout.Start();
+ while (readsz<(unsigned long)size && !timeout.Elapsed()) {
+ if(ReadFile(_prtHdl, &tmp[readsz], size, &readsz_temp, 0) == 0) {
+ DeviceReadException( _deviceName, "ReadFile failed" );
+ } else {
+ readsz += readsz_temp;
+ }
+ }
+
+ if((unsigned)size != readsz) {
+ throw ReadNotCompleteException(_deviceName);
+ }
+
+ if(PurgeComm(_prtHdl, PURGE_RXABORT | PURGE_RXCLEAR) == 0) {
+ throw DeviceReadException(_deviceName, "PurgeComm failed");
+ }
+ return (int)readsz;
+}
+
+
+#else //LINUX
+
+CCdlCOM::CCdlCOM(TCdlCOMDesc ccd) : _deviceName(""), _ccd(), _prtHdl(-1), _oto() {
+
+ int prtHdl = -1;
+
+ std::string deviceName;
+ struct termios nto, oto;
+ char name[11];
+
+ errno = 0;
+
+ strncpy(name, "/dev/ttyS ", 11);
+ name[9] = digit(ccd.port);
+ prtHdl = ::open(name, O_RDWR | O_NOCTTY | O_NDELAY| O_NONBLOCK);
+
+ _deviceName = name;
+
+ if (prtHdl < 0) {
+ throw CannotOpenPortException(_deviceName, strerror(errno));
+ }
+
+ tcgetattr(prtHdl, &oto);
+ bzero(&nto, sizeof(nto));
+ nto.c_cc[VTIME] = 0;
+ nto.c_cc[VMIN] = 0;
+ nto.c_oflag = 0;
+ nto.c_lflag = 0;
+ nto.c_cflag = CLOCAL | CREAD;
+ nto.c_iflag = 0;
+
+ switch (ccd.baud) {
+ case 50:
+ nto.c_cflag |= B50;
+ break;
+ case 75:
+ nto.c_cflag |= B75;
+ break;
+ case 110:
+ nto.c_cflag |= B110;
+ break;
+ case 134:
+ nto.c_cflag |= B134;
+ break;
+ case 150:
+ nto.c_cflag |= B150;
+ break;
+ case 200:
+ nto.c_cflag |= B200;
+ break;
+ case 300:
+ nto.c_cflag |= B300;
+ break;
+ case 600:
+ nto.c_cflag |= B600;
+ break;
+ case 1200:
+ nto.c_cflag |= B1200;
+ break;
+ case 1800:
+ nto.c_cflag |= B1800;
+ break;
+ case 2400:
+ nto.c_cflag |= B2400;
+ break;
+ case 4800:
+ nto.c_cflag |= B4800;
+ break;
+ case 9600:
+ nto.c_cflag |= B9600;
+ break;
+ case 19200:
+ nto.c_cflag |= B19200;
+ break;
+ case 38400:
+ nto.c_cflag |= B38400;
+ break;
+ case 57600:
+ nto.c_cflag |= B57600;
+ break;
+ case 115200:
+ nto.c_cflag |= B115200;
+ break;
+ case 230400:
+ nto.c_cflag |= B230400;
+ break;
+ }
+
+ switch (ccd.data) {
+ case 5:
+ nto.c_cflag |= CS5;
+ break;
+ case 6:
+ nto.c_cflag |= CS6;
+ break;
+ case 7:
+ nto.c_cflag |= CS7;
+ break;
+ case 8:
+ nto.c_cflag |= CS8;
+ break;
+ }
+
+ switch (ccd.parity) {
+ case 'N':
+ case 'n':
+ break;
+ case 'O':
+ case 'o':
+ nto.c_cflag |= PARENB | PARODD;
+ break;
+ case 'E':
+ case 'e':
+ nto.c_cflag |= PARENB;
+ break;
+ }
+
+ switch (ccd.stop) {
+ case 1:
+ break;
+ case 2:
+ nto.c_cflag |= CSTOPB;
+ break;
+ }
+
+ tcflush(prtHdl,TCIFLUSH);
+ if (tcsetattr(prtHdl, TCSANOW, &nto) != 0) {
+ ::close(prtHdl);
+ throw CannotGetSetPortAttributesException(_deviceName);
+ }
+
+ _prtHdl = prtHdl;
+ _deviceName = deviceName;
+ _ccd = ccd;
+ _oto = oto;
+}
+
+CCdlCOM::~CCdlCOM() {
+
+ if (_prtHdl < 0) {
+ return;
+ }
+
+ tcflush(_prtHdl, TCIFLUSH);
+ tcsetattr(_prtHdl, TCSANOW, &_oto);
+
+ ::close(_prtHdl); // there's nothing we can do about failing
+
+}
+
+int CCdlCOM::send(const void* buf, int size) {
+
+ if (_prtHdl < 0)
+ throw PortNotOpenException(_deviceName);
+
+ errno = 0;
+
+ int tcflush_return = tcflush(_prtHdl,TCIFLUSH);
+ if(tcflush_return < 0)
+ throw DeviceWriteException( _deviceName, strerror(errno) );
+
+ int writesz = write(_prtHdl, buf, size);
+
+ if(writesz < 0)
+ throw DeviceWriteException( _deviceName, strerror(errno) );
+
+ if(writesz != size)
+ throw WriteNotCompleteException(_deviceName);
+
+ return writesz;
+}
+
+int CCdlCOM::recv(void* buf, int size) {
+ unsigned char* tmp = static_cast<unsigned char*>(buf);
+ register int readsz = 0;
+
+ if (_prtHdl < 0)
+ throw PortNotOpenException(_deviceName);
+
+ errno = 0;
+
+ int read_return;
+ KNI::Timer timeout(_ccd.rttc);
+ timeout.Start();
+ while (readsz<size && !timeout.Elapsed()) {
+ read_return = read(_prtHdl, &tmp[readsz], size-readsz);
+ if(read_return < 0) {
+ if(errno != EAGAIN)
+ throw DeviceReadException( _deviceName, strerror(errno));
+ } else {
+ readsz += read_return;
+ }
+ }
+
+ if (readsz != size)
+ throw ReadNotCompleteException(_deviceName);
+
+ int tcflush_return = tcflush(_prtHdl,TCIFLUSH);
+ if(tcflush_return < 0)
+ throw DeviceReadException( _deviceName, strerror(errno));
+
+ return readsz;
+
+}
+
+
+
+#endif //WIN32 else LINUX
+

203
kni-3.9.2-gcc43.patch Normal file
View File

@ -0,0 +1,203 @@
diff -urN KNI_3.9.2/demo/keycontrol/keycontrol.cpp KNI_3.9.2.gcc43/demo/keycontrol/keycontrol.cpp
--- KNI_3.9.2/demo/keycontrol/keycontrol.cpp 2007-08-10 14:37:42.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/keycontrol/keycontrol.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -10,6 +10,7 @@
#include <vector>
#include <fstream>
#include <pthread.h>
+#include <cstdlib>
#ifdef WIN32
diff -urN KNI_3.9.2/demo/perfo/main.cpp KNI_3.9.2.gcc43/demo/perfo/main.cpp
--- KNI_3.9.2/demo/perfo/main.cpp 2007-04-12 14:52:06.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/perfo/main.cpp 2009-06-12 16:48:21.000000000 +0200
@@ -19,6 +19,7 @@
#include "KNI/kmlBase.h" //for robot: CKatBase, CMotBase, CSctBase
#include "KNI/kmlExt.h" // extended katana features
#include <iostream> //for messages: printf()
+#include <cstdio>
/**********************************************************************************/
#include "perfo.h" //for performance checking..
diff -urN KNI_3.9.2/demo/perfo/perfo.cpp KNI_3.9.2.gcc43/demo/perfo/perfo.cpp
--- KNI_3.9.2/demo/perfo/perfo.cpp 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/perfo/perfo.cpp 2009-06-12 16:48:29.000000000 +0200
@@ -2,6 +2,7 @@
#include "perfo.h"
#include <time.h>
#include <iostream>
+#include <cstdio>
#include "KNI/cdlCOMExceptions.h"
#include "KNI/cplSerial.h"
@@ -13,7 +14,7 @@
#define CLOCK() (clock_t)((double)(1000.0f * clock()) / CLOCKS_PER_SEC)
//-------------------------------------------------------------------------------//
-void statKatRecv(char strTitle[], long i, long j, clock_t t, long l) {
+void statKatRecv(const char strTitle[], long i, long j, clock_t t, long l) {
printf("-------------------------------------------\n");
printf(strTitle); printf("\tAverage: %.3f [ms]\n", (double)t/(double)l);
printf("-------------------------------------------\n");
@@ -102,7 +103,7 @@
//-------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------//
-void statMotRecv(char strTitle[], short idx, long i, long j, clock_t t, long l) {
+void statMotRecv(const char strTitle[], short idx, long i, long j, clock_t t, long l) {
printf("-------------------------------------------\n");
printf(strTitle, idx); printf("\tAverage: %.3f [ms]\n", (double)t/(double)l);
printf("-------------------------------------------\n");
@@ -111,7 +112,7 @@
printf("-------------------------------------------\n\n");
}
-void statMotSend(char strTitle[], short idx, long i, long j, long k, long s, clock_t t, long l) {
+void statMotSend(const char strTitle[], short idx, long i, long j, long k, long s, clock_t t, long l) {
printf("-------------------------------------------\n");
printf(strTitle, idx); printf("\tAverage: %.3f [ms]\n", (double)t/(double)l);
printf("-------------------------------------------\n");
@@ -278,7 +279,7 @@
//-------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------//
-void statSct(char strTitle[], short idx, long i, long j, long k, long s, clock_t t, long l) {
+void statSct(const char strTitle[], short idx, long i, long j, long k, long s, clock_t t, long l) {
printf("-------------------------------------------\n");
printf(strTitle, idx); printf("\tAverage: %.3f [ms]\n", (double)t/(double)l);
printf("-------------------------------------------\n");
diff -urN KNI_3.9.2/demo/positions/main.cpp KNI_3.9.2.gcc43/demo/positions/main.cpp
--- KNI_3.9.2/demo/positions/main.cpp 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/positions/main.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -8,6 +8,7 @@
#include <vector>
#include <fstream>
#include <pthread.h>
+#include <cstdlib>
#ifdef WIN32
diff -urN KNI_3.9.2/demo/sensor/main.cpp KNI_3.9.2.gcc43/demo/sensor/main.cpp
--- KNI_3.9.2/demo/sensor/main.cpp 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/sensor/main.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -6,6 +6,7 @@
#include <conio.h> //ONLY WIN32 COMPATIBLE!!
#endif
#include <time.h>
+#include <cstdlib>
//------------------------------------------------------------------------//
diff -urN KNI_3.9.2/demo/socketcommands/socketcommands.cpp KNI_3.9.2.gcc43/demo/socketcommands/socketcommands.cpp
--- KNI_3.9.2/demo/socketcommands/socketcommands.cpp 2007-04-12 14:52:06.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/socketcommands/socketcommands.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -6,6 +6,7 @@
#include <iostream>
#include <cstdio>
#include <memory>
+#include <cstdlib>
#ifdef WIN32
diff -urN KNI_3.9.2/demo/socketcontrol/socketcontrol.cpp KNI_3.9.2.gcc43/demo/socketcontrol/socketcontrol.cpp
--- KNI_3.9.2/demo/socketcontrol/socketcontrol.cpp 2007-09-03 16:04:48.000000000 +0200
+++ KNI_3.9.2.gcc43/demo/socketcontrol/socketcontrol.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -11,6 +11,7 @@
#include <vector>
#include <fstream>
#include <pthread.h>
+#include <cstdlib>
#ifdef WIN32
diff -urN KNI_3.9.2/include/KNI/kmlMotBase.h KNI_3.9.2.gcc43/include/KNI/kmlMotBase.h
--- KNI_3.9.2/include/KNI/kmlMotBase.h 2007-09-19 15:16:44.000000000 +0200
+++ KNI_3.9.2.gcc43/include/KNI/kmlMotBase.h 2009-06-12 16:48:02.000000000 +0200
@@ -45,7 +45,7 @@
/*! \brief command flags
*/
-typedef enum TMotCmdFlg {
+enum TMotCmdFlg {
MCF_OFF = 0, //!< set the motor off
MCF_CALIB = 4, //!< calibrate
MCF_FREEZE = 8, //!< freeze the motor
@@ -54,7 +54,7 @@
/*! \brief status flags
*/
-typedef enum TMotStsFlg {
+enum TMotStsFlg {
MSF_MECHSTOP = 1, //!< mechanical stopper reached
MSF_MAXPOS = 2, //!< max. position was reached
MSF_MINPOS = 4, //!< min. position was reached
diff -urN KNI_3.9.2/src/Base/cdlCOM.cpp KNI_3.9.2.gcc43/src/Base/cdlCOM.cpp
--- KNI_3.9.2/src/Base/cdlCOM.cpp 2007-04-12 14:52:06.000000000 +0200
+++ KNI_3.9.2.gcc43/src/Base/cdlCOM.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -22,6 +22,7 @@
#include "KNI/cdlCOM.h"
#include "common/Timer.h"
+#include <cstring>
#ifdef WIN32
diff -urN KNI_3.9.2/src/Base/cdlSocket.cpp KNI_3.9.2.gcc43/src/Base/cdlSocket.cpp
--- KNI_3.9.2/src/Base/cdlSocket.cpp 2007-11-06 14:45:08.000000000 +0100
+++ KNI_3.9.2.gcc43/src/Base/cdlSocket.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -21,6 +21,9 @@
/****************************************************************************/
#include "KNI/cdlSocket.h"
#include <iostream>
+#include <cstring>
+#include <cstdlib>
+
/****************************************************************************/
//test write:
int writesz;
diff -urN KNI_3.9.2/src/Base/cplSerial.cpp KNI_3.9.2.gcc43/src/Base/cplSerial.cpp
--- KNI_3.9.2/src/Base/cplSerial.cpp 2007-11-13 10:38:44.000000000 +0100
+++ KNI_3.9.2.gcc43/src/Base/cplSerial.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -22,6 +22,7 @@
#include "KNI/CRC.h"
#include <assert.h>
#include <iostream>
+#include <cstring>
/*
diff -urN KNI_3.9.2/src/Base/kmlBase.cpp KNI_3.9.2.gcc43/src/Base/kmlBase.cpp
--- KNI_3.9.2/src/Base/kmlBase.cpp 2007-11-07 09:22:52.000000000 +0100
+++ KNI_3.9.2.gcc43/src/Base/kmlBase.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -21,6 +21,7 @@
#include "KNI/kmlBase.h"
#include <vector>
+#include <cstring>
bool CKatBase::init(
const TKatGNL _gnl,
diff -urN KNI_3.9.2/src/Base/kmlFactories.cpp KNI_3.9.2.gcc43/src/Base/kmlFactories.cpp
--- KNI_3.9.2/src/Base/kmlFactories.cpp 2007-07-16 14:17:40.000000000 +0200
+++ KNI_3.9.2.gcc43/src/Base/kmlFactories.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -1,5 +1,7 @@
#include "KNI/kmlFactories.h"
+#include <cstring>
+#include <cstdlib>
namespace KNI {
diff -urN KNI_3.9.2/src/Base/kmlMotBase.cpp KNI_3.9.2.gcc43/src/Base/kmlMotBase.cpp
--- KNI_3.9.2/src/Base/kmlMotBase.cpp 2007-09-19 15:16:44.000000000 +0200
+++ KNI_3.9.2.gcc43/src/Base/kmlMotBase.cpp 2009-06-12 16:48:02.000000000 +0200
@@ -15,6 +15,8 @@
#include "common/MathHelperFunctions.h"
#include "common/Timer.h"
#include <iostream>
+#include <cstring>
+#include <cstdlib>
bool CMotBase::init(CKatBase* _own, const TMotDesc _motDesc, CCplBase* _protocol) {

57
kni-3.9.2-noexit.patch Normal file
View File

@ -0,0 +1,57 @@
diff -urN KNI_3.9.2.patched/src/Base/cdlSocket.cpp KNI_3.9.2.noexit/src/Base/cdlSocket.cpp
--- KNI_3.9.2.patched/src/Base/cdlSocket.cpp 2008-12-01 13:12:13.000000000 +0100
+++ KNI_3.9.2.noexit/src/Base/cdlSocket.cpp 2008-12-01 13:16:07.000000000 +0100
@@ -23,6 +23,7 @@
#include <iostream>
#include <cstring>
#include <cstdlib>
+#include <stdexcept>
/****************************************************************************/
//test write:
@@ -95,7 +96,7 @@
_socketfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(_socketfd == -1){
std::cout << "socket could not be created"<<_ipAddr<<" port: "<< _port<<" \n";
- exit(1);
+ throw std::runtime_error("socket could not be created");
}
memset(&_socketAddr, 0, sizeof(_socketAddr));
_socketAddr.sin_family = AF_INET;
@@ -106,13 +107,13 @@
res = inet_pton ( AF_INET, _ipAddr, &_socketAddr.sin_addr );
if ( errno == EAFNOSUPPORT ){
std::cout << "inet_pton failed, try again "<<_ipAddr<<" port: "<< _port<<" \n";
- exit(1);
+ throw std::runtime_error("inet_pton failed (EAFNOSUPPORT)");
}
// std::cout << "trying to connect to server...\n";
res = connect(_socketfd, (struct sockaddr *) &_socketAddr, _len);
if(res != 0){
std::cout << "client could not connect, check if server is running on ip "<<_ipAddr<<" port: "<< _port<<" \n";
- exit(1);
+ throw std::runtime_error("client could not connect, check if server is running");
}
else{
// std::cout << "client connected to ip "<<_ipAddr<<", port: "<< _port<<" \n";
diff -urN KNI_3.9.2.patched/src/Base/kmlExt.cpp KNI_3.9.2.noexit/src/Base/kmlExt.cpp
--- KNI_3.9.2.patched/src/Base/kmlExt.cpp 2007-09-28 07:38:10.000000000 +0200
+++ KNI_3.9.2.noexit/src/Base/kmlExt.cpp 2008-12-01 13:16:58.000000000 +0100
@@ -28,6 +28,7 @@
#include <iostream>
#include <algorithm>
#include <vector>
+#include <stdexcept>
#define max(a,b) (((a)>(b))?(a):(b))
KNI::Timer kni_timer;
@@ -145,7 +146,8 @@
std::cout << "Exit: Incompatible Config File!\n";
std::cout << "Check whether you have a Katana 400 or 300 and choose the config file accordingly\n";
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.";
- exit(0);
+ throw std::runtime_error("Exit: Incompatible Config File! "
+ "Check whether you have a Katana 400 or 300 and choose the config file accordingly");
}
bool gripperIsPresent;
int gripperOpenEncoders, gripperCloseEncoders;

172
kni-3.9.2-sofixes.patch Normal file
View File

@ -0,0 +1,172 @@
diff -urN KNI_3.9.2/demo/Makefile KNI_3.9.2.sofixes/demo/Makefile
--- KNI_3.9.2/demo/Makefile 2007-06-20 08:05:24.000000000 +0200
+++ KNI_3.9.2.sofixes/demo/Makefile 2009-08-28 22:09:05.000000000 +0200
@@ -34,11 +34,11 @@
INCLUDE_DIR = ../include -I./common
LIBRARY_DIR = ../lib/linux
-BASE_LIBRARY = $(LIBRARY_DIR)/libKNIBase.a
-INVKIN_LIBRARY = $(LIBRARY_DIR)/libKNI_InvKin.a
-LM_LIBRARY = $(LIBRARY_DIR)/libKNI_LM.a
+BASE_LIBRARY = $(LIBRARY_DIR)/libKNIBase3.a
+INVKIN_LIBRARY = $(LIBRARY_DIR)/libKNI_InvKin3.a
+LM_LIBRARY = $(LIBRARY_DIR)/libKNI_LM3.a
-AVAILABLE_LIBRARIES = ./common/keyboard.o ${BASE_LIBRARY} ${INVKIN_LIBRARY} ${LM_LIBRARY}
+AVAILABLE_LIBRARIES = ./common/keyboard.o
.SILENT:
@@ -55,7 +55,7 @@
$(TARGETS_D): $(CTARGETS_D)
echo -n "Building: $@"
- if $(CXX) $(CXXFLAGS) -I$(INCLUDE_DIR) -lpthread -o $(@:.demo=)/$(@:.demo=) $(wildcard $(@:.demo=)/*.cpp) ${AVAILABLE_LIBRARIES} 2>.clog; \
+ if $(CXX) $(CXXFLAGS) -I$(INCLUDE_DIR) -L../lib/linux -lKNIBase3 -lKNI_InvKin3 -lKNI_LM3 -lpthread -o $(@:.demo=)/$(@:.demo=) $(wildcard $(@:.demo=)/*.cpp) ${AVAILABLE_LIBRARIES} 2>.clog; \
then echo " [ok]"; \
cat .clog; \
else echo " [failed]"; \
diff -urN KNI_3.9.2/src/Base/Makefile KNI_3.9.2.sofixes/src/Base/Makefile
--- KNI_3.9.2/src/Base/Makefile 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.sofixes/src/Base/Makefile 2009-08-28 22:08:00.000000000 +0200
@@ -24,20 +24,22 @@
TARGETS = alib solib
-LIBNAME = libKNIBase
+LIBNAME = libKNIBase3
SOURCES = cdlCOM.cpp cplSerial.cpp cdlSocket.cpp CRC.cpp kmlBase.cpp kmlExt.cpp kmlMotBase.cpp kmlSctBase.cpp kmlFactories.cpp
ADDITIONAL_DEPS = ../common/Timer.o
LIBNAME_A = $(LIBNAME).a
LIBNAME_SO = $(LIBNAME).so.$(MAJOR_VERSION).$(MINOR_VERSION)
-
-SLCFLAGS=-fPIC
-SLLDFLAGS=-shared
+LIBNAME_SO_LN = $(LIBNAME).so
+LIBNAME_SONAME = $(LIBNAME).so.$(MAJOR_VERSION)
INCLUDE_DIR = ../../include
TARGET_DIR = ../../lib/linux
+SLCFLAGS=-fPIC
+SLLDFLAGS = -shared -L$(TARGET_DIR)
+
.SILENT:
.SUFFIXES: .cpp.o
@@ -69,8 +71,9 @@
$(TARGET_DIR)/$(LIBNAME_SO): $(SOURCES:.cpp=.o)
echo -n "Building: $@"
- if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ $(SOURCES:.cpp=.o) $(ADDITITIONAL_DEPS) 2>.slog; \
+ if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ -Wl,-soname,$(LIBNAME_SONAME) $(SOURCES:.cpp=.o) $(ADDITIONAL_DEPS) 2>.slog; \
then echo " [ok]"; \
+ ln -s $(LIBNAME_SO) $(TARGET_DIR)/$(LIBNAME_SO_LN); \
cat .slog; \
else echo " [failed]"; \
cat .slog; \
diff -urN KNI_3.9.2/src/common/Makefile KNI_3.9.2.sofixes/src/common/Makefile
--- KNI_3.9.2/src/common/Makefile 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.sofixes/src/common/Makefile 2009-08-28 22:08:16.000000000 +0200
@@ -17,14 +17,14 @@
#===========================================================================
CXX = g++
-CXXFLAGS += -g -O2 -Wall
+CXXFLAGS += -g -O2 -Wall -fPIC
MAJOR_VERSION = 3.9
MINOR_VERSION = 0
TARGETS = alib
-LIBNAME = knicommon
+LIBNAME = knicommon3
SOURCES = Timer.cpp
LIBNAME_A = $(LIBNAME).a
diff -urN KNI_3.9.2/src/InvKin/Makefile KNI_3.9.2.sofixes/src/InvKin/Makefile
--- KNI_3.9.2/src/InvKin/Makefile 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.sofixes/src/InvKin/Makefile 2009-08-28 22:08:25.000000000 +0200
@@ -24,20 +24,23 @@
TARGETS = alib solib
-LIBNAME = libKNI_InvKin
+LIBNAME = libKNI_InvKin3
SOURCES = ikBase.cpp KatanaKinematics6M90G.cpp KatanaKinematics6M90T.cpp KatanaKinematics6M180.cpp KatanaKinematics5M180.cpp KatanaKinematicsDecisionAlgorithms.cpp
ADDITIONAL_DEPS = ../common/Timer.o
LIBNAME_A = $(LIBNAME).a
LIBNAME_SO = $(LIBNAME).so.$(MAJOR_VERSION).$(MINOR_VERSION)
-
-SLCFLAGS=-fPIC
-SLLDFLAGS=-shared
+LIBNAME_SO_LN = $(LIBNAME).so
+LIBNAME_SONAME = $(LIBNAME).so.$(MAJOR_VERSION)
INCLUDE_DIR = ../../include
TARGET_DIR = ../../lib/linux
+SLCFLAGS=-fPIC
+SLLDFLAGS=-shared -L$(TARGET_DIR) -lKNIBase3
+
+
.SILENT:
.SUFFIXES: .cpp.o
@@ -69,8 +72,9 @@
$(TARGET_DIR)/$(LIBNAME_SO): $(SOURCES:.cpp=.o)
echo -n "Building: $@"
- if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ $(SOURCES:.cpp=.o) $(ADDITITIONAL_DEPS) 2>.slog; \
+ if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ -Wl,-soname,$(LIBNAME_SONAME) $(SOURCES:.cpp=.o) $(ADDITIONAL_DEPS) 2>.slog; \
then echo " [ok]"; \
+ ln -s $(LIBNAME_SO) $(TARGET_DIR)/$(LIBNAME_SO_LN); \
cat .slog; \
else echo " [failed]"; \
cat .slog; \
diff -urN KNI_3.9.2/src/LM/Makefile KNI_3.9.2.sofixes/src/LM/Makefile
--- KNI_3.9.2/src/LM/Makefile 2007-04-26 08:18:24.000000000 +0200
+++ KNI_3.9.2.sofixes/src/LM/Makefile 2009-08-28 22:08:40.000000000 +0200
@@ -24,20 +24,22 @@
TARGETS = alib solib
-LIBNAME = libKNI_LM
+LIBNAME = libKNI_LM3
SOURCES = lmBase.cpp
ADDITIONAL_DEPS = ../common/Timer.o
LIBNAME_A = $(LIBNAME).a
LIBNAME_SO = $(LIBNAME).so.$(MAJOR_VERSION).$(MINOR_VERSION)
-
-SLCFLAGS=-fPIC
-SLLDFLAGS=-shared
+LIBNAME_SO_LN = $(LIBNAME).so
+LIBNAME_SONAME = $(LIBNAME).so.$(MAJOR_VERSION)
INCLUDE_DIR = ../../include
TARGET_DIR = ../../lib/linux
+SLCFLAGS=-fPIC
+SLLDFLAGS=-shared -L$(TARGET_DIR) -lKNIBase3 -lKNI_InvKin3
+
.SILENT:
.SUFFIXES: .cpp.o
@@ -69,8 +71,9 @@
$(TARGET_DIR)/$(LIBNAME_SO): $(SOURCES:.cpp=.o)
echo -n "Building: $@"
- if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ $(SOURCES:.cpp=.o) $(ADDITITIONAL_DEPS) 2>.slog; \
+ if $(CXX) $(CXXFLAGS) $(SLLDFLAGS) -o $@ -Wl,-soname,$(LIBNAME_SONAME) $(SOURCES:.cpp=.o) $(ADDITIONAL_DEPS) 2>.slog; \
then echo " [ok]"; \
+ ln -s $(LIBNAME_SO) $(TARGET_DIR)/$(LIBNAME_SO_LN); \
cat .slog; \
else echo " [failed]"; \
cat .slog; \

204
libkni3.spec Normal file
View File

@ -0,0 +1,204 @@
Name: libkni3
Version: 3.9.2
Release: 12%{?dist}
Summary: C++ KNI library v3 for the Katana 300 robot arm
Group: System Environment/Libraries
License: GPLv2+
URL: http://www.neuronics.ch/cms_de/web/index.php?id=386
Source0: http://www.neuronics.ch/cms_de/mediabase/KNI_3.9.2.tar.gz
Patch0: kni-3.9.2-gcc43.patch
Patch1: kni-3.9.2-sofixes.patch
Patch2: kni-3.9.2-ctor.patch
Patch3: kni-3.9.2-noexit.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: doxygen, graphviz
%if 0%{?fedora} >= 9
BuildRequires: texlive-utils
%else
BuildRequires: tetex
%endif
BuildRequires: boost-devel
%description
Katana Native Interface is a C++ library for programmers who would like to
write their own programs, but don't want to implement the protocol and
device stuff katana is using.
This package contains the library for the Katana 300 series of the arm. For
newer robots use libkni (version 4 and above).
%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package static
Summary: Static libraries for %{name}
Group: Development/Libraries
Requires: %{name}-devel = %{version}-%{release}
%description static
This package contains static libraries that can be used to
compile static binaries using %{name}.
%package doc
Summary: Documentation for %{name}
Group: Documentation
%description doc
This package contains the documentation for developing with %{name}.
%package examples
Summary: Example applications for %{name}
Group: Applications/System
Requires: %{name} = %{version}-%{release}
%description examples
This package contains demo applications for %{name}.
%prep
%setup -q -n KNI_%{version}
%patch0 -p1 -b .gcc43
%patch1 -p1 -b .sofixes
%patch2 -p1 -b .ctor
%patch3 -p1 -b .noexit
%build
make CFLAGS="%{optflags}"
make doc
echo "prefix=%{prefix}
exec_prefix=%{prefix}
libdir=%{_libdir}
includedir=%{_includedir}
Name: %{name}
Description: %{summary}
Version: %{version}
Libs: -L\${libdir} -lKNIBase3 -lKNI_InvKin3 -lKNI_LM3
Cflags: -I\${includedir}/kni3" > libkni3.pc
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
mkdir -p %{buildroot}%{_libdir}
install -m 0644 -p lib/linux/*.a %{buildroot}%{_libdir}
install -p lib/linux/*.so.* %{buildroot}%{_libdir}
for f in `find %{buildroot}%{_libdir} -name '*.so.*.*.*'`; do
ln -s `basename $f` %{buildroot}%{_libdir}/`echo \`basename $f\` | sed -e 's/\(\(.*\).so\)\(.*\)/\1/'`
ln -s `basename $f` %{buildroot}%{_libdir}/`objdump --private-headers $f | grep SONAME | awk '{print $2}'`
done
mkdir -p %{buildroot}%{_bindir}
for f in `find demo/ -perm /a+x -type f`; do
install -p $f %{buildroot}%{_bindir}/kni_`basename $f`
done
mkdir -p %{buildroot}%{_sysconfdir}/kni3
mkdir -p %{buildroot}%{_sysconfdir}/kni3/hd300
mkdir -p %{buildroot}%{_sysconfdir}/kni3/hd400
install -p -m 0644 configfiles300/*.cfg %{buildroot}%{_sysconfdir}/kni3/hd300
install -p -m 0644 configfiles400/*.cfg %{buildroot}%{_sysconfdir}/kni3/hd400
mkdir -p %{buildroot}%{_includedir}/kni3
cp -a include/* %{buildroot}%{_includedir}/kni3
mkdir -p %{buildroot}%{_docdir}/%{name}-doc-%{version}
cp -a doc/html %{buildroot}%{_docdir}/%{name}-doc-%{version}
install -p -m 0644 doc/*.pdf %{buildroot}%{_docdir}/%{name}-doc-%{version}
find %{buildroot} -name '.svn' | xargs rm -rf
mkdir -p %{buildroot}%{_libdir}/pkgconfig
install -p -m 0644 libkni3.pc %{buildroot}%{_libdir}/pkgconfig
%clean
rm -rf %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc LICENSE.txt readme.txt AUTHORS.txt
%{_libdir}/*.so.*
%dir %{_sysconfdir}/kni3
%dir %{_sysconfdir}/kni3/hd300
%dir %{_sysconfdir}/kni3/hd400
%config(noreplace)%{_sysconfdir}/kni3/*/*.cfg
%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%files static
%defattr(-,root,root,-)
%{_libdir}/*.a
%files doc
%defattr(-, root, root, 0755)
%{_docdir}/%{name}-doc-%{version}
%files examples
%defattr(-, root, root, 0755)
%{_bindir}/kni_*
%changelog
* Mon Sep 14 2009 Tim Niemueller <tim@niemueller.de> - 3.9.2-12
- doc package contains doc dir, not docs
* Fri Aug 28 2009 Tim Niemueller <tim@niemueller.de> - 3.9.2-11
- Rename shared libs to allow parallel installation for libkni
- Merge all shared lib related patches to one sofixes patch
* Sat Jun 13 2009 Tim Niemueller <tim@niemueller.de> - 3.9.2-10
- Update ctor and gcc43 patch for F11
* Tue Jun 09 2009 Tim Niemueller <tim@niemueller.de> - 3.9.2-9
- Rename to libkni3, libkni will be the most up2date version (v4), but this
version is still required for older Katana 300 arms
- Add patch to fix library building, did work on my machin only because libs
were installed on the system
* Wed Dec 03 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-8
- Fix noexit patch
* Mon Dec 01 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-7
- Make patch 3 apply with fuzz=0
- Added patch that removes calls to exit() but throws exceptions
* Sun Nov 09 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-6
- Updated license tag
- Consistent (non-)macro usage
* Tue Jul 15 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-5
- Added ctor patch which adds an optional argument to the ctor to allow for
accessing an arbitrary device, for example a usb2ser converter
(RoboCup 2008)
* Mon Jun 23 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-4
- More .so fixes, link libs against base lib to get rid of
undefined-non-weak-symbol rpmlint warnings
* Mon Jun 16 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-3
- Fixed summary
* Thu Jun 12 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-2
- Upgraded BR to support building on Fedora version < 9
* Sat Jun 07 2008 Tim Niemueller <tim@niemueller.de> - 3.9.2-1
- Initial package

View File

@ -0,0 +1 @@
63b40f2c258f7ce2159b2471f4569165 KNI_3.9.2.tar.gz