diff --git a/FRILibrary/Makefile b/FRILibrary/Makefile
index 5f8fd4ff76d8131e63e4622ac9133c9fe8f7ed69..2b60ba14470c0b63175eb57de2715abdf19758c3 100644
--- a/FRILibrary/Makefile
+++ b/FRILibrary/Makefile
@@ -2,6 +2,7 @@
 # Created:			Matthieu Herrb on Mon, 23 May 2016
 #
 
+PKGREVISION=	1
 DISTNAME=	fril
 VERSION=	1.2
 PKGNAME=	FRILibrary-${VERSION}
@@ -15,6 +16,9 @@ MAINTAINER=	openrobots@laas.fr
 COMMENT=	C++ Library to interface the KUKA Light Weight Robot IV
 LICENSE=	apache-2.0
 
+# force text conversion to handle CR/LR correctly.
+EXTRACT_OPTS_ZIP=-aao
+
 WRKSRC=		${WRKDIR}/FRILibrary
 
 BUILD_DIRS=	Linux
diff --git a/FRILibrary/distinfo b/FRILibrary/distinfo
index 61e34be8cd5dd080f0d32e2463bb6cf4e06f5d13..1f4d96cec44d2c1d70f0d84d17954fb22d1e7349 100644
--- a/FRILibrary/distinfo
+++ b/FRILibrary/distinfo
@@ -1,12 +1,14 @@
 SHA1 (frilib-1.2/fril.zip) = a876c225b464ffa25a0dcbae8783eb84e5d06132
 RMD160 (frilib-1.2/fril.zip) = b23957503feee5c16e610eb4fae65d49760fcdc2
 Size (frilib-1.2/fril.zip) = 997218 bytes
-SHA1 (patch-aa) = 5922a171eecc767859b565cd01c00b94fc0a3321
-SHA1 (patch-ab) = 7313d58b0a215b7b6ddb84c9b0187191f300fe7e
-SHA1 (patch-ac) = 451b9b1e8c534747af7f75bbc894ac6d81450fbf
-SHA1 (patch-ad) = c5b88b1b2ed9605d0ddff59e06b400d7af398c76
-SHA1 (patch-ae) = 2540ae5fe484aaa59b610b7bcd74659bec1f2bbb
-SHA1 (patch-af) = 8c230783e5ffcaf8194738ab371a32485eef892b
-SHA1 (patch-ag) = 34c2a6973f17861182555f3c295732685730c36f
-SHA1 (patch-ah) = 4379946c9efaae50f9935ccd6d4acdfb6e5840c6
-SHA1 (patch-ai) = 02d8aaee1583ff4da2c81ae4673bd70181afd4ae
+SHA1 (patch-aa) = 116b579954eafecc5c3e611199fffe80dd9d8c37
+SHA1 (patch-ab) = df3ad8dec088eb66624e5180647faccbde6b5614
+SHA1 (patch-ac) = 408cc7be2429ad59bc8c311fa312a169730e062f
+SHA1 (patch-ad) = 08edc24d746782cd15445e94357acba58c80aafb
+SHA1 (patch-ae) = 1fe3dcba29eab2f7b83de4aad76fc7cb7976c475
+SHA1 (patch-af) = f25d28021ffd688e82a1bca3140d1376124fdff1
+SHA1 (patch-ag) = 7de00937cd7d3b3c290af9900f9fa8ed79985a72
+SHA1 (patch-ah) = 7ceb00185ea5e4395d7e7a611b3d9b586561bb27
+SHA1 (patch-ai) = 3e35976bc8dca9b70249849c87ffe7bfc1eb11b9
+SHA1 (patch-aj) = 406ad55706a7e7d04873998a08e374c31e56157a
+SHA1 (patch-ak) = 82e6c7dc56b46dc00ddca5d30b1e5fdc77b93d93
diff --git a/FRILibrary/patches/patch-aa b/FRILibrary/patches/patch-aa
index 279537d6f83f077752b9e1aee7d78e7abdc35936..0d2a5de25ed2f92460e8dca6e701dfd439f55852 100644
--- a/FRILibrary/patches/patch-aa
+++ b/FRILibrary/patches/patch-aa
@@ -1,11 +1,11 @@
 --- ./etc/980039-FRI-Driver.init.orig	2011-11-19 21:07:18.000000000 +0100
 +++ ./etc/980039-FRI-Driver.init	2016-05-23 17:57:02.808782000 +0200
 @@ -16,5 +16,5 @@
- 
- [Logging]
- NumberOfLoggingFileEntries=60000
--LoggingPath=/home/lwrcontrol/output
+ 
+ [Logging]
+ NumberOfLoggingFileEntries=60000
+-LoggingPath=/home/lwrcontrol/output
 -LoggingFileName=LWR-Scope.dat
 \ No newline at end of file
-+LoggingPath=/tmp
-+LoggingFileName=LWR-Scope.dat
++LoggingPath=/tmp
++LoggingFileName=LWR-Scope.dat
diff --git a/FRILibrary/patches/patch-ab b/FRILibrary/patches/patch-ab
index a6b2cb9b3b39b93cc5ce41ece2736be65227c2e4..1bd649c2ac42a543d6933b2bde4305d5fea8ae6f 100644
--- a/FRILibrary/patches/patch-ab
+++ b/FRILibrary/patches/patch-ab
@@ -1,11 +1,11 @@
 --- ./src/FastResearchInterfaceTest/FastResearchInterfaceTest.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/FastResearchInterfaceTest/FastResearchInterfaceTest.cpp	2016-05-23 17:53:38.860953000 +0200
 @@ -108,7 +108,7 @@
- #ifdef __LINUX__
- 	fprintf(stdout, "You may need superuser permission to run this program.\n");
- 	fflush(stdout);
--	FRI = new FastResearchInterface("/home/torsten/etc/980039-FRI-Driver.init");
-+	FRI = new FastResearchInterface(PREFIX "/etc/980039-FRI-Driver.init");
- #endif
- 
- #ifdef __MACOS__
+ #ifdef __LINUX__
+ 	fprintf(stdout, "You may need superuser permission to run this program.\n");
+ 	fflush(stdout);
+-	FRI = new FastResearchInterface("/home/torsten/etc/980039-FRI-Driver.init");
++	FRI = new FastResearchInterface(PREFIX "/etc/980039-FRI-Driver.init");
+ #endif
+ 
+ #ifdef __MACOS__
diff --git a/FRILibrary/patches/patch-ac b/FRILibrary/patches/patch-ac
index 1ad5de85fa25e919a16b2a5402f41e8efde28718..142a14fd2192ebc16e4a23de31e673f75c30de88 100644
--- a/FRILibrary/patches/patch-ac
+++ b/FRILibrary/patches/patch-ac
@@ -1,11 +1,11 @@
 --- ./src/LWRGettingStartedExamples/LWRCartImpedanceControlExample.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/LWRGettingStartedExamples/LWRCartImpedanceControlExample.cpp	2016-05-23 17:54:55.458384000 +0200
 @@ -91,7 +91,7 @@
- 
- 	LWRCartImpedanceController	*Robot;
- 
--	Robot	=	new LWRCartImpedanceController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
-+	Robot	=	new LWRCartImpedanceController(PREFIX "/etc/980039-FRI-Driver.init");
- 
- 	fprintf(stdout, "RobotCartImpedanceController object created. Starting the robot...\n");
- 
+ 
+ 	LWRCartImpedanceController	*Robot;
+ 
+-	Robot	=	new LWRCartImpedanceController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
++	Robot	=	new LWRCartImpedanceController(PREFIX "/etc/980039-FRI-Driver.init");
+ 
+ 	fprintf(stdout, "RobotCartImpedanceController object created. Starting the robot...\n");
+ 
diff --git a/FRILibrary/patches/patch-ad b/FRILibrary/patches/patch-ad
index 7f548fa2e660e0b65492757f8dd5de8300188949..c2305880ac6e790c03d1316a6ce920573519aaa9 100644
--- a/FRILibrary/patches/patch-ad
+++ b/FRILibrary/patches/patch-ad
@@ -1,11 +1,11 @@
 --- ./src/LWRGettingStartedExamples/LWRJointImpedanceControlExample.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/LWRGettingStartedExamples/LWRJointImpedanceControlExample.cpp	2016-05-23 18:56:00.196563000 +0200
 @@ -81,7 +81,7 @@
- 
- 	LWRJointImpedanceController	*Robot;
- 
--	Robot	=	new LWRJointImpedanceController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
-+	Robot	=	new LWRJointImpedanceController(PREFIX "/etc/980039-FRI-Driver.init");
- 
- 	fprintf(stdout, "RobotJointImpedanceController object created. Starting the robot...\n");
- 
+ 
+ 	LWRJointImpedanceController	*Robot;
+ 
+-	Robot	=	new LWRJointImpedanceController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
++	Robot	=	new LWRJointImpedanceController(PREFIX "/etc/980039-FRI-Driver.init");
+ 
+ 	fprintf(stdout, "RobotJointImpedanceController object created. Starting the robot...\n");
+ 
diff --git a/FRILibrary/patches/patch-ae b/FRILibrary/patches/patch-ae
index d60402726608c38cd12b677537c548670f5b3ae3..5dbf3701358f8c709473511eafe7b0d72fb96484 100644
--- a/FRILibrary/patches/patch-ae
+++ b/FRILibrary/patches/patch-ae
@@ -1,11 +1,11 @@
 --- ./src/LWRGettingStartedExamples/LWRJointPositionControlExample.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/LWRGettingStartedExamples/LWRJointPositionControlExample.cpp	2016-05-23 17:55:43.250402000 +0200
 @@ -81,7 +81,7 @@
- 
- 	LWRJointPositionController	*Robot;
- 
--	Robot	=	new LWRJointPositionController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
-+	Robot	=	new LWRJointPositionController(PREFIX "/etc/980039-FRI-Driver.init");
- 
- 	fprintf(stdout, "RobotJointPositionController object created. Starting the robot...\n");
- 
+ 
+ 	LWRJointPositionController	*Robot;
+ 
+-	Robot	=	new LWRJointPositionController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
++	Robot	=	new LWRJointPositionController(PREFIX "/etc/980039-FRI-Driver.init");
+ 
+ 	fprintf(stdout, "RobotJointPositionController object created. Starting the robot...\n");
+ 
diff --git a/FRILibrary/patches/patch-af b/FRILibrary/patches/patch-af
index 97ce4c56ba189bae6eb1d31e054b1c512a9af068..9e2d6d3138a33024bf4d11739f25fb0153f66b50 100644
--- a/FRILibrary/patches/patch-af
+++ b/FRILibrary/patches/patch-af
@@ -1,11 +1,11 @@
 --- ./src/LWRGettingStartedExamples/LWRLoggingExample.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/LWRGettingStartedExamples/LWRLoggingExample.cpp	2016-05-23 17:56:15.514740000 +0200
 @@ -87,7 +87,7 @@
- 
- 	LWRJointPositionController	*Robot;
- 
--	Robot	=	new LWRJointPositionController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
-+	Robot	=	new LWRJointPositionController(PREFIX "/etc/980039-FRI-Driver.init");
- 
- 	fprintf(stdout, "RobotJointPositionController object created. Starting the robot...\n");
- 
+ 
+ 	LWRJointPositionController	*Robot;
+ 
+-	Robot	=	new LWRJointPositionController("/home/lwrcontrol/etc/980039-FRI-Driver.init");
++	Robot	=	new LWRJointPositionController(PREFIX "/etc/980039-FRI-Driver.init");
+ 
+ 	fprintf(stdout, "RobotJointPositionController object created. Starting the robot...\n");
+ 
diff --git a/FRILibrary/patches/patch-ag b/FRILibrary/patches/patch-ag
index fdd3e9dbe1e3fae961c8c5dfc975f8de736a0d59..f6c19b19995577d1f010f1f15a802a2aa8bb1b76 100644
--- a/FRILibrary/patches/patch-ag
+++ b/FRILibrary/patches/patch-ag
@@ -1,17 +1,17 @@
 --- ./src/FastResearchInterfaceLibrary/FastResearchInterface.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/FastResearchInterfaceLibrary/FastResearchInterface.cpp	2016-05-23 18:26:01.337261000 +0200
 @@ -240,12 +240,12 @@
- 	}
- 	else
- 	{
--		sprintf(this->LoggingPath, ".%s\0", OS_FOLDER_SEPARATOR);
-+		sprintf(this->LoggingPath, ".%s", OS_FOLDER_SEPARATOR);
- 	}
- 
- 	if (strlen(this->LoggingFileName) == 0)
- 	{
--		sprintf(this->LoggingFileName, "FRI.dat\0");
-+		sprintf(this->LoggingFileName, "FRI.dat");
- 	}
- 
- 	this->DataLogger	=	new DataLogging(	this->RobotName
+ 	}
+ 	else
+ 	{
+-		sprintf(this->LoggingPath, ".%s\0", OS_FOLDER_SEPARATOR);
++		sprintf(this->LoggingPath, ".%s", OS_FOLDER_SEPARATOR);
+ 	}
+ 
+ 	if (strlen(this->LoggingFileName) == 0)
+ 	{
+-		sprintf(this->LoggingFileName, "FRI.dat\0");
++		sprintf(this->LoggingFileName, "FRI.dat");
+ 	}
+ 
+ 	this->DataLogger	=	new DataLogging(	this->RobotName
diff --git a/FRILibrary/patches/patch-ah b/FRILibrary/patches/patch-ah
index 2b951801e8f4d7ecdbf9b7a921bccda559b3c55d..344f64dbe832e1c13367b292f09124237bb51319 100644
--- a/FRILibrary/patches/patch-ah
+++ b/FRILibrary/patches/patch-ah
@@ -1,11 +1,11 @@
 --- ./src/FastResearchInterfaceLibrary/UDPSocket.cpp.orig	2014-12-03 09:27:36.000000000 +0100
 +++ ./src/FastResearchInterfaceLibrary/UDPSocket.cpp	2016-05-23 18:27:33.082396000 +0200
 @@ -157,7 +157,7 @@
- 		}
- 		else
- 		{
--			fprintf(stderr, "ERROR: Data size incorrect (received: %d, expected %d)\n", DataReceived, sizeof(FRIDataReceivedFromKRC));
-+			fprintf(stderr, "ERROR: Data size incorrect (received: %d, expected %zu)\n", DataReceived, sizeof(FRIDataReceivedFromKRC));
- 			fflush(stderr);
- 		}
- 	}
+ 		}
+ 		else
+ 		{
+-			fprintf(stderr, "ERROR: Data size incorrect (received: %d, expected %d)\n", DataReceived, sizeof(FRIDataReceivedFromKRC));
++			fprintf(stderr, "ERROR: Data size incorrect (received: %d, expected %zu)\n", DataReceived, sizeof(FRIDataReceivedFromKRC));
+ 			fflush(stderr);
+ 		}
+ 	}
diff --git a/FRILibrary/patches/patch-ai b/FRILibrary/patches/patch-ai
index a14b2618679fae19394c387a1783ee9166d156e1..5dfbf4f404084ac60ec4d440bce0b7b8200d1cf1 100644
--- a/FRILibrary/patches/patch-ai
+++ b/FRILibrary/patches/patch-ai
@@ -1,19 +1,21 @@
+ * Generate PIC library, so that this can be linked in shared libraries
+ * Pass PREFIX to avoid hardcoding paths
+
 --- Linux/Makefile.global.orig	2013-10-30 09:28:32.000000000 +0100
 +++ Linux/Makefile.global	2016-05-23 18:47:54.687506000 +0200
-@@ -80,13 +80,14 @@
- DEBUG_EXE_DIR=debug/bin
- DEBUG_OBJ_DIR=debug/obj
- DEBUG_LIB_DIR=debug/lib
--DEBUG_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -ggdb
-+DEBUG_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -ggdb -DPREFIX=\"${PREFIX}\"
-+
- DEBUG_CL= g++ $(SYSTEM_LIBS) -gddb
- 
- RELEASE_EXE_DIR=release/bin
- RELEASE_OBJ_DIR=release/obj
- RELEASE_LIB_DIR=release/lib
--RELEASE_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -O3
-+RELEASE_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -O3 -DPREFIX=\"${PREFIX}\"
- RELEASE_CL= g++ $(SYSTEM_LIBS)
- 
- AR= ar vrs 
+@@ -80,13 +80,13 @@
+ DEBUG_EXE_DIR=debug/bin
+ DEBUG_OBJ_DIR=debug/obj
+ DEBUG_LIB_DIR=debug/lib
+-DEBUG_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -ggdb
++DEBUG_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -ggdb -fPIC -DPREFIX=\"${PREFIX}\"
+ DEBUG_CL= g++ $(SYSTEM_LIBS) -gddb
+ 
+ RELEASE_EXE_DIR=release/bin
+ RELEASE_OBJ_DIR=release/obj
+ RELEASE_LIB_DIR=release/lib
+-RELEASE_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -O3
++RELEASE_CC= g++ -c -I $(INCLUDE_DIR) -D$(TARGET_OS) -O3 -fPIC -DPREFIX=\"${PREFIX}\"
+ RELEASE_CL= g++ $(SYSTEM_LIBS)
+ 
+ AR= ar vrs 
diff --git a/FRILibrary/patches/patch-aj b/FRILibrary/patches/patch-aj
new file mode 100644
index 0000000000000000000000000000000000000000..9891b73a26a50d4a318d8f067e7d1a0b396d5dda
--- /dev/null
+++ b/FRILibrary/patches/patch-aj
@@ -0,0 +1,38 @@
+Don't fail to create pthread if user don't have CAP_SYS_NICE
+
+--- src/FastResearchInterfaceLibrary/FastResearchInterface.cpp~	2017-12-08 16:40:08.568668402 +0100
++++ src/FastResearchInterfaceLibrary/FastResearchInterface.cpp	2017-12-08 18:40:03.925198913 +0100
+@@ -155,15 +155,12 @@
+ 
+ 	// Set the thread scheduling policy attribute to round robin
+ 	// default is OTHER which equals RR in QNX 6.5.0.
+-	pthread_attr_setschedpolicy(&AttributesKRCCommunicationThread	,	SCHED_FIFO								)	;
+ 	pthread_attr_setschedpolicy(&AttributesTimerThread				,	SCHED_FIFO								)	;
+ 
+ 	// Set the thread's inherit-scheduling attribute to explicit
+ 	// otherwise, the scheduling parameters Cannot be changed (e.g., priority)
+-	pthread_attr_setinheritsched(&AttributesKRCCommunicationThread	,	PTHREAD_EXPLICIT_SCHED					)	;
+ 	pthread_attr_setinheritsched(&AttributesTimerThread				,	PTHREAD_EXPLICIT_SCHED					)	;
+ 
+-	pthread_attr_setschedparam(&AttributesKRCCommunicationThread	,	&SchedulingParamsKRCCommunicationThread	)	;
+ 	pthread_attr_setschedparam(&AttributesTimerThread				,	&SchedulingParamsTimerThread			)	;
+ 
+ 	// this is supposed to become the message thread
+@@ -229,7 +226,16 @@
+ 	}
+ 
+ 	ThreadCreated	=	false;
+-	pthread_mutex_unlock(&(this->MutexForThreadCreation));
++
++        if (pthread_setschedparam(KRCCommunicationThread, SCHED_FIFO,
++                                  &SchedulingParamsKRCCommunicationThread)) {
++          if (errno == EPERM) {
++            this->OutputConsole->printf("Warning: not enough privilege "
++                                        "to set scheduling parameters\n");
++          }
++        }
++
++        pthread_mutex_unlock(&(this->MutexForThreadCreation));
+ 
+ 	if (strlen(this->LoggingPath) > 0)
+ 	{
diff --git a/FRILibrary/patches/patch-ak b/FRILibrary/patches/patch-ak
new file mode 100644
index 0000000000000000000000000000000000000000..0a4b7145cd7c0d99d0b5c749eead715152446ad7
--- /dev/null
+++ b/FRILibrary/patches/patch-ak
@@ -0,0 +1,24 @@
+Don't fail to create pthread if user don't have CAP_SYS_NICE
+
+--- src/FastResearchInterfaceLibrary/Console.cpp~	2014-12-03 09:27:36.000000000 +0100
++++ src/FastResearchInterfaceLibrary/Console.cpp	2017-12-08 18:41:56.650521057 +0100
+@@ -81,9 +81,6 @@
+ 	ThreadSchedulingParams.sched_priority	=	Priority;
+ 
+ 	pthread_attr_init			(&ThreadAttributes								)	;
+-	pthread_attr_setschedpolicy	(&ThreadAttributes	,	SCHED_FIFO				)	;
+-	pthread_attr_setinheritsched(&ThreadAttributes	,	PTHREAD_EXPLICIT_SCHED	)	;
+-	pthread_attr_setschedparam	(&ThreadAttributes	,	&ThreadSchedulingParams	)	;
+ 
+ 	pthread_create(		&ConsoleThread
+ 				   	,	&ThreadAttributes
+@@ -97,6 +94,9 @@
+ 		pthread_cond_wait (&(this->CondVar), &(this->Mutex));
+ 	}
+ 
++        pthread_setschedparam(ConsoleThread, SCHED_FIFO,
++                              &ThreadSchedulingParams);
++
+ 	pthread_mutex_unlock(&(this->Mutex));				   	
+ 
+ 	memset(this->Buffer, 0x0, 		2