diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..62d8a42
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,189 @@
+cmake_minimum_required(VERSION 2.8.3)
+project(archi_reactive)
+
+## Find catkin macros and libraries
+## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
+## is used, also find other catkin packages
+find_package(catkin REQUIRED COMPONENTS
+ geometry_msgs
+ rospy
+ sensor_msgs
+ std_msgs
+)
+
+## System dependencies are found with CMake's conventions
+# find_package(Boost REQUIRED COMPONENTS system)
+
+
+## Uncomment this if the package has a setup.py. This macro ensures
+## modules and global scripts declared therein get installed
+## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
+# catkin_python_setup()
+
+################################################
+## Declare ROS messages, services and actions ##
+################################################
+
+## To declare and build messages, services or actions from within this
+## package, follow these steps:
+## * Let MSG_DEP_SET be the set of packages whose message types you use in
+## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
+## * In the file package.xml:
+## * add a build_depend tag for "message_generation"
+## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
+## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
+## but can be declared for certainty nonetheless:
+## * add a run_depend tag for "message_runtime"
+## * In this file (CMakeLists.txt):
+## * add "message_generation" and every package in MSG_DEP_SET to
+## find_package(catkin REQUIRED COMPONENTS ...)
+## * add "message_runtime" and every package in MSG_DEP_SET to
+## catkin_package(CATKIN_DEPENDS ...)
+## * uncomment the add_*_files sections below as needed
+## and list every .msg/.srv/.action file to be processed
+## * uncomment the generate_messages entry below
+## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
+
+## Generate messages in the 'msg' folder
+# add_message_files(
+# FILES
+# Message1.msg
+# Message2.msg
+# )
+
+## Generate services in the 'srv' folder
+# add_service_files(
+# FILES
+# Service1.srv
+# Service2.srv
+# )
+
+## Generate actions in the 'action' folder
+# add_action_files(
+# FILES
+# Action1.action
+# Action2.action
+# )
+
+## Generate added messages and services with any dependencies listed here
+# generate_messages(
+# DEPENDENCIES
+# geometry_msgs# sensor_msgs# std_msgs
+# )
+
+################################################
+## Declare ROS dynamic reconfigure parameters ##
+################################################
+
+## To declare and build dynamic reconfigure parameters within this
+## package, follow these steps:
+## * In the file package.xml:
+## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
+## * In this file (CMakeLists.txt):
+## * add "dynamic_reconfigure" to
+## find_package(catkin REQUIRED COMPONENTS ...)
+## * uncomment the "generate_dynamic_reconfigure_options" section below
+## and list every .cfg file to be processed
+
+## Generate dynamic reconfigure parameters in the 'cfg' folder
+# generate_dynamic_reconfigure_options(
+# cfg/DynReconf1.cfg
+# cfg/DynReconf2.cfg
+# )
+
+###################################
+## catkin specific configuration ##
+###################################
+## The catkin_package macro generates cmake config files for your package
+## Declare things to be passed to dependent projects
+## INCLUDE_DIRS: uncomment this if you package contains header files
+## LIBRARIES: libraries you create in this project that dependent projects also need
+## CATKIN_DEPENDS: catkin_packages dependent projects also need
+## DEPENDS: system dependencies of this project that dependent projects also need
+catkin_package(
+# INCLUDE_DIRS include
+# LIBRARIES archi_reactive
+# CATKIN_DEPENDS geometry_msgs rospy sensor_msgs std_msgs
+# DEPENDS system_lib
+)
+
+###########
+## Build ##
+###########
+
+## Specify additional locations of header files
+## Your package locations should be listed before other locations
+# include_directories(include)
+include_directories(
+ ${catkin_INCLUDE_DIRS}
+)
+
+## Declare a C++ library
+# add_library(archi_reactive
+# src/${PROJECT_NAME}/archi_reactive.cpp
+# )
+
+## Add cmake target dependencies of the library
+## as an example, code may need to be generated before libraries
+## either from message generation or dynamic reconfigure
+# add_dependencies(archi_reactive ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Declare a C++ executable
+# add_executable(archi_reactive_node src/archi_reactive_node.cpp)
+
+## Add cmake target dependencies of the executable
+## same as for the library above
+# add_dependencies(archi_reactive_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
+
+## Specify libraries to link a library or executable target against
+# target_link_libraries(archi_reactive_node
+# ${catkin_LIBRARIES}
+# )
+
+#############
+## Install ##
+#############
+
+# all install targets should use catkin DESTINATION variables
+# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
+
+## Mark executable scripts (Python etc.) for installation
+## in contrast to setup.py, you can choose the destination
+# install(PROGRAMS
+# scripts/my_python_script
+# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
+
+## Mark executables and/or libraries for installation
+# install(TARGETS archi_reactive archi_reactive_node
+# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
+# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
+# )
+
+## Mark cpp header files for installation
+# install(DIRECTORY include/${PROJECT_NAME}/
+# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
+# FILES_MATCHING PATTERN "*.h"
+# PATTERN ".svn" EXCLUDE
+# )
+
+## Mark other files for installation (e.g. launch and bag files, etc.)
+# install(FILES
+# # myfile1
+# # myfile2
+# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
+# )
+
+#############
+## Testing ##
+#############
+
+## Add gtest based cpp test target and link libraries
+# catkin_add_gtest(${PROJECT_NAME}-test test/test_archi_reactive.cpp)
+# if(TARGET ${PROJECT_NAME}-test)
+# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
+# endif()
+
+## Add folders to be run by python nosetests
+# catkin_add_nosetests(test)
diff --git a/package.xml b/package.xml
new file mode 100644
index 0000000..8984f7e
--- /dev/null
+++ b/package.xml
@@ -0,0 +1,58 @@
+
+
+ archi_reactive
+ 0.0.0
+ The archi_reactive package
+
+
+
+
+ turtlebot
+
+
+
+
+
+ TODO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ catkin
+ geometry_msgs
+ rospy
+ sensor_msgs
+ std_msgs
+ geometry_msgs
+ rospy
+ sensor_msgs
+ std_msgs
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/scripts/.archi_reactive.py.swp b/scripts/.archi_reactive.py.swp
new file mode 100644
index 0000000..4f3076c
Binary files /dev/null and b/scripts/.archi_reactive.py.swp differ
diff --git a/scripts/archi_reactive_Andrei_Théo.py b/scripts/archi_reactive_Andrei_Théo.py
new file mode 100644
index 0000000..60ca741
--- /dev/null
+++ b/scripts/archi_reactive_Andrei_Théo.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# Bamako
+
+# Andrei COROCAESCU, Théophile LEMARIÉ
+# 02.12.2019
+
+import rospy
+from geometry_msgs.msg import Twist
+from sensor_msgs.msg import LaserScan
+import sys, tty, termios
+from cv_bridge import CvBridge, CvBridgeError
+import numpy as np
+import cv2
+import cv2.cv as cv
+import math
+import numpy as np
+
+# noeud publiant sur le topic /cmd_vel_mux[...] pour contrôler la vitesse du robot
+velocity_publisher = rospy.Publisher("/cmd_vel_mux/input/teleop", Twist, queue_size=10)
+
+# callback permettant de réagir aux obstacles
+def callback(msg):
+ vel_msg = Twist()
+
+ # valeurs par défaut, dans le cas où aucun obstacle n'est détecté
+ vel_msg.linear.x = 0.25
+ vel_msg.angular.z = 0.0
+
+ # extraction des données de la kinect
+ ranges = msg.ranges
+ for i in ranges[100:500]:
+ # condition d'obstacle
+ if (i < 1.0 and i is not float("nan")): # obstacle trouvé devant, dans un angle de 30° environ
+ vel_msg.linear.x = 0.05 # diminuer la vitesse linéaire
+ vel_msg.angular.z = 1.5 # tourner à gauche
+ print("OBSTACLE")
+ break
+
+ # envoyer les commande de vitesse / rotation
+ velocity_publisher.publish(vel_msg)
+
+
+if __name__ == '__main__':
+ # déclaration des noeuds
+ # noeud d'écoute sur le topic /scan (données de profondeur de la kinect)
+ rospy.init_node('listener', anonymous=True)
+ rospy.Subscriber("/scan", LaserScan, callback)
+ rospy.spin()
+
diff --git a/scripts/copy.sh b/scripts/copy.sh
deleted file mode 100755
index bd9e0c2..0000000
--- a/scripts/copy.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# copies code from master to all slaves
-scp -r $PWD/../* theo@192.168.0.2:~Documents/recupPC/ recupPC
-scp -r $PWD/../* theo@192.168.0.3:~Documents/recupPC/ recupPC
diff --git a/scripts/netconfig.sh b/scripts/netconfig.sh
deleted file mode 100755
index 590f110..0000000
--- a/scripts/netconfig.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-# add ip address to ethernet interface
-ip addr add 192.168.0.$1 dev eth0
-ip link set eth0 up
-
diff --git a/scripts/wait.sh b/scripts/wait.sh
deleted file mode 100755
index d2e45d6..0000000
--- a/scripts/wait.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-echo "Testing..."
-for var in $@
-do
- sleep $var
-done
-echo "Done."
diff --git a/scripts/wait_parallel.sh b/scripts/wait_parallel.sh
deleted file mode 100755
index 8492999..0000000
--- a/scripts/wait_parallel.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-echo "Testing..."
-
-SLEEPMAX=1
-
-for var in $@
-do
- sleep $var &
- if (( $var > $SLEEPMAX ));
- then
- SLEEPMAX=$var
- fi
-done
-sleep "$SLEEPMAX"
-echo "Done."
diff --git a/src/__pycache__/util.cpython-36.pyc b/src/__pycache__/util.cpython-36.pyc
deleted file mode 100755
index 6743be3..0000000
Binary files a/src/__pycache__/util.cpython-36.pyc and /dev/null differ
diff --git a/src/balancer.py b/src/balancer.py
deleted file mode 100755
index 5cb8021..0000000
--- a/src/balancer.py
+++ /dev/null
@@ -1,123 +0,0 @@
-import socket
-import threading
-import logging
-import time
-import sys
-from util import *
-
-message_queue=[]
-if len(sys.argv) > 1 :
- args = sys.argv[1:]
- for arg in args :
- message_queue.append("prog : " + arg)
-else :
- message_queue=["prog : echo hello"]
-
-print(message_queue)
-
-connections_threads=[] # active clients
-data_socks={}
-
-HOST = "127.0.0.1"
-PORT = 1235
-
-data_port = input("Port data ?") ## port de donnée utilisé pour le premier utilisateur (ensuite incrémenté par 1)
-if data_port == "":
- data_port = 43222
-else :
- data_port = int(data_port)
-
-nb_connections = 0
-stop = 0
-
-s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-
-### SERVER THREADS
-class thread_get_input(threading.Thread):
- def __init__(self) :
- threading.Thread.__init__(self)
- def run(self) :
- while True :
- program = get_program_input()
- if program != "" :
- message_queue.append("prog : " + program)
- if stop == 1 :
- break
-
-class thread_command_execution(threading.Thread) :
- def __init__(self) :
- threading.Thread.__init__(self)
- self.round_robin_inc = 0
- def run(self) :
- try :
- while True :
- if len(connections_threads) != 0 and len(message_queue) != 0 :
- index = self.round_robin_inc % len(connections_threads)
- thread = connections_threads[index]
- self.round_robin_inc = self.round_robin_inc + 1
- program = message_queue.pop()
- thread.command_program_execution(program)
- if stop == 1 :
- break
- except KeyboardInterrupt :
- self.s_data.close()
- raise
-
-class thread_handle_socket(threading.Thread):
- def __init__(self) :
- threading.Thread.__init__(self)
-
- data_socks[data_port] = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.s_data = data_socks[data_port]
- self.s_data.bind(('', data_port))
- self.s_data.listen()
- self.conn, self.addr = self.s_data.accept()
-
- def command_program_execution(self, program):
- self.conn.send(encode_message(program))
- start_time = time.time()
- data = self.conn.recv(1024)
- end_time = time.time()
- mtype, ret_val = get_message_type(decode_message(data))
- print("Received " + str(ret_val) + " from " + str(self.addr[0]) + " in %s seconds ", end_time - start_time )
-
- def run(self) :
- while True :
- time.sleep(1)
- if stop == 1 :
- break
-
-## MAIN
-
-# starts thread that reads input from user
-thread_input = thread_get_input()
-thread_input.start()
-
-thread_exec = thread_command_execution()
-thread_exec.start()
-
-s.bind(('', PORT))
-s.listen()
-try :
- while True :
- conn, addr = s.accept()
- print("Nouvelle machine connectée : " + addr[0])
- #send data port to connected host
- message = "prt : "+ str(data_port)
- conn.sendall(encode_message(message))
-
- # opens a new thread, which will open a data socket
- connections_threads.append(thread_handle_socket())
- connections_threads[nb_connections].start()
-
- # increment it for the next one
- data_port = data_port + 5;
- nb_connections = nb_connections + 1
-
- conn.close()
-
-except KeyboardInterrupt :
- s.close()
- stop = 1
- print(" Exiting...")
- raise
diff --git a/src/client.py b/src/client.py
deleted file mode 100755
index 814ee17..0000000
--- a/src/client.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import socket
-import threading
-import time
-import sys
-from util import *
-
-received_message_queue = []
-dataport = 0
-PORT = 1235
-stop = 0
-
-empty_inc = 0 #inc var counting number of empty packets received
-
-# server control socket
-if len(sys.argv) > 1:
- SERVER=sys.argv[1]
-else :
- SERVER = "127.0.0.1"
-print("server address: " , SERVER);
-
-### FUNCTIONS
-def thread_execute_programs() :
- while True :
- if len(received_message_queue) != 0 :
- print("handling message in thread")
- message = received_message_queue.pop()
- handle_message(message)
- if stop == 1 :
- break
- time.sleep(1)
-
-## MAIN CODE
-if __name__ == "__main__" :
-
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((SERVER, PORT)) # connection to server. Crashes if refused.
-
- # first receives port and closes connection to control socket...
- data = s.recv(1024)
- dataport = get_data_port(data)
- # close connection
- s.shutdown(socket.SHUT_RDWR)
- s.close()
-
- print("Trying to open connection to data socket... ")
- # opens the new server socket
- while True :
- try :
-
- s_data = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s_data.connect((SERVER, dataport))
- break
- except ConnectionRefusedError :
- print("retrying...")
- time.sleep(1)
-
- thread_exec = threading.Thread(target = thread_execute_programs, args=() )
- thread_exec.start()
-
- # then gets data
- while True :
- try :
- print("Waiting for data from server...")
- data = s_data.recv(1024)
-
- if len(data) == 0 :
- empty_inc = empty_inc + 1
- else :
- empty_inc = 0
-
- if empty_inc > 10 :
- raise KeyboardInterrupt
-
- message = decode_message(data)
- ret_val = handle_message(message)
- if ret_val is not None :
- s_data.send(str.encode(ret_val))
- elif ret_val == "-1" :
- print("Closing data socket...")
- raise KeyboardInterrupt
-
- except KeyboardInterrupt :
- s_data.close()
- stop = 1
- print(" Exiting...")
- raise
diff --git a/src/master b/src/master
deleted file mode 100755
index 3780f53..0000000
Binary files a/src/master and /dev/null differ
diff --git a/src/master.c b/src/master.c
deleted file mode 100755
index 8bbbb2c..0000000
--- a/src/master.c
+++ /dev/null
@@ -1,110 +0,0 @@
-#include
-#include
-#include "master.h"
-
-#define MASTERID = 0;
-#define MAX_PROGRAM_NUMBER = 10;
-#define MAX_PROGRAM_STR_LEN = 15;
-int activeNodes[10]; //nodes active in the network. Assumes that all nodes have a unique id.
-//char currentPrograms[MAX_PROGRAM_NUMBER][MAX_PROGRAM_STR_LEN]; //current programs : array of char pointers, each is a program string.
-
-void main()
-{
- for(;;)
- {
- char program[50];
- printf("Entrez un programme à exécuter : \n");
- scanf("%s", program );
-
- //calls roundRobin to decide where it should be executed
- //sends it over the network
- //gets program return output and print
-
-
- }
-}
-/*
-void initCurrentProgramsArray()
-{
- int i=0;
- while(i
-
-int node_id ; // id of local node, passed as an argument from shell
-
-void main()
-{
- // read id from command line
- for(;;)
- {
- // receives message from master
- // runs said program (already on local system)
- // returns the return value to master
- }
-}
-
-char getsMessageFromMaster()
-{
- // reads message from socket and returns a char[] or Message structure
-}
-
-int returnProgramNameFromMessage(char message[])
-{
- // returns the formatted program string to be passed to system call
-}
-
-int runProgram(char programName[], char args[])
-{
- // simple system call
- return 1 ; // or any other return form. For the moment int.
-}
diff --git a/src/util.py b/src/util.py
deleted file mode 100755
index 98d3c0b..0000000
--- a/src/util.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import re
-import subprocess
-
-regexp = "(.*) : (.*)"
-prog = re.compile(regexp)
-
-
-def add_client(addr) :
- connections.append(addr)
- print(connections)
-
-def del_client(addr) :
- if addr in connections :
- connections.remove(addr)
- print(connections)
-
-def get_program_input() :
- message = input("Entrez un programme à exécuter...")
- return message
-
-def print_program_return(addr, ret_val) :
- print("The program executed from " + str(addr) + " return the value " + str(ret_val))
-
-def get_message_type(message) :
- result=prog.findall(message)
- if len(result) == 0 :
- return None, None
- return str(result[0][0]), str(result[0][1])
-
-def get_data_port(message) :
- clr_msg = decode_message(message)
- mtype, mbody = get_message_type(clr_msg)
- return int(mbody)
-
-def encode_message(message) :
- return str.encode(message)
-
-def decode_message(raw_message) :
- return raw_message.decode("utf-8")
-
-def execute_program(program) :
- to_exec = program # executer en tâche de fond.
- ret_val = subprocess.call(program + "&", shell=True)
- return "val : " + str(ret_val)
-
-def handle_message(message):
- mtype, mbody = get_message_type(message)
- if mtype is None :
- return None
- if mtype == "prog" :
- print("Received prog " + mbody )
- ret_val = execute_program(mbody)
- return ret_val
- if mtype == "clo" :
- return -1
- elif mbody == "ret" :
- print(message)
- return None
-
-def round_robin() :
- roundrobin_inc = roundrobin_inc + 1
- print("Roundrobin... inc = " + str(roundrobin_inc))
- return roundrobin_inc