diff --git a/robot/MXLAB/Controller1/Controller1.controller b/robot/MXLAB/Controller1/Controller1.controller
new file mode 100644
index 0000000..5f3e6bb
--- /dev/null
+++ b/robot/MXLAB/Controller1/Controller1.controller
@@ -0,0 +1,13 @@
+
+
+ s7.9.1
+
+
+ TX60L-HB-L-WS
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/applicom/Modbus/modbus.xml b/robot/MXLAB/Controller1/usr/applicom/Modbus/modbus.xml
new file mode 100644
index 0000000..607856a
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/applicom/Modbus/modbus.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/robot/MXLAB/Controller1/usr/configs/arm.cfx b/robot/MXLAB/Controller1/usr/configs/arm.cfx
new file mode 100644
index 0000000..9742c85
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/arm.cfx
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/bio.cfx b/robot/MXLAB/Controller1/usr/configs/bio.cfx
new file mode 100644
index 0000000..ac01acb
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/bio.cfx
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/bio2.cfx b/robot/MXLAB/Controller1/usr/configs/bio2.cfx
new file mode 100644
index 0000000..867f8f4
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/bio2.cfx
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/cell.cfx b/robot/MXLAB/Controller1/usr/configs/cell.cfx
new file mode 100644
index 0000000..617cbc5
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/cell.cfx
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/cio.cfx b/robot/MXLAB/Controller1/usr/configs/cio.cfx
new file mode 100644
index 0000000..68c8816
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/cio.cfx
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/controller.cfx b/robot/MXLAB/Controller1/usr/configs/controller.cfx
new file mode 100644
index 0000000..7b3ca9f
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/controller.cfx
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/encoder.cfx b/robot/MXLAB/Controller1/usr/configs/encoder.cfx
new file mode 100644
index 0000000..ccb512d
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/encoder.cfx
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/mio.cfx b/robot/MXLAB/Controller1/usr/configs/mio.cfx
new file mode 100644
index 0000000..f57cf92
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/mio.cfx
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/network.cfx b/robot/MXLAB/Controller1/usr/configs/network.cfx
new file mode 100644
index 0000000..e784a07
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/network.cfx
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/profiles/default.cfx b/robot/MXLAB/Controller1/usr/configs/profiles/default.cfx
new file mode 100644
index 0000000..a173ef0
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/profiles/default.cfx
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/robot/MXLAB/Controller1/usr/configs/profiles/maintenance.cfx b/robot/MXLAB/Controller1/usr/configs/profiles/maintenance.cfx
new file mode 100644
index 0000000..e5fa2ea
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/profiles/maintenance.cfx
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/sio.cfx b/robot/MXLAB/Controller1/usr/configs/sio.cfx
new file mode 100644
index 0000000..b330109
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/sio.cfx
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/configs/systemios.cfx b/robot/MXLAB/Controller1/usr/configs/systemios.cfx
new file mode 100644
index 0000000..74107f3
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/systemios.cfx
@@ -0,0 +1,304 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/robot/MXLAB/Controller1/usr/configs/val3version.xml b/robot/MXLAB/Controller1/usr/configs/val3version.xml
new file mode 100644
index 0000000..7824503
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/configs/val3version.xml
@@ -0,0 +1,4 @@
+
+
+ s7.9.1
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.dtx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.dtx
new file mode 100644
index 0000000..b59ee63
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.dtx
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.pjx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.pjx
new file mode 100644
index 0000000..f9a6756
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/ForceDetection.pjx
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comModbus.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comModbus.pgx
new file mode 100644
index 0000000..146cce8
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comModbus.pgx
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx
new file mode 100644
index 0000000..8aab98e
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/comTcp.pgx
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+ if rec_val>31
+ rx=rx+chr(rec_val)
+ elseIf rec_val==10
+ if len(rx)<4
+ rx = ""
+ else
+ msg_id = left(rx, 4)
+ if msg_id == "EVT "
+ rx=""
+ if events[0] == ""
+ sSio = msg_id
+ else
+ sSio = msg_id + events[0]
+ for index=0 to 8
+ events[index]= events[index+1]
+ endFor
+ events[9] = ""
+ endIf
+ else
+ msg = right(rx, len(rx)-4)
+ rx=""
+ for index=0 to 9
+ args[index]=""
+ endFor
+ index = find(msg, " ")
+ if index < 0
+ cmd = msg
+ else
+ cmd = left(msg, index)
+ msg = right(msg, len(msg) - index -1)
+ arg=0
+ while (len(msg) > 0 and (arg < 10))
+ index = find(msg, array_separator)
+ if index<0
+ args[arg] = msg
+ msg =""
+ else
+ args[arg] = left(msg, index)
+ msg = right(msg, len(msg) - index -1)
+ endIf
+ arg = arg+1
+ endWhile
+ endIf
+ tx = ""
+ ex = ""
+ call onCommandTcp(cmd,args, tx, ex)
+ if len(ex) == 0
+ sSio = msg_id + tx
+ else
+ msg_id = replace (msg_id,"*",1,3)
+ sSio = msg_id + ex
+ endIf
+ endIf
+ endIf
+ endIf
+ endWhile
+ delay(0)
+ endWhile
+end]]>
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/detect.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/detect.pgx
new file mode 100644
index 0000000..01c30c7
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/detect.pgx
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ nJntMaxMeasured[l_nIndex]
+ nJntMaxMeasured[l_nIndex]=l_nPerc
+ endIf
+ l_bCondition=abs(nJntForce[l_nIndex]) > x_nThreshold
+
+ gotoxy(0,8+l_nIndex)
+ put(toString(".2",nJntMaxForce[l_nIndex]))
+ gotoxy(8,8+l_nIndex)
+ put(toString(".2",x_nThreshold))
+ gotoxy(16,8+l_nIndex)
+ put(toString(".2",abs(nJntForce[l_nIndex])))
+ gotoxy(24,8+l_nIndex)
+ put(toString(".2",l_nPerc))
+ gotoxy(32,8+l_nIndex)
+ put(toString(".2",nJntMaxMeasured[l_nIndex]))
+
+ if l_bCondition
+ stopMove()
+ resetMotion()
+ bContact=true
+ l_sDisplay="Contact: force on joint "+toString("",l_nIndex+1)+" = "+toString("",abs(nJntForce[l_nIndex]))
+ logMsg(l_sDisplay)
+ endIf
+ endFor
+ delay(0)
+ endWhile
+end]]>
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/getContact.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/getContact.pgx
new file mode 100644
index 0000000..59c8c37
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/getContact.pgx
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandModbus.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandModbus.pgx
new file mode 100644
index 0000000..09fe785
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandModbus.pgx
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx
new file mode 100644
index 0000000..0af5c5a
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/onCommandTcp.pgx
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/resetData.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/resetData.pgx
new file mode 100644
index 0000000..f9ecb24
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/resetData.pgx
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/sendEventTcp.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/sendEventTcp.pgx
new file mode 100644
index 0000000..a503f6e
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/sendEventTcp.pgx
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setInZone.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setInZone.pgx
new file mode 100644
index 0000000..537bd33
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setInZone.pgx
@@ -0,0 +1,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setOutZone.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setOutZone.pgx
new file mode 100644
index 0000000..44c16b4
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/setOutZone.pgx
@@ -0,0 +1,22 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/simulateEvents.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/simulateEvents.pgx
new file mode 100644
index 0000000..8af977a
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/simulateEvents.pgx
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/start.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/start.pgx
new file mode 100644
index 0000000..53c0354
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/start.pgx
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startDetection.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startDetection.pgx
new file mode 100644
index 0000000..2905e91
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startDetection.pgx
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startTraining.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startTraining.pgx
new file mode 100644
index 0000000..8b89127
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/startTraining.pgx
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/stop.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/stop.pgx
new file mode 100644
index 0000000..29c09b8
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/stop.pgx
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/train.pgx b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/train.pgx
new file mode 100644
index 0000000..4ab99bc
--- /dev/null
+++ b/robot/MXLAB/Controller1/usr/usrapp/ForceDetection/train.pgx
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ nJntMaxForce[l_nIndex]
+ nJntMaxForce[l_nIndex]=abs(nJntForce[l_nIndex])
+ endIf
+ endFor
+ delay(0)
+ endWhile
+end]]>
+
+
\ No newline at end of file
diff --git a/robot/MXLAB/MXLAB.cell b/robot/MXLAB/MXLAB.cell
new file mode 100644
index 0000000..12217e7
--- /dev/null
+++ b/robot/MXLAB/MXLAB.cell
@@ -0,0 +1,4 @@
+
+
+
+ |
\ No newline at end of file
diff --git a/script/local.py b/script/local.py
index e6ca0ac..2ca406b 100644
--- a/script/local.py
+++ b/script/local.py
@@ -220,3 +220,4 @@ def fit(ydata, xdata = None, draw_plot = True):
print "Invalid gaussian fit: " + str(mean)
return (None, None, None)
+context = get_context()
\ No newline at end of file