robot class + serial class ok. Tcp server class seems ok
This commit is contained in:
		
							parent
							
								
									5beb9ad12d
								
							
						
					
					
						commit
						d6c8a54215
					
				
					 58 changed files with 2210 additions and 1720 deletions
				
			
		
							
								
								
									
										16
									
								
								.vscode/c_cpp_properties.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.vscode/c_cpp_properties.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | { | ||||||
|  |     "configurations": [ | ||||||
|  |         { | ||||||
|  |             "name": "Linux", | ||||||
|  |             "includePath": [ | ||||||
|  |                 "${workspaceFolder}/**" | ||||||
|  |             ], | ||||||
|  |             "defines": [], | ||||||
|  |             "compilerPath": "/usr/bin/clang", | ||||||
|  |             "cStandard": "c11", | ||||||
|  |             "cppStandard": "c++17", | ||||||
|  |             "intelliSenseMode": "clang-x64" | ||||||
|  |         } | ||||||
|  |     ], | ||||||
|  |     "version": 4 | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | { | ||||||
|  |   // See https://go.microsoft.com/fwlink/?LinkId=733558 | ||||||
|  |     // for the documentation about the tasks.json format | ||||||
|  |     "version": "2.0.0", | ||||||
|  |     "tasks": [ | ||||||
|  |         { | ||||||
|  |             "taskName": "Compile on raspberry", | ||||||
|  |             "command": "rsync -az '${file}' 10.105.1.6:~ && ssh server.example.org 'chmod +x ./${fileBasename}; ./${fileBasename}'", | ||||||
|  |             "type": "shell", | ||||||
|  |             "group": { | ||||||
|  |                 "kind": "build", | ||||||
|  |                 "isDefault": true | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     ] | ||||||
|  | } | ||||||
|  | @ -0,0 +1,7 @@ | ||||||
|  | cmake_minimum_required(VERSION 3.9) | ||||||
|  | project(stress) | ||||||
|  | 
 | ||||||
|  | set(CMAKE_CXX_STANDARD 11) | ||||||
|  | 
 | ||||||
|  | set(SOURCE_FILES main.cpp ../src/robot.cpp ../src/robot.h) | ||||||
|  | add_executable(stress ${SOURCE_FILES}) | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| #include <iostream> | #include <iostream> | ||||||
| #include "../../src/definitions.h" | #include "../src/definitions.h" | ||||||
| #include "../../src/robot.h" | #include "../src/robot.h" | ||||||
| #include <ctime> | #include <ctime> | ||||||
| 
 | 
 | ||||||
| #define NB_TEST 50 | #define NB_TEST 50 | ||||||
|  | @ -19,7 +19,7 @@ int nb_unknown_cmd; | ||||||
| int flipflop; | int flipflop; | ||||||
| 
 | 
 | ||||||
| int main() { | int main() { | ||||||
|     if (open_communication_robot("/dev/ttyUSB0") != 0) { |     if (open_communication_robot() != 0) { | ||||||
|         std::cout << "Unable to open com port" << std::endl; |         std::cout << "Unable to open com port" << std::endl; | ||||||
| 
 | 
 | ||||||
|         return -1; |         return -1; | ||||||
							
								
								
									
										145
									
								
								software/raspberry/superviseur-robot/example/.cproject
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								software/raspberry/superviseur-robot/example/.cproject
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,145 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
|  | <?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> | ||||||
|  | 	<storageModule moduleId="org.eclipse.cdt.core.settings"> | ||||||
|  | 		<cconfiguration id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908"> | ||||||
|  | 			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908" moduleId="org.eclipse.cdt.core.settings" name="serialTest"> | ||||||
|  | 				<externalSettings/> | ||||||
|  | 				<extensions> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 				</extensions> | ||||||
|  | 			</storageModule> | ||||||
|  | 			<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||||||
|  | 				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="Test RF quality" id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908" name="serialTest" parent="com.atollic.managedbuild.pctools.config.gnu.exe.debug"> | ||||||
|  | 					<folderInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908." name="/" resourcePath=""> | ||||||
|  | 						<toolChain id="com.atollic.managedbuild.pctoolschain.gnu.exe.debug.1644719303" name="Atollic Linux PC Tools" superClass="com.atollic.managedbuild.pctoolschain.gnu.exe.debug"> | ||||||
|  | 							<targetPlatform id="com.atollic.pctools.managedbuild.target.gnu.platform.exe.debug.444948895" name="Debug Platform" superClass="com.atollic.pctools.managedbuild.target.gnu.platform.exe.debug"/> | ||||||
|  | 							<builder buildPath="${workspace_loc:/Dumber-Robot-Exemple}/Debug" customBuilderProperties="toolChainpathType=1|toolChainpathString=/opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/ARMTools/bin|" id="com.atollic.pctools.managedbuild.target.gnu.builder.exe.debug.703691933" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make Builder" superClass="com.atollic.pctools.managedbuild.target.gnu.builder.exe.debug"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.archiver.base.754185313" name="Archiver" superClass="com.atollic.managedbuild.pctools.gnu.archiver.base"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.cpp.compiler.exe.debug.460714726" name="C++ Compiler" superClass="com.atollic.managedbuild.pctools.gnu.cpp.compiler.exe.debug"> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.optimization.level.759860919" name="Optimization Level" superClass="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.debugging.level.1134609705" name="Debug Level" superClass="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.option.include.paths.1092205484" name="Include paths (-I)" superClass="com.atollic.pctools.gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> | ||||||
|  | 								</option> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.cpp.compiler.input.18466674" superClass="com.atollic.managedbuild.pctools.gnu.cpp.compiler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.c.compiler.exe.debug.1524457175" name="C Compiler" superClass="com.atollic.managedbuild.pctools.gnu.c.compiler.exe.debug"> | ||||||
|  | 								<option defaultValue="com.atollic.pctools.gnu.c.optimization.level.none" id="com.atollic.pctools.gnu.c.compiler.exe.debug.option.optimization.level.602619486" name="Optimization Level" superClass="com.atollic.pctools.gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.c.compiler.exe.debug.option.debugging.level.1202784327" name="Debug Level" superClass="com.atollic.pctools.gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.c.debugging.level.max" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.c.compiler.option.include.paths.608880272" name="Include paths (-I)" superClass="com.atollic.pctools.gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> | ||||||
|  | 								</option> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.c.compiler.input.978460249" superClass="com.atollic.managedbuild.pctools.gnu.c.compiler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.c.linker.exe.debug.650018959" name="C Linker" superClass="com.atollic.managedbuild.pctools.gnu.c.linker.exe.debug"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.cpp.linker.exe.debug.949894658" name="C++ Linker" superClass="com.atollic.managedbuild.pctools.gnu.cpp.linker.exe.debug"> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.cpp.linker.input.520817887" superClass="com.atollic.managedbuild.pctools.gnu.cpp.linker.input"> | ||||||
|  | 									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | ||||||
|  | 									<additionalInput kind="additionalinput" paths="$(LIBS)"/> | ||||||
|  | 								</inputType> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.assembler.exe.debug.1090002007" name="Assembler" superClass="com.atollic.managedbuild.pctools.gnu.assembler.exe.debug"> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.assembler.input.665455269" superClass="com.atollic.managedbuild.pctools.gnu.assembler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 						</toolChain> | ||||||
|  | 					</folderInfo> | ||||||
|  | 					<fileInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.107079152" name="image.h" rcbsApplicability="disable" resourcePath="lib/image.h" toolsToInvoke=""/> | ||||||
|  | 					<fileInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.2136136082" name="Makefile" rcbsApplicability="disable" resourcePath="src/Makefile" toolsToInvoke=""/> | ||||||
|  | 					<sourceEntries> | ||||||
|  | 						<entry excluding="monitor.cpp|image.h|image.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="lib"/> | ||||||
|  | 						<entry excluding="Makefile|videoExample.cpp|uiExample.cpp|serialExample.cpp|rtvideoExample.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> | ||||||
|  | 					</sourceEntries> | ||||||
|  | 				</configuration> | ||||||
|  | 			</storageModule> | ||||||
|  | 			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | ||||||
|  | 		</cconfiguration> | ||||||
|  | 		<cconfiguration id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353"> | ||||||
|  | 			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353" moduleId="org.eclipse.cdt.core.settings" name="Server test"> | ||||||
|  | 				<externalSettings/> | ||||||
|  | 				<extensions> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> | ||||||
|  | 				</extensions> | ||||||
|  | 			</storageModule> | ||||||
|  | 			<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||||||
|  | 				<configuration artifactName="ServerTest" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="Test server setup" id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353" name="Server test" parent="com.atollic.managedbuild.pctools.config.gnu.exe.debug"> | ||||||
|  | 					<folderInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353." name="/" resourcePath=""> | ||||||
|  | 						<toolChain id="com.atollic.managedbuild.pctoolschain.gnu.exe.debug.1769978487" name="Atollic Linux PC Tools" superClass="com.atollic.managedbuild.pctoolschain.gnu.exe.debug"> | ||||||
|  | 							<targetPlatform id="com.atollic.pctools.managedbuild.target.gnu.platform.exe.debug.1135891617" name="Debug Platform" superClass="com.atollic.pctools.managedbuild.target.gnu.platform.exe.debug"/> | ||||||
|  | 							<builder buildPath="${workspace_loc:/Dumber-Robot-Exemple}/Debug" customBuilderProperties="toolChainpathType=1|toolChainpathString=/opt/Atollic_TrueSTUDIO_for_STM32_x86_64_9.0.0/ARMTools/bin|" id="com.atollic.pctools.managedbuild.target.gnu.builder.exe.debug.1461439116" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="GNU Make Builder" superClass="com.atollic.pctools.managedbuild.target.gnu.builder.exe.debug"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.archiver.base.1426655308" name="Archiver" superClass="com.atollic.managedbuild.pctools.gnu.archiver.base"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.cpp.compiler.exe.debug.115182827" name="C++ Compiler" superClass="com.atollic.managedbuild.pctools.gnu.cpp.compiler.exe.debug"> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.optimization.level.1103169709" name="Optimization Level" superClass="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.debugging.level.1900144654" name="Debug Level" superClass="com.atollic.pctools.gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.cpp.compiler.option.include.paths.2096629070" name="Include paths (-I)" superClass="com.atollic.pctools.gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> | ||||||
|  | 								</option> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.cpp.compiler.input.928183158" superClass="com.atollic.managedbuild.pctools.gnu.cpp.compiler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.c.compiler.exe.debug.1435027661" name="C Compiler" superClass="com.atollic.managedbuild.pctools.gnu.c.compiler.exe.debug"> | ||||||
|  | 								<option defaultValue="com.atollic.pctools.gnu.c.optimization.level.none" id="com.atollic.pctools.gnu.c.compiler.exe.debug.option.optimization.level.169974575" name="Optimization Level" superClass="com.atollic.pctools.gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.c.compiler.exe.debug.option.debugging.level.980419679" name="Debug Level" superClass="com.atollic.pctools.gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="com.atollic.pctools.gnu.c.debugging.level.max" valueType="enumerated"/> | ||||||
|  | 								<option id="com.atollic.pctools.gnu.c.compiler.option.include.paths.967863685" name="Include paths (-I)" superClass="com.atollic.pctools.gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/lib}""/> | ||||||
|  | 									<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/> | ||||||
|  | 								</option> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.c.compiler.input.1991549921" superClass="com.atollic.managedbuild.pctools.gnu.c.compiler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.c.linker.exe.debug.1530079011" name="C Linker" superClass="com.atollic.managedbuild.pctools.gnu.c.linker.exe.debug"/> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.cpp.linker.exe.debug.1993338495" name="C++ Linker" superClass="com.atollic.managedbuild.pctools.gnu.cpp.linker.exe.debug"> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.cpp.linker.input.774293629" superClass="com.atollic.managedbuild.pctools.gnu.cpp.linker.input"> | ||||||
|  | 									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/> | ||||||
|  | 									<additionalInput kind="additionalinput" paths="$(LIBS)"/> | ||||||
|  | 								</inputType> | ||||||
|  | 							</tool> | ||||||
|  | 							<tool id="com.atollic.managedbuild.pctools.gnu.assembler.exe.debug.210875902" name="Assembler" superClass="com.atollic.managedbuild.pctools.gnu.assembler.exe.debug"> | ||||||
|  | 								<inputType id="com.atollic.managedbuild.pctools.gnu.assembler.input.61333264" superClass="com.atollic.managedbuild.pctools.gnu.assembler.input"/> | ||||||
|  | 							</tool> | ||||||
|  | 						</toolChain> | ||||||
|  | 					</folderInfo> | ||||||
|  | 					<fileInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353.lib/image.h" name="image.h" rcbsApplicability="disable" resourcePath="lib/image.h" toolsToInvoke=""/> | ||||||
|  | 					<fileInfo id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353.src/Makefile" name="Makefile" rcbsApplicability="disable" resourcePath="src/Makefile" toolsToInvoke=""/> | ||||||
|  | 					<sourceEntries> | ||||||
|  | 						<entry excluding="monitor.cpp|image.h|image.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="lib"/> | ||||||
|  | 						<entry excluding="serialTest.cpp|Makefile|videoExample.cpp|uiExample.cpp|serialExample.cpp|rtvideoExample.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> | ||||||
|  | 					</sourceEntries> | ||||||
|  | 				</configuration> | ||||||
|  | 			</storageModule> | ||||||
|  | 			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> | ||||||
|  | 		</cconfiguration> | ||||||
|  | 	</storageModule> | ||||||
|  | 	<storageModule moduleId="cdtBuildSystem" version="4.0.0"> | ||||||
|  | 		<project id="Dumber-Robot-Exemple.com.atollic.pctools.managedbuild.target.gnu.exe.162302072" name="Executable" projectType="com.atollic.pctools.managedbuild.target.gnu.exe"/> | ||||||
|  | 	</storageModule> | ||||||
|  | 	<storageModule moduleId="scannerConfiguration"> | ||||||
|  | 		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/> | ||||||
|  | 	</storageModule> | ||||||
|  | 	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> | ||||||
|  | 	<storageModule moduleId="refreshScope" versionNumber="2"> | ||||||
|  | 		<configuration configurationName="Server test"> | ||||||
|  | 			<resource resourceType="PROJECT" workspacePath="/Dumber-Robot-Exemple"/> | ||||||
|  | 		</configuration> | ||||||
|  | 		<configuration configurationName="serialTest"> | ||||||
|  | 			<resource resourceType="PROJECT" workspacePath="/Dumber-Robot-Exemple"/> | ||||||
|  | 		</configuration> | ||||||
|  | 		<configuration configurationName="Debug"> | ||||||
|  | 			<resource resourceType="PROJECT" workspacePath="/Dumber-Robot-Exemple"/> | ||||||
|  | 		</configuration> | ||||||
|  | 		<configuration configurationName="Release"> | ||||||
|  | 			<resource resourceType="PROJECT" workspacePath="/Dumber-Robot-Exemple"/> | ||||||
|  | 		</configuration> | ||||||
|  | 	</storageModule> | ||||||
|  | 	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/> | ||||||
|  | </cproject> | ||||||
							
								
								
									
										2
									
								
								software/raspberry/superviseur-robot/example/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								software/raspberry/superviseur-robot/example/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | /Debug/ | ||||||
|  | /Server test/ | ||||||
							
								
								
									
										0
									
								
								software/raspberry/superviseur-robot/example/.gitignores
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								software/raspberry/superviseur-robot/example/.gitignores
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										27
									
								
								software/raspberry/superviseur-robot/example/.project
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								software/raspberry/superviseur-robot/example/.project
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <projectDescription> | ||||||
|  | 	<name>Dumber-Robot-Exemple</name> | ||||||
|  | 	<comment></comment> | ||||||
|  | 	<projects> | ||||||
|  | 	</projects> | ||||||
|  | 	<buildSpec> | ||||||
|  | 		<buildCommand> | ||||||
|  | 			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | ||||||
|  | 			<triggers>clean,full,incremental,</triggers> | ||||||
|  | 			<arguments> | ||||||
|  | 			</arguments> | ||||||
|  | 		</buildCommand> | ||||||
|  | 		<buildCommand> | ||||||
|  | 			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | ||||||
|  | 			<triggers>full,incremental,</triggers> | ||||||
|  | 			<arguments> | ||||||
|  | 			</arguments> | ||||||
|  | 		</buildCommand> | ||||||
|  | 	</buildSpec> | ||||||
|  | 	<natures> | ||||||
|  | 		<nature>org.eclipse.cdt.core.cnature</nature> | ||||||
|  | 		<nature>org.eclipse.cdt.core.ccnature</nature> | ||||||
|  | 		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | ||||||
|  | 		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | ||||||
|  | 	</natures> | ||||||
|  | </projectDescription> | ||||||
|  | @ -0,0 +1,25 @@ | ||||||
|  | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||||
|  | <project> | ||||||
|  | 	<configuration id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908" name="serialTest"> | ||||||
|  | 		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||||||
|  | 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||||||
|  | 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> | ||||||
|  | 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||||||
|  | 			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="205429042390110507" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | ||||||
|  | 				<language-scope id="org.eclipse.cdt.core.gcc"/> | ||||||
|  | 				<language-scope id="org.eclipse.cdt.core.g++"/> | ||||||
|  | 			</provider> | ||||||
|  | 		</extension> | ||||||
|  | 	</configuration> | ||||||
|  | 	<configuration id="com.atollic.managedbuild.pctools.config.gnu.exe.debug.119910908.1158593353" name="Server test"> | ||||||
|  | 		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider"> | ||||||
|  | 			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> | ||||||
|  | 			<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> | ||||||
|  | 			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> | ||||||
|  | 			<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="205429042390110507" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> | ||||||
|  | 				<language-scope id="org.eclipse.cdt.core.gcc"/> | ||||||
|  | 				<language-scope id="org.eclipse.cdt.core.g++"/> | ||||||
|  | 			</provider> | ||||||
|  | 		</extension> | ||||||
|  | 	</configuration> | ||||||
|  | </project> | ||||||
							
								
								
									
										1
									
								
								software/raspberry/superviseur-robot/example/lib
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								software/raspberry/superviseur-robot/example/lib
									
									
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | ../src/ | ||||||
|  | @ -0,0 +1,28 @@ | ||||||
|  | ################################################################################
 | ||||||
|  | # Automatically-generated file. Do not edit!
 | ||||||
|  | ################################################################################
 | ||||||
|  | 
 | ||||||
|  | # Add inputs and outputs from these tool invocations to the build variables 
 | ||||||
|  | CPP_SRCS += \
 | ||||||
|  | ../lib/Robot.cpp \ | ||||||
|  | ../lib/Serial.cpp \ | ||||||
|  | ../lib/TcpServer.cpp \ | ||||||
|  | ../lib/message.cpp  | ||||||
|  | 
 | ||||||
|  | OBJS += \
 | ||||||
|  | ./lib/Robot.o \ | ||||||
|  | ./lib/Serial.o \ | ||||||
|  | ./lib/TcpServer.o \ | ||||||
|  | ./lib/message.o  | ||||||
|  | 
 | ||||||
|  | CPP_DEPS += \
 | ||||||
|  | ./lib/Robot.d \ | ||||||
|  | ./lib/Serial.d \ | ||||||
|  | ./lib/TcpServer.d \ | ||||||
|  | ./lib/message.d  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Each subdirectory must supply rules for building sources it contributes
 | ||||||
|  | lib/%.o: ../lib/%.cpp | ||||||
|  | 	g++ -I"/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/example/lib" -I"/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/example/src" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,56 @@ | ||||||
|  | ################################################################################
 | ||||||
|  | # Automatically-generated file. Do not edit!
 | ||||||
|  | ################################################################################
 | ||||||
|  | 
 | ||||||
|  | -include ../makefile.init | ||||||
|  | 
 | ||||||
|  | RM := rm -rf | ||||||
|  | 
 | ||||||
|  | # All of the sources participating in the build are defined here
 | ||||||
|  | -include sources.mk | ||||||
|  | -include src/subdir.mk | ||||||
|  | -include lib/subdir.mk | ||||||
|  | -include subdir.mk | ||||||
|  | -include objects.mk | ||||||
|  | 
 | ||||||
|  | ifneq ($(MAKECMDGOALS),clean) | ||||||
|  | ifneq ($(strip $(CC_DEPS)),) | ||||||
|  | -include $(CC_DEPS) | ||||||
|  | endif | ||||||
|  | ifneq ($(strip $(C++_DEPS)),) | ||||||
|  | -include $(C++_DEPS) | ||||||
|  | endif | ||||||
|  | ifneq ($(strip $(C_UPPER_DEPS)),) | ||||||
|  | -include $(C_UPPER_DEPS) | ||||||
|  | endif | ||||||
|  | ifneq ($(strip $(CXX_DEPS)),) | ||||||
|  | -include $(CXX_DEPS) | ||||||
|  | endif | ||||||
|  | ifneq ($(strip $(CPP_DEPS)),) | ||||||
|  | -include $(CPP_DEPS) | ||||||
|  | endif | ||||||
|  | ifneq ($(strip $(C_DEPS)),) | ||||||
|  | -include $(C_DEPS) | ||||||
|  | endif | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | -include ../makefile.defs | ||||||
|  | 
 | ||||||
|  | # Add inputs and outputs from these tool invocations to the build variables 
 | ||||||
|  | 
 | ||||||
|  | # All Target
 | ||||||
|  | all: Dumber-Robot-Exemple | ||||||
|  | 
 | ||||||
|  | # Tool invocations
 | ||||||
|  | Dumber-Robot-Exemple: $(OBJS) $(USER_OBJS) | ||||||
|  | 	g++  -o "Dumber-Robot-Exemple" $(OBJS) $(USER_OBJS) $(LIBS) | ||||||
|  | 
 | ||||||
|  | # Other Targets
 | ||||||
|  | clean: | ||||||
|  | 	-$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) Dumber-Robot-Exemple | ||||||
|  | 	-@echo ' ' | ||||||
|  | 
 | ||||||
|  | .PHONY: all clean dependents | ||||||
|  | .SECONDARY: | ||||||
|  | 
 | ||||||
|  | -include ../makefile.targets | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  | ################################################################################
 | ||||||
|  | # Automatically-generated file. Do not edit!
 | ||||||
|  | ################################################################################
 | ||||||
|  | 
 | ||||||
|  | USER_OBJS := | ||||||
|  | 
 | ||||||
|  | LIBS := | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,28 @@ | ||||||
|  | ################################################################################
 | ||||||
|  | # Automatically-generated file. Do not edit!
 | ||||||
|  | ################################################################################
 | ||||||
|  | 
 | ||||||
|  | C_UPPER_SRCS :=  | ||||||
|  | CXX_SRCS :=  | ||||||
|  | C++_SRCS :=  | ||||||
|  | OBJ_SRCS :=  | ||||||
|  | CC_SRCS :=  | ||||||
|  | ASM_SRCS :=  | ||||||
|  | CPP_SRCS :=  | ||||||
|  | C_SRCS :=  | ||||||
|  | O_SRCS :=  | ||||||
|  | S_UPPER_SRCS :=  | ||||||
|  | CC_DEPS :=  | ||||||
|  | C++_DEPS :=  | ||||||
|  | EXECUTABLES :=  | ||||||
|  | C_UPPER_DEPS :=  | ||||||
|  | CXX_DEPS :=  | ||||||
|  | OBJS :=  | ||||||
|  | CPP_DEPS :=  | ||||||
|  | C_DEPS :=  | ||||||
|  | 
 | ||||||
|  | # Every subdirectory with source files must be described here
 | ||||||
|  | SUBDIRS := \
 | ||||||
|  | lib \ | ||||||
|  | src \ | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | ################################################################################
 | ||||||
|  | # Automatically-generated file. Do not edit!
 | ||||||
|  | ################################################################################
 | ||||||
|  | 
 | ||||||
|  | # Add inputs and outputs from these tool invocations to the build variables 
 | ||||||
|  | CPP_SRCS += \
 | ||||||
|  | ../src/serialTest.cpp \ | ||||||
|  | ../src/serverTest.cpp  | ||||||
|  | 
 | ||||||
|  | OBJS += \
 | ||||||
|  | ./src/serialTest.o \ | ||||||
|  | ./src/serverTest.o  | ||||||
|  | 
 | ||||||
|  | CPP_DEPS += \
 | ||||||
|  | ./src/serialTest.d \ | ||||||
|  | ./src/serverTest.d  | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # Each subdirectory must supply rules for building sources it contributes
 | ||||||
|  | src/%.o: ../src/%.cpp | ||||||
|  | 	g++ -I"/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/example/lib" -I"/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/example/src" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" | ||||||
|  | 
 | ||||||
							
								
								
									
										186
									
								
								software/raspberry/superviseur-robot/example/src/serialTest.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								software/raspberry/superviseur-robot/example/src/serialTest.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,186 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Part of code Copyright ST Microelectronics. | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include <ctime> | ||||||
|  | #include "Robot.h" | ||||||
|  | #include <unistd.h> | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | #define NB_TEST 50 | ||||||
|  | #define DELAY_BETWEEN_TEST 1000000 // 1 seconde
 | ||||||
|  | 
 | ||||||
|  | int nb_retries; | ||||||
|  | int nb_test; | ||||||
|  | 
 | ||||||
|  | int laststatus; | ||||||
|  | int nb_success; | ||||||
|  | int nb_timeout; | ||||||
|  | int nb_unknown_cmd; | ||||||
|  | 
 | ||||||
|  | int flipflop; | ||||||
|  | 
 | ||||||
|  | int Test(Robot rob) { | ||||||
|  |     try { | ||||||
|  |         if (flipflop == 0) { | ||||||
|  |             rob.Move(100); | ||||||
|  |         } else { | ||||||
|  |             rob.Move(-100); | ||||||
|  |         } | ||||||
|  |     } catch (string e) { | ||||||
|  |         //if (e.find("Timeout")==string.npos)
 | ||||||
|  |         //    status=ROBOT_TIMED_OUT;
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return rob.GetLastCommandStatus();; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int main() { | ||||||
|  |     Robot myRobot; | ||||||
|  | 
 | ||||||
|  |     if (myRobot.Open("/dev/ttyUSB0") == SUCCESS) { // ouverture de la com avec le robot
 | ||||||
|  | 
 | ||||||
|  |         std::cout << "Start robot: "; | ||||||
|  |         try { | ||||||
|  |             myRobot.StartWithoutWatchdog(); | ||||||
|  |         } catch ( string e ) { | ||||||
|  |             std::cerr << std::endl << e << std::endl; | ||||||
|  |             return 1; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (myRobot.GetLastCommandStatus()==SUCCESS) | ||||||
|  |             std::cout << "Ok" <<std::endl; | ||||||
|  |         else { | ||||||
|  |             std::cout << " Error: GetLastCommand returns " << myRobot.GetLastCommandStatus() <<std::endl; | ||||||
|  |             return 2; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         std::cout << "Start stress test" << std::endl; | ||||||
|  |         time_t t_debut, t_fin; | ||||||
|  |         struct tm *tm_debut, *tm_fin; | ||||||
|  | 
 | ||||||
|  |         time(&t_debut); | ||||||
|  |         tm_debut = localtime((const time_t*)&t_debut); | ||||||
|  |         std::cout << "[start time]: " << asctime(tm_debut) << std::endl; | ||||||
|  | 
 | ||||||
|  |         nb_success =0; | ||||||
|  |         nb_timeout =0; | ||||||
|  |         nb_unknown_cmd =0; | ||||||
|  |         flipflop = 0; | ||||||
|  | 
 | ||||||
|  |         for (nb_test=0; nb_test < NB_TEST; nb_test++) { | ||||||
|  |             laststatus=Test(myRobot); | ||||||
|  | 
 | ||||||
|  |             if (flipflop ==0) flipflop=1; | ||||||
|  |             else flipflop =0; | ||||||
|  | 
 | ||||||
|  |             if (laststatus == SUCCESS) nb_success++; | ||||||
|  |             else if (laststatus == TIMEOUT_COMMAND) nb_timeout++; | ||||||
|  |             else if ((laststatus == INVALID_ANSWER) || (laststatus == INVALID_COMMAND)) nb_unknown_cmd ++; | ||||||
|  | 
 | ||||||
|  |             std::cout << "Test " << nb_test << " [s " << nb_success | ||||||
|  |                     << ": t " << nb_timeout << ": u " << nb_unknown_cmd | ||||||
|  |                     << "]"<< "\x1B" <<"[30D"<<std::flush; | ||||||
|  | 
 | ||||||
|  |             usleep(DELAY_BETWEEN_TEST); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         time(&t_fin); | ||||||
|  |         tm_fin = localtime((const time_t*)&t_fin); | ||||||
|  |         std::cout << std::endl << std::endl << "[end time]: " << asctime(tm_fin) << std::endl; | ||||||
|  | 
 | ||||||
|  |         std::cout << "Reset robot" <<std::endl; | ||||||
|  |         myRobot.Reset(); | ||||||
|  | 
 | ||||||
|  |         std::cout << "Close com" <<std::endl; | ||||||
|  |         myRobot.Close(); | ||||||
|  | 
 | ||||||
|  |     } else { | ||||||
|  |         std::cerr << "Unable to open \\dev\\ttyUSB0" << std::endl; | ||||||
|  | 
 | ||||||
|  |         return 2; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     //    if (open_communication_robot("/dev/ttyUSB0") != 0) {
 | ||||||
|  |     //        std::cout << "Unable to open com port" << std::endl;
 | ||||||
|  |     //
 | ||||||
|  |     //        return -1;
 | ||||||
|  |     //    }
 | ||||||
|  |     //
 | ||||||
|  |     //    std::cout << "Debut du test de stress" << std::endl;
 | ||||||
|  |     //    time_t t_debut, t_fin;
 | ||||||
|  |     //    struct tm *tm_debut, *tm_fin;
 | ||||||
|  |     //
 | ||||||
|  |     //    time(&t_debut);
 | ||||||
|  |     //    tm_debut = localtime((const time_t*)&t_debut);
 | ||||||
|  |     //
 | ||||||
|  |     //    std::cout << "[heure debut]: " << asctime(tm_debut) << std::endl;
 | ||||||
|  |     //
 | ||||||
|  |     //    nb_retries=-1;
 | ||||||
|  |     //    do {
 | ||||||
|  |     //        usleep(DELAY_BETWEEN_RETRIES);
 | ||||||
|  |     //        nb_retries++;
 | ||||||
|  |     //        laststatus = send_command_to_robot(DMB_START_WITHOUT_WD);
 | ||||||
|  |     //    } while ((nb_retries<NB_RETRIES_MAX) && (laststatus != 0));
 | ||||||
|  |     //
 | ||||||
|  |     //    if(nb_retries == NB_RETRIES_MAX) {
 | ||||||
|  |     //        std::cout << "Unable to start robot" <<std::endl;
 | ||||||
|  |     //
 | ||||||
|  |     //        return -1;
 | ||||||
|  |     //    }
 | ||||||
|  |     //
 | ||||||
|  |     //    nb_success =0;
 | ||||||
|  |     //    nb_timeout =0;
 | ||||||
|  |     //    nb_unknown_cmd =0;
 | ||||||
|  |     //    flipflop = 0;
 | ||||||
|  |     //
 | ||||||
|  |     //    for (nb_test=0; nb_test < NB_TEST; nb_test++) {
 | ||||||
|  |     //        nb_retries=-1;
 | ||||||
|  |     //
 | ||||||
|  |     //        do {
 | ||||||
|  |     //            usleep(DELAY_BETWEEN_RETRIES);
 | ||||||
|  |     //            nb_retries++;
 | ||||||
|  |     //            if (flipflop == 0) {
 | ||||||
|  |     //                laststatus = send_command_to_robot(DMB_TURN, "100");
 | ||||||
|  |     //            } else {
 | ||||||
|  |     //                laststatus = send_command_to_robot(DMB_TURN, "-100");
 | ||||||
|  |     //            }
 | ||||||
|  |     //
 | ||||||
|  |     //        } while ((nb_retries<NB_RETRIES_MAX) && (laststatus != 0));
 | ||||||
|  |     //
 | ||||||
|  |     //        if (flipflop ==0) flipflop=1;
 | ||||||
|  |     //        else flipflop =0;
 | ||||||
|  |     //
 | ||||||
|  |     //        if (laststatus == 0) nb_success++;
 | ||||||
|  |     //        else if (laststatus == ROBOT_TIMED_OUT) nb_timeout++;
 | ||||||
|  |     //        else if (laststatus == ROBOT_UKNOWN_CMD) nb_unknown_cmd ++;
 | ||||||
|  |     //
 | ||||||
|  |     //        std::cout << "Test " << nb_test << " [s " << nb_success
 | ||||||
|  |     //                  << ": t " << nb_timeout << ": u " << nb_unknown_cmd
 | ||||||
|  |     //                  << "]"<< "\x1B" <<"[30D"<<std::flush;
 | ||||||
|  |     //
 | ||||||
|  |     //        usleep(DELAY_BETWEEN_TEST);
 | ||||||
|  |     //    }
 | ||||||
|  |     //
 | ||||||
|  |     //    time(&t_fin);
 | ||||||
|  |     //    tm_fin = localtime((const time_t*)&t_fin);
 | ||||||
|  |     //
 | ||||||
|  |     //    std::cout << std::endl << std::endl << "[heure fin]: " << asctime(tm_fin) << std::endl;
 | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
							
								
								
									
										111
									
								
								software/raspberry/superviseur-robot/example/src/serverTest.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								software/raspberry/superviseur-robot/example/src/serverTest.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,111 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Part of code Copyright ST Microelectronics. | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include "Robot.h" | ||||||
|  | #include "TcpServer.h" | ||||||
|  | 
 | ||||||
|  | int main (void) | ||||||
|  | { | ||||||
|  |     TcpServer server; | ||||||
|  |     int clientFD; | ||||||
|  |     string msgIn, msgOut,tmp; | ||||||
|  |     bool finish; | ||||||
|  | 
 | ||||||
|  |     Robot robot; | ||||||
|  | 
 | ||||||
|  |     cout << "TCP server example" << endl; | ||||||
|  | 
 | ||||||
|  |     cout << "Bind and listen on port 1337: "; | ||||||
|  |     try { | ||||||
|  |         server.Listen(1337); | ||||||
|  |     } | ||||||
|  |     catch ( const invalid_argument &ia ) { | ||||||
|  |         cerr << "Error binding server: " << ia.what() << endl; | ||||||
|  |         return 1; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     cout << "Ok" <<endl; | ||||||
|  | 
 | ||||||
|  |     cout << "Open com with robot: "; | ||||||
|  |     try { | ||||||
|  |         robot.Open ("/dev/ttyUSB0"); | ||||||
|  |     } catch (string e) | ||||||
|  |     { | ||||||
|  |         cerr << e << endl; | ||||||
|  |         return 3; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     cout << "Ok" <<endl; | ||||||
|  | 
 | ||||||
|  |     while (1) | ||||||
|  |     { | ||||||
|  |         cout << "Wait for client to connect: "; | ||||||
|  |         try { | ||||||
|  |             clientFD= server.AcceptClient(); | ||||||
|  |         } | ||||||
|  |         catch ( const invalid_argument &ia ) { | ||||||
|  |             cerr << "Error during client accept: " << ia.what() << endl; | ||||||
|  |             return 2; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         cout << to_string(clientFD) << endl; | ||||||
|  | 
 | ||||||
|  |         msgIn.clear(); | ||||||
|  |         finish=false; | ||||||
|  | 
 | ||||||
|  |         do { | ||||||
|  |             msgIn = server.Receive(clientFD, 2); // cmd + \n
 | ||||||
|  | 
 | ||||||
|  |             if (msgIn.empty()) finish=true; | ||||||
|  |             else { | ||||||
|  |                 try { | ||||||
|  |                     switch (msgIn[0]) { | ||||||
|  |                         case 's': | ||||||
|  |                             // Start robot
 | ||||||
|  |                             robot.StartWithoutWatchdog(); | ||||||
|  |                             break; | ||||||
|  |                         case 'f': | ||||||
|  |                             robot.Move(100); | ||||||
|  |                             break; | ||||||
|  |                         case 'b': | ||||||
|  |                             robot.Move(-100); | ||||||
|  |                             break; | ||||||
|  |                         case 'r': | ||||||
|  |                             robot.Turn(90); | ||||||
|  |                             break; | ||||||
|  |                         case 'l': | ||||||
|  |                             robot.Turn(-90); | ||||||
|  |                             break; | ||||||
|  |                         case 'Q': | ||||||
|  |                             robot.Reset(); | ||||||
|  |                             break; | ||||||
|  |                     } | ||||||
|  |                 } catch (string e) { | ||||||
|  |                     cerr << e; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 if (robot.GetLastCommandStatus() == SUCCESS) | ||||||
|  |                     server.Send(clientFD, "OK\n"); | ||||||
|  |                 else server.Send(clientFD, "ERR\n"); | ||||||
|  |             } | ||||||
|  |         } while (finish==false); | ||||||
|  | 
 | ||||||
|  |         cout << "Client disconnected" <<endl; | ||||||
|  |         clientFD=-1; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | @ -1,8 +0,0 @@ | ||||||
| *.o |  | ||||||
| *.d |  | ||||||
| CMakeTmp |  | ||||||
| stress.dir |  | ||||||
| 3.9.6 |  | ||||||
| *.log |  | ||||||
| *.bin |  | ||||||
| 
 |  | ||||||
|  | @ -1,29 +0,0 @@ | ||||||
| <component name="ProjectCodeStyleConfiguration"> |  | ||||||
|   <code_scheme name="Project" version="173"> |  | ||||||
|     <Objective-C-extensions> |  | ||||||
|       <file> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> |  | ||||||
|       </file> |  | ||||||
|       <class> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> |  | ||||||
|         <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> |  | ||||||
|       </class> |  | ||||||
|       <extensions> |  | ||||||
|         <pair source="cpp" header="h" fileNamingConvention="NONE" /> |  | ||||||
|         <pair source="c" header="h" fileNamingConvention="NONE" /> |  | ||||||
|       </extensions> |  | ||||||
|     </Objective-C-extensions> |  | ||||||
|   </code_scheme> |  | ||||||
| </component> |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" /> |  | ||||||
| </project> |  | ||||||
|  | @ -1,8 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="ProjectModuleManager"> |  | ||||||
|     <modules> |  | ||||||
|       <module fileurl="file://$PROJECT_DIR$/.idea/stress.iml" filepath="$PROJECT_DIR$/.idea/stress.iml" /> |  | ||||||
|     </modules> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <module classpath="CMake" type="CPP_MODULE" version="4" /> |  | ||||||
|  | @ -1,6 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="VcsDirectoryMappings"> |  | ||||||
|     <mapping directory="$PROJECT_DIR$/../.." vcs="Git" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
|  | @ -1,294 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true"> |  | ||||||
|     <generated> |  | ||||||
|       <config projectName="stress" targetName="stress" /> |  | ||||||
|     </generated> |  | ||||||
|   </component> |  | ||||||
|   <component name="CMakeSettings"> |  | ||||||
|     <configurations> |  | ||||||
|       <configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" /> |  | ||||||
|     </configurations> |  | ||||||
|   </component> |  | ||||||
|   <component name="ChangeListManager"> |  | ||||||
|     <list default="true" id="6f68a0e1-52e9-471a-8d47-af63db94b711" name="Default" comment=""> |  | ||||||
|       <change beforePath="" afterPath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" /> |  | ||||||
|       <change beforePath="" afterPath="$PROJECT_DIR$/.idea/misc.xml" /> |  | ||||||
|       <change beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" /> |  | ||||||
|     </list> |  | ||||||
|     <ignored path="$PROJECT_DIR$/cmake-build-debug/" /> |  | ||||||
|     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |  | ||||||
|     <option name="TRACKING_ENABLED" value="true" /> |  | ||||||
|     <option name="SHOW_DIALOG" value="false" /> |  | ||||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> |  | ||||||
|     <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |  | ||||||
|     <option name="LAST_RESOLUTION" value="IGNORE" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" /> |  | ||||||
|   <component name="FileEditorManager"> |  | ||||||
|     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> |  | ||||||
|       <file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="false"> |  | ||||||
|         <entry file="file://$PROJECT_DIR$/CMakeLists.txt"> |  | ||||||
|           <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|             <state relative-caret-position="108"> |  | ||||||
|               <caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" /> |  | ||||||
|               <folding /> |  | ||||||
|             </state> |  | ||||||
|           </provider> |  | ||||||
|         </entry> |  | ||||||
|       </file> |  | ||||||
|       <file leaf-file-name="main.cpp" pinned="false" current-in-tab="false"> |  | ||||||
|         <entry file="file://$PROJECT_DIR$/main.cpp"> |  | ||||||
|           <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|             <state relative-caret-position="144"> |  | ||||||
|               <caret line="8" column="28" lean-forward="false" selection-start-line="8" selection-start-column="28" selection-end-line="8" selection-end-column="28" /> |  | ||||||
|               <folding> |  | ||||||
|                 <element signature="e#0#19#0" expanded="true" /> |  | ||||||
|               </folding> |  | ||||||
|             </state> |  | ||||||
|           </provider> |  | ||||||
|         </entry> |  | ||||||
|       </file> |  | ||||||
|       <file leaf-file-name="robot.h" pinned="false" current-in-tab="false"> |  | ||||||
|         <entry file="file://$PROJECT_DIR$/../../src/robot.h"> |  | ||||||
|           <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|             <state relative-caret-position="-378"> |  | ||||||
|               <caret line="18" column="19" lean-forward="true" selection-start-line="18" selection-start-column="19" selection-end-line="18" selection-end-column="19" /> |  | ||||||
|               <folding /> |  | ||||||
|             </state> |  | ||||||
|           </provider> |  | ||||||
|         </entry> |  | ||||||
|       </file> |  | ||||||
|       <file leaf-file-name="robot.cpp" pinned="false" current-in-tab="true"> |  | ||||||
|         <entry file="file://$PROJECT_DIR$/../../src/robot.cpp"> |  | ||||||
|           <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|             <state relative-caret-position="-1890"> |  | ||||||
|               <caret line="6" column="9" lean-forward="true" selection-start-line="6" selection-start-column="9" selection-end-line="6" selection-end-column="9" /> |  | ||||||
|               <folding /> |  | ||||||
|             </state> |  | ||||||
|           </provider> |  | ||||||
|         </entry> |  | ||||||
|       </file> |  | ||||||
|       <file leaf-file-name="definitions.h" pinned="false" current-in-tab="false"> |  | ||||||
|         <entry file="file://$PROJECT_DIR$/../../src/definitions.h"> |  | ||||||
|           <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|             <state relative-caret-position="252"> |  | ||||||
|               <caret line="35" column="24" lean-forward="false" selection-start-line="35" selection-start-column="8" selection-end-line="35" selection-end-column="24" /> |  | ||||||
|               <folding /> |  | ||||||
|             </state> |  | ||||||
|           </provider> |  | ||||||
|         </entry> |  | ||||||
|       </file> |  | ||||||
|     </leaf> |  | ||||||
|   </component> |  | ||||||
|   <component name="Git.Settings"> |  | ||||||
|     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." /> |  | ||||||
|   </component> |  | ||||||
|   <component name="IdeDocumentHistory"> |  | ||||||
|     <option name="CHANGED_PATHS"> |  | ||||||
|       <list> |  | ||||||
|         <option value="$PROJECT_DIR$/CMakeLists.txt" /> |  | ||||||
|         <option value="$PROJECT_DIR$/main.cpp" /> |  | ||||||
|       </list> |  | ||||||
|     </option> |  | ||||||
|   </component> |  | ||||||
|   <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" /> |  | ||||||
|   <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" /> |  | ||||||
|   <component name="JsGulpfileManager"> |  | ||||||
|     <detection-done>true</detection-done> |  | ||||||
|     <sorting>DEFINITION_ORDER</sorting> |  | ||||||
|   </component> |  | ||||||
|   <component name="ProjectFrameBounds"> |  | ||||||
|     <option name="x" value="331" /> |  | ||||||
|     <option name="y" value="64" /> |  | ||||||
|     <option name="width" value="1400" /> |  | ||||||
|     <option name="height" value="873" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="ProjectLevelVcsManager" settingsEditedManually="true" /> |  | ||||||
|   <component name="ProjectView"> |  | ||||||
|     <navigator currentView="ProjectPane" proportions="" version="1"> |  | ||||||
|       <flattenPackages /> |  | ||||||
|       <showMembers /> |  | ||||||
|       <showModules /> |  | ||||||
|       <showLibraryContents /> |  | ||||||
|       <hideEmptyPackages /> |  | ||||||
|       <abbreviatePackageNames /> |  | ||||||
|       <autoscrollToSource /> |  | ||||||
|       <autoscrollFromSource /> |  | ||||||
|       <sortByType /> |  | ||||||
|       <manualOrder /> |  | ||||||
|       <foldersAlwaysOnTop value="true" /> |  | ||||||
|     </navigator> |  | ||||||
|     <panes> |  | ||||||
|       <pane id="ProjectPane"> |  | ||||||
|         <subPane> |  | ||||||
|           <expand> |  | ||||||
|             <path> |  | ||||||
|               <item name="stress" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" /> |  | ||||||
|               <item name="stress" type="47feb1d3:ProjectViewModuleNode" /> |  | ||||||
|             </path> |  | ||||||
|             <path> |  | ||||||
|               <item name="stress" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" /> |  | ||||||
|               <item name="stress" type="47feb1d3:ProjectViewModuleNode" /> |  | ||||||
|               <item name="stress" type="462c0819:PsiDirectoryNode" /> |  | ||||||
|             </path> |  | ||||||
|             <path> |  | ||||||
|               <item name="stress" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" /> |  | ||||||
|               <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> |  | ||||||
|             </path> |  | ||||||
|             <path> |  | ||||||
|               <item name="stress" type="dad4c3:CidrFilesViewHelper$MyProjectTreeStructure$1" /> |  | ||||||
|               <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> |  | ||||||
|               <item name="Header Search Paths" type="70bed36:NamedLibraryElementNode" /> |  | ||||||
|             </path> |  | ||||||
|           </expand> |  | ||||||
|           <select /> |  | ||||||
|         </subPane> |  | ||||||
|       </pane> |  | ||||||
|     </panes> |  | ||||||
|   </component> |  | ||||||
|   <component name="PropertiesComponent"> |  | ||||||
|     <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" /> |  | ||||||
|     <property name="WebServerToolWindowFactoryState" value="false" /> |  | ||||||
|     <property name="settings.editor.selected.configurable" value="preferences.lookFeel" /> |  | ||||||
|     <property name="last_opened_file_path" value="$PROJECT_DIR$/../../src/definitions.h" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="RunDashboard"> |  | ||||||
|     <option name="ruleStates"> |  | ||||||
|       <list> |  | ||||||
|         <RuleState> |  | ||||||
|           <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> |  | ||||||
|         </RuleState> |  | ||||||
|         <RuleState> |  | ||||||
|           <option name="name" value="StatusDashboardGroupingRule" /> |  | ||||||
|         </RuleState> |  | ||||||
|       </list> |  | ||||||
|     </option> |  | ||||||
|   </component> |  | ||||||
|   <component name="RunManager" selected="Application.stress"> |  | ||||||
|     <configuration name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="stress" RUN_TARGET_NAME="stress" EXPLICIT_BUILD_TARGET_NAME="all"> |  | ||||||
|       <envs /> |  | ||||||
|     </configuration> |  | ||||||
|     <configuration name="stress" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="stress" TARGET_NAME="stress" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="stress" RUN_TARGET_NAME="stress"> |  | ||||||
|       <envs /> |  | ||||||
|     </configuration> |  | ||||||
|     <list size="2"> |  | ||||||
|       <item index="0" class="java.lang.String" itemvalue="Application.Build All" /> |  | ||||||
|       <item index="1" class="java.lang.String" itemvalue="Application.stress" /> |  | ||||||
|     </list> |  | ||||||
|   </component> |  | ||||||
|   <component name="ShelveChangesManager" show_recycled="false"> |  | ||||||
|     <option name="remove_strategy" value="false" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="TaskManager"> |  | ||||||
|     <task active="true" id="Default" summary="Default task"> |  | ||||||
|       <changelist id="6f68a0e1-52e9-471a-8d47-af63db94b711" name="Default" comment="" /> |  | ||||||
|       <created>1518169204762</created> |  | ||||||
|       <option name="number" value="Default" /> |  | ||||||
|       <option name="presentableId" value="Default" /> |  | ||||||
|       <updated>1518169204762</updated> |  | ||||||
|       <workItem from="1518169206682" duration="106000" /> |  | ||||||
|       <workItem from="1518169334602" duration="6358000" /> |  | ||||||
|     </task> |  | ||||||
|     <servers /> |  | ||||||
|   </component> |  | ||||||
|   <component name="TimeTrackingManager"> |  | ||||||
|     <option name="totallyTimeSpent" value="6464000" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="ToolWindowManager"> |  | ||||||
|     <frame x="331" y="64" width="1400" height="873" extended-state="0" /> |  | ||||||
|     <editor active="true" /> |  | ||||||
|     <layout> |  | ||||||
|       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18785714" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> |  | ||||||
|       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Messages" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18037136" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.47612733" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> |  | ||||||
|       <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> |  | ||||||
|       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> |  | ||||||
|       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> |  | ||||||
|       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> |  | ||||||
|     </layout> |  | ||||||
|   </component> |  | ||||||
|   <component name="TypeScriptGeneratedFilesManager"> |  | ||||||
|     <option name="version" value="1" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="VcsContentAnnotationSettings"> |  | ||||||
|     <option name="myLimit" value="2678400000" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="XDebuggerManager"> |  | ||||||
|     <breakpoint-manager /> |  | ||||||
|     <watches-manager /> |  | ||||||
|   </component> |  | ||||||
|   <component name="editorHistoryManager"> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/CMakeLists.txt"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="0"> |  | ||||||
|           <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> |  | ||||||
|           <folding /> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/main.cpp"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="0"> |  | ||||||
|           <caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> |  | ||||||
|           <folding> |  | ||||||
|             <element signature="e#0#19#0" expanded="true" /> |  | ||||||
|           </folding> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/CMakeLists.txt"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="108"> |  | ||||||
|           <caret line="6" column="16" lean-forward="false" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" /> |  | ||||||
|           <folding /> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/../../src/definitions.h"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="252"> |  | ||||||
|           <caret line="35" column="24" lean-forward="false" selection-start-line="35" selection-start-column="8" selection-end-line="35" selection-end-column="24" /> |  | ||||||
|           <folding /> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/main.cpp"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="144"> |  | ||||||
|           <caret line="8" column="28" lean-forward="false" selection-start-line="8" selection-start-column="28" selection-end-line="8" selection-end-column="28" /> |  | ||||||
|           <folding> |  | ||||||
|             <element signature="e#0#19#0" expanded="true" /> |  | ||||||
|           </folding> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/../../src/robot.h"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="-378"> |  | ||||||
|           <caret line="18" column="19" lean-forward="true" selection-start-line="18" selection-start-column="19" selection-end-line="18" selection-end-column="19" /> |  | ||||||
|           <folding /> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|     <entry file="file://$PROJECT_DIR$/../../src/robot.cpp"> |  | ||||||
|       <provider selected="true" editor-type-id="text-editor"> |  | ||||||
|         <state relative-caret-position="-1890"> |  | ||||||
|           <caret line="6" column="9" lean-forward="true" selection-start-line="6" selection-start-column="9" selection-end-line="6" selection-end-column="9" /> |  | ||||||
|           <folding /> |  | ||||||
|         </state> |  | ||||||
|       </provider> |  | ||||||
|     </entry> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							|  | @ -1,16 +0,0 @@ | ||||||
| # CMAKE generated file: DO NOT EDIT! |  | ||||||
| # Generated by "Unix Makefiles" Generator, CMake Version 3.9 |  | ||||||
| 
 |  | ||||||
| # Relative path conversion top directories. |  | ||||||
| set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/dimercur/Travail/git/C-TP-RT/example/stress") |  | ||||||
| set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug") |  | ||||||
| 
 |  | ||||||
| # Force unix paths in dependencies. |  | ||||||
| set(CMAKE_FORCE_UNIX_PATHS 1) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # The C and CXX include file regular expressions for this directory. |  | ||||||
| set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") |  | ||||||
| set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") |  | ||||||
| set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) |  | ||||||
| set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) |  | ||||||
|  | @ -1,49 +0,0 @@ | ||||||
| # CMAKE generated file: DO NOT EDIT! |  | ||||||
| # Generated by "Unix Makefiles" Generator, CMake Version 3.9 |  | ||||||
| 
 |  | ||||||
| # The generator used is: |  | ||||||
| set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") |  | ||||||
| 
 |  | ||||||
| # The top level Makefile was generated from the following files: |  | ||||||
| set(CMAKE_MAKEFILE_DEPENDS |  | ||||||
|   "CMakeCache.txt" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeCInformation.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeCXXInformation.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeCommonLanguageInclude.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeExtraGeneratorDetermineCompilerMacrosAndIncludeDirs.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeFindCodeBlocks.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeGenericSystem.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeLanguageInformation.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeSystemSpecificInformation.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/CMakeSystemSpecificInitialize.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Compiler/CMakeCommonCompilerMacros.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Compiler/GNU-C.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Compiler/GNU-CXX.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Compiler/GNU.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Platform/Linux-GNU-C.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Platform/Linux-GNU-CXX.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Platform/Linux-GNU.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Platform/Linux.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/Platform/UnixPaths.cmake" |  | ||||||
|   "/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/share/cmake-3.9/Modules/ProcessorCount.cmake" |  | ||||||
|   "../CMakeLists.txt" |  | ||||||
|   "CMakeFiles/3.9.6/CMakeCCompiler.cmake" |  | ||||||
|   "CMakeFiles/3.9.6/CMakeCXXCompiler.cmake" |  | ||||||
|   "CMakeFiles/3.9.6/CMakeSystem.cmake" |  | ||||||
|   ) |  | ||||||
| 
 |  | ||||||
| # The corresponding makefile is: |  | ||||||
| set(CMAKE_MAKEFILE_OUTPUTS |  | ||||||
|   "Makefile" |  | ||||||
|   "CMakeFiles/cmake.check_cache" |  | ||||||
|   ) |  | ||||||
| 
 |  | ||||||
| # Byproducts of CMake generate step: |  | ||||||
| set(CMAKE_MAKEFILE_PRODUCTS |  | ||||||
|   "CMakeFiles/CMakeDirectoryInformation.cmake" |  | ||||||
|   ) |  | ||||||
| 
 |  | ||||||
| # Dependency information for all targets: |  | ||||||
| set(CMAKE_DEPEND_INFO_FILES |  | ||||||
|   "CMakeFiles/stress.dir/DependInfo.cmake" |  | ||||||
|   ) |  | ||||||
|  | @ -1,108 +0,0 @@ | ||||||
| # CMAKE generated file: DO NOT EDIT! |  | ||||||
| # Generated by "Unix Makefiles" Generator, CMake Version 3.9 |  | ||||||
| 
 |  | ||||||
| # Default target executed when no arguments are given to make. |  | ||||||
| default_target: all |  | ||||||
| 
 |  | ||||||
| .PHONY : default_target |  | ||||||
| 
 |  | ||||||
| # The main recursive all target |  | ||||||
| all: |  | ||||||
| 
 |  | ||||||
| .PHONY : all |  | ||||||
| 
 |  | ||||||
| # The main recursive preinstall target |  | ||||||
| preinstall: |  | ||||||
| 
 |  | ||||||
| .PHONY : preinstall |  | ||||||
| 
 |  | ||||||
| #============================================================================= |  | ||||||
| # Special targets provided by cmake. |  | ||||||
| 
 |  | ||||||
| # Disable implicit rules so canonical targets will work. |  | ||||||
| .SUFFIXES: |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # Remove some rules from gmake that .SUFFIXES does not remove. |  | ||||||
| SUFFIXES = |  | ||||||
| 
 |  | ||||||
| .SUFFIXES: .hpux_make_needs_suffix_list |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # Suppress display of executed commands. |  | ||||||
| $(VERBOSE).SILENT: |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # A target that is always out of date. |  | ||||||
| cmake_force: |  | ||||||
| 
 |  | ||||||
| .PHONY : cmake_force |  | ||||||
| 
 |  | ||||||
| #============================================================================= |  | ||||||
| # Set environment variables for the build. |  | ||||||
| 
 |  | ||||||
| # The shell in which to execute make rules. |  | ||||||
| SHELL = /bin/sh |  | ||||||
| 
 |  | ||||||
| # The CMake executable. |  | ||||||
| CMAKE_COMMAND = /home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake |  | ||||||
| 
 |  | ||||||
| # The command to remove a file. |  | ||||||
| RM = /home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake -E remove -f |  | ||||||
| 
 |  | ||||||
| # Escaping for special characters. |  | ||||||
| EQUALS = = |  | ||||||
| 
 |  | ||||||
| # The top-level source directory on which CMake was run. |  | ||||||
| CMAKE_SOURCE_DIR = /home/dimercur/Travail/git/C-TP-RT/example/stress |  | ||||||
| 
 |  | ||||||
| # The top-level build directory on which CMake was run. |  | ||||||
| CMAKE_BINARY_DIR = /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug |  | ||||||
| 
 |  | ||||||
| #============================================================================= |  | ||||||
| # Target rules for target CMakeFiles/stress.dir |  | ||||||
| 
 |  | ||||||
| # All Build rule for target. |  | ||||||
| CMakeFiles/stress.dir/all: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/depend |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/build |  | ||||||
| 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles --progress-num=1,2,3 "Built target stress" |  | ||||||
| .PHONY : CMakeFiles/stress.dir/all |  | ||||||
| 
 |  | ||||||
| # Include target in all. |  | ||||||
| all: CMakeFiles/stress.dir/all |  | ||||||
| 
 |  | ||||||
| .PHONY : all |  | ||||||
| 
 |  | ||||||
| # Build rule for subdir invocation for target. |  | ||||||
| CMakeFiles/stress.dir/rule: cmake_check_build_system |  | ||||||
| 	$(CMAKE_COMMAND) -E cmake_progress_start /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles 3 |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/stress.dir/all |  | ||||||
| 	$(CMAKE_COMMAND) -E cmake_progress_start /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles 0 |  | ||||||
| .PHONY : CMakeFiles/stress.dir/rule |  | ||||||
| 
 |  | ||||||
| # Convenience name for target. |  | ||||||
| stress: CMakeFiles/stress.dir/rule |  | ||||||
| 
 |  | ||||||
| .PHONY : stress |  | ||||||
| 
 |  | ||||||
| # clean rule for target. |  | ||||||
| CMakeFiles/stress.dir/clean: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/clean |  | ||||||
| .PHONY : CMakeFiles/stress.dir/clean |  | ||||||
| 
 |  | ||||||
| # clean rule for target. |  | ||||||
| clean: CMakeFiles/stress.dir/clean |  | ||||||
| 
 |  | ||||||
| .PHONY : clean |  | ||||||
| 
 |  | ||||||
| #============================================================================= |  | ||||||
| # Special targets to cleanup operation of make. |  | ||||||
| 
 |  | ||||||
| # Special rule to run CMake to check the build system integrity. |  | ||||||
| # No rule that depends on this can have commands that come from listfiles |  | ||||||
| # because they might be regenerated. |  | ||||||
| cmake_check_build_system: |  | ||||||
| 	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 |  | ||||||
| .PHONY : cmake_check_build_system |  | ||||||
| 
 |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles/rebuild_cache.dir |  | ||||||
| /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles/edit_cache.dir |  | ||||||
| /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles/stress.dir |  | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| Options:  |  | ||||||
| 
 |  | ||||||
| Options: |  | ||||||
|  | @ -1,4 +0,0 @@ | ||||||
| /home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /home/dimercur/Travail/git/C-TP-RT/example/stress |  | ||||||
| -- Configuring done |  | ||||||
| -- Generating done |  | ||||||
| -- Build files have been written to: /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| # This file is generated by cmake for dependency checking of the CMakeCache.txt file |  | ||||||
|  | @ -1,34 +0,0 @@ | ||||||
| 
 |  | ||||||
|   const char features[] = {"\n" |  | ||||||
| "C_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "c_function_prototypes\n" |  | ||||||
| "C_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "c_restrict\n" |  | ||||||
| "C_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "c_static_assert\n" |  | ||||||
| "C_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "c_variadic_macros\n" |  | ||||||
| 
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| int main(int argc, char** argv) { (void)argv; return features[argc]; } |  | ||||||
|  | @ -1,405 +0,0 @@ | ||||||
| 
 |  | ||||||
|   const char features[] = {"\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_aggregate_default_initializers\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_alias_templates\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_alignas\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_alignof\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_attributes\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_attribute_deprecated\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_auto_type\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_binary_literals\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_constexpr\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_contextual_conversions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_decltype\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_decltype_auto\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_decltype_incomplete_return_types\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_default_function_template_args\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_defaulted_functions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_defaulted_move_initializers\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_delegating_constructors\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_deleted_functions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_digit_separators\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_enum_forward_declarations\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_explicit_conversions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_extended_friend_declarations\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_extern_templates\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_final\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_func_identifier\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_generalized_initializers\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_generic_lambdas\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_inheriting_constructors\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_inline_namespaces\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_lambdas\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_lambda_init_captures\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_local_type_template_args\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_long_long_type\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_noexcept\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_nonstatic_member_init\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_nullptr\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_override\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_range_for\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_raw_string_literals\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40801) && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_reference_qualified_functions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_relaxed_constexpr\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409 && __cplusplus > 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_return_type_deduction\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_right_angle_brackets\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_rvalue_references\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_sizeof_member\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_static_assert\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_strong_enums\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && __cplusplus |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_template_template_parameters\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_thread_local\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_trailing_return_types\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_unicode_literals\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_uniform_initialization\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_unrestricted_unions\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_user_literals\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 500 && __cplusplus >= 201402L |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_variable_templates\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_variadic_macros\n" |  | ||||||
| "CXX_FEATURE:" |  | ||||||
| #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__)) |  | ||||||
| "1" |  | ||||||
| #else |  | ||||||
| "0" |  | ||||||
| #endif |  | ||||||
| "cxx_variadic_templates\n" |  | ||||||
| 
 |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| int main(int argc, char** argv) { (void)argv; return features[argc]; } |  | ||||||
|  | @ -1 +0,0 @@ | ||||||
| 3 |  | ||||||
|  | @ -1,208 +0,0 @@ | ||||||
| # CMAKE generated file: DO NOT EDIT!
 |  | ||||||
| # Generated by "Unix Makefiles" Generator, CMake Version 3.9
 |  | ||||||
| 
 |  | ||||||
| # Default target executed when no arguments are given to make.
 |  | ||||||
| default_target: all |  | ||||||
| 
 |  | ||||||
| .PHONY : default_target |  | ||||||
| 
 |  | ||||||
| # Allow only one "make -f Makefile2" at a time, but pass parallelism.
 |  | ||||||
| .NOTPARALLEL: |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| #=============================================================================
 |  | ||||||
| # Special targets provided by cmake.
 |  | ||||||
| 
 |  | ||||||
| # Disable implicit rules so canonical targets will work.
 |  | ||||||
| .SUFFIXES: |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # Remove some rules from gmake that .SUFFIXES does not remove.
 |  | ||||||
| SUFFIXES = |  | ||||||
| 
 |  | ||||||
| .SUFFIXES: .hpux_make_needs_suffix_list |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # Suppress display of executed commands.
 |  | ||||||
| $(VERBOSE).SILENT: |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| # A target that is always out of date.
 |  | ||||||
| cmake_force: |  | ||||||
| 
 |  | ||||||
| .PHONY : cmake_force |  | ||||||
| 
 |  | ||||||
| #=============================================================================
 |  | ||||||
| # Set environment variables for the build.
 |  | ||||||
| 
 |  | ||||||
| # The shell in which to execute make rules.
 |  | ||||||
| SHELL = /bin/sh |  | ||||||
| 
 |  | ||||||
| # The CMake executable.
 |  | ||||||
| CMAKE_COMMAND = /home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake |  | ||||||
| 
 |  | ||||||
| # The command to remove a file.
 |  | ||||||
| RM = /home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake -E remove -f |  | ||||||
| 
 |  | ||||||
| # Escaping for special characters.
 |  | ||||||
| EQUALS = = |  | ||||||
| 
 |  | ||||||
| # The top-level source directory on which CMake was run.
 |  | ||||||
| CMAKE_SOURCE_DIR = /home/dimercur/Travail/git/C-TP-RT/example/stress |  | ||||||
| 
 |  | ||||||
| # The top-level build directory on which CMake was run.
 |  | ||||||
| CMAKE_BINARY_DIR = /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug |  | ||||||
| 
 |  | ||||||
| #=============================================================================
 |  | ||||||
| # Targets provided globally by CMake.
 |  | ||||||
| 
 |  | ||||||
| # Special rule for the target rebuild_cache
 |  | ||||||
| rebuild_cache: |  | ||||||
| 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." |  | ||||||
| 	/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) |  | ||||||
| .PHONY : rebuild_cache |  | ||||||
| 
 |  | ||||||
| # Special rule for the target rebuild_cache
 |  | ||||||
| rebuild_cache/fast: rebuild_cache |  | ||||||
| 
 |  | ||||||
| .PHONY : rebuild_cache/fast |  | ||||||
| 
 |  | ||||||
| # Special rule for the target edit_cache
 |  | ||||||
| edit_cache: |  | ||||||
| 	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." |  | ||||||
| 	/home/Applications/JetBrains/clion-2017.3.3/bin/cmake/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. |  | ||||||
| .PHONY : edit_cache |  | ||||||
| 
 |  | ||||||
| # Special rule for the target edit_cache
 |  | ||||||
| edit_cache/fast: edit_cache |  | ||||||
| 
 |  | ||||||
| .PHONY : edit_cache/fast |  | ||||||
| 
 |  | ||||||
| # The main all target
 |  | ||||||
| all: cmake_check_build_system |  | ||||||
| 	$(CMAKE_COMMAND) -E cmake_progress_start /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles/progress.marks |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 all |  | ||||||
| 	$(CMAKE_COMMAND) -E cmake_progress_start /home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/CMakeFiles 0 |  | ||||||
| .PHONY : all |  | ||||||
| 
 |  | ||||||
| # The main clean target
 |  | ||||||
| clean: |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 clean |  | ||||||
| .PHONY : clean |  | ||||||
| 
 |  | ||||||
| # The main clean target
 |  | ||||||
| clean/fast: clean |  | ||||||
| 
 |  | ||||||
| .PHONY : clean/fast |  | ||||||
| 
 |  | ||||||
| # Prepare targets for installation.
 |  | ||||||
| preinstall: all |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 preinstall |  | ||||||
| .PHONY : preinstall |  | ||||||
| 
 |  | ||||||
| # Prepare targets for installation.
 |  | ||||||
| preinstall/fast: |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 preinstall |  | ||||||
| .PHONY : preinstall/fast |  | ||||||
| 
 |  | ||||||
| # clear depends
 |  | ||||||
| depend: |  | ||||||
| 	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 |  | ||||||
| .PHONY : depend |  | ||||||
| 
 |  | ||||||
| #=============================================================================
 |  | ||||||
| # Target rules for targets named stress
 |  | ||||||
| 
 |  | ||||||
| # Build rule for target.
 |  | ||||||
| stress: cmake_check_build_system |  | ||||||
| 	$(MAKE) -f CMakeFiles/Makefile2 stress |  | ||||||
| .PHONY : stress |  | ||||||
| 
 |  | ||||||
| # fast build rule for target.
 |  | ||||||
| stress/fast: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/build |  | ||||||
| .PHONY : stress/fast |  | ||||||
| 
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.o: home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.o |  | ||||||
| 
 |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.o |  | ||||||
| 
 |  | ||||||
| # target to build an object file
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.o: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.o |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.o |  | ||||||
| 
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.i: home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.i |  | ||||||
| 
 |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.i |  | ||||||
| 
 |  | ||||||
| # target to preprocess a source file
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.i: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.i |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.i |  | ||||||
| 
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.s: home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.s |  | ||||||
| 
 |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.s |  | ||||||
| 
 |  | ||||||
| # target to generate assembly for a file
 |  | ||||||
| home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.s: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.s |  | ||||||
| .PHONY : home/dimercur/Travail/git/C-TP-RT/src/robot.cpp.s |  | ||||||
| 
 |  | ||||||
| main.o: main.cpp.o |  | ||||||
| 
 |  | ||||||
| .PHONY : main.o |  | ||||||
| 
 |  | ||||||
| # target to build an object file
 |  | ||||||
| main.cpp.o: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/main.cpp.o |  | ||||||
| .PHONY : main.cpp.o |  | ||||||
| 
 |  | ||||||
| main.i: main.cpp.i |  | ||||||
| 
 |  | ||||||
| .PHONY : main.i |  | ||||||
| 
 |  | ||||||
| # target to preprocess a source file
 |  | ||||||
| main.cpp.i: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/main.cpp.i |  | ||||||
| .PHONY : main.cpp.i |  | ||||||
| 
 |  | ||||||
| main.s: main.cpp.s |  | ||||||
| 
 |  | ||||||
| .PHONY : main.s |  | ||||||
| 
 |  | ||||||
| # target to generate assembly for a file
 |  | ||||||
| main.cpp.s: |  | ||||||
| 	$(MAKE) -f CMakeFiles/stress.dir/build.make CMakeFiles/stress.dir/main.cpp.s |  | ||||||
| .PHONY : main.cpp.s |  | ||||||
| 
 |  | ||||||
| # Help Target
 |  | ||||||
| help: |  | ||||||
| 	@echo "The following are some of the valid targets for this Makefile:" |  | ||||||
| 	@echo "... all (the default if no target is provided)" |  | ||||||
| 	@echo "... clean" |  | ||||||
| 	@echo "... depend" |  | ||||||
| 	@echo "... rebuild_cache" |  | ||||||
| 	@echo "... edit_cache" |  | ||||||
| 	@echo "... stress" |  | ||||||
| 	@echo "... home/dimercur/Travail/git/C-TP-RT/src/robot.o" |  | ||||||
| 	@echo "... home/dimercur/Travail/git/C-TP-RT/src/robot.i" |  | ||||||
| 	@echo "... home/dimercur/Travail/git/C-TP-RT/src/robot.s" |  | ||||||
| 	@echo "... main.o" |  | ||||||
| 	@echo "... main.i" |  | ||||||
| 	@echo "... main.s" |  | ||||||
| .PHONY : help |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| #=============================================================================
 |  | ||||||
| # Special targets to cleanup operation of make.
 |  | ||||||
| 
 |  | ||||||
| # Special rule to run CMake to check the build system integrity.
 |  | ||||||
| # No rule that depends on this can have commands that come from listfiles
 |  | ||||||
| # because they might be regenerated.
 |  | ||||||
| cmake_check_build_system: |  | ||||||
| 	$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 |  | ||||||
| .PHONY : cmake_check_build_system |  | ||||||
| 
 |  | ||||||
|  | @ -1,44 +0,0 @@ | ||||||
| # Install script for directory: /home/dimercur/Travail/git/C-TP-RT/example/stress |  | ||||||
| 
 |  | ||||||
| # Set the install prefix |  | ||||||
| if(NOT DEFINED CMAKE_INSTALL_PREFIX) |  | ||||||
|   set(CMAKE_INSTALL_PREFIX "/usr/local") |  | ||||||
| endif() |  | ||||||
| string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") |  | ||||||
| 
 |  | ||||||
| # Set the install configuration name. |  | ||||||
| if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) |  | ||||||
|   if(BUILD_TYPE) |  | ||||||
|     string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" |  | ||||||
|            CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") |  | ||||||
|   else() |  | ||||||
|     set(CMAKE_INSTALL_CONFIG_NAME "Debug") |  | ||||||
|   endif() |  | ||||||
|   message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") |  | ||||||
| endif() |  | ||||||
| 
 |  | ||||||
| # Set the component getting installed. |  | ||||||
| if(NOT CMAKE_INSTALL_COMPONENT) |  | ||||||
|   if(COMPONENT) |  | ||||||
|     message(STATUS "Install component: \"${COMPONENT}\"") |  | ||||||
|     set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") |  | ||||||
|   else() |  | ||||||
|     set(CMAKE_INSTALL_COMPONENT) |  | ||||||
|   endif() |  | ||||||
| endif() |  | ||||||
| 
 |  | ||||||
| # Install shared libraries without execute permission? |  | ||||||
| if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) |  | ||||||
|   set(CMAKE_INSTALL_SO_NO_EXE "1") |  | ||||||
| endif() |  | ||||||
| 
 |  | ||||||
| if(CMAKE_INSTALL_COMPONENT) |  | ||||||
|   set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") |  | ||||||
| else() |  | ||||||
|   set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") |  | ||||||
| endif() |  | ||||||
| 
 |  | ||||||
| string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT |  | ||||||
|        "${CMAKE_INSTALL_MANIFEST_FILES}") |  | ||||||
| file(WRITE "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/${CMAKE_INSTALL_MANIFEST}" |  | ||||||
|      "${CMAKE_INSTALL_MANIFEST_CONTENT}") |  | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -1,100 +0,0 @@ | ||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <CodeBlocks_project_file> |  | ||||||
| 	<FileVersion major="1" minor="6"/> |  | ||||||
| 	<Project> |  | ||||||
| 		<Option title="stress"/> |  | ||||||
| 		<Option makefile_is_custom="1"/> |  | ||||||
| 		<Option compiler="gcc"/> |  | ||||||
| 		<Option virtualFolders="CMake Files\;"/> |  | ||||||
| 		<Build> |  | ||||||
| 			<Target title="all"> |  | ||||||
| 				<Option working_dir="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug"/> |  | ||||||
| 				<Option type="4"/> |  | ||||||
| 				<MakeCommands> |  | ||||||
| 					<Build command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 all"/> |  | ||||||
| 					<CompileFile command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 "$file""/> |  | ||||||
| 					<Clean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 					<DistClean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 				</MakeCommands> |  | ||||||
| 			</Target> |  | ||||||
| 			<Target title="rebuild_cache"> |  | ||||||
| 				<Option working_dir="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug"/> |  | ||||||
| 				<Option type="4"/> |  | ||||||
| 				<MakeCommands> |  | ||||||
| 					<Build command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 rebuild_cache"/> |  | ||||||
| 					<CompileFile command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 "$file""/> |  | ||||||
| 					<Clean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 					<DistClean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 				</MakeCommands> |  | ||||||
| 			</Target> |  | ||||||
| 			<Target title="edit_cache"> |  | ||||||
| 				<Option working_dir="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug"/> |  | ||||||
| 				<Option type="4"/> |  | ||||||
| 				<MakeCommands> |  | ||||||
| 					<Build command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 edit_cache"/> |  | ||||||
| 					<CompileFile command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 "$file""/> |  | ||||||
| 					<Clean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 					<DistClean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 				</MakeCommands> |  | ||||||
| 			</Target> |  | ||||||
| 			<Target title="stress"> |  | ||||||
| 				<Option output="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/stress" prefix_auto="0" extension_auto="0"/> |  | ||||||
| 				<Option working_dir="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug"/> |  | ||||||
| 				<Option object_output="./"/> |  | ||||||
| 				<Option type="1"/> |  | ||||||
| 				<Option compiler="gcc"/> |  | ||||||
| 				<Compiler> |  | ||||||
| 					<Add directory="/usr/include/c++/7"/> |  | ||||||
| 					<Add directory="/usr/include/x86_64-linux-gnu/c++/7"/> |  | ||||||
| 					<Add directory="/usr/include/c++/7/backward"/> |  | ||||||
| 					<Add directory="/usr/lib/gcc/x86_64-linux-gnu/7/include"/> |  | ||||||
| 					<Add directory="/usr/local/include"/> |  | ||||||
| 					<Add directory="/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed"/> |  | ||||||
| 					<Add directory="/usr/include/x86_64-linux-gnu"/> |  | ||||||
| 					<Add directory="/usr/include"/> |  | ||||||
| 				</Compiler> |  | ||||||
| 				<MakeCommands> |  | ||||||
| 					<Build command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 stress"/> |  | ||||||
| 					<CompileFile command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 "$file""/> |  | ||||||
| 					<Clean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 					<DistClean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 				</MakeCommands> |  | ||||||
| 			</Target> |  | ||||||
| 			<Target title="stress/fast"> |  | ||||||
| 				<Option output="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/stress" prefix_auto="0" extension_auto="0"/> |  | ||||||
| 				<Option working_dir="/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug"/> |  | ||||||
| 				<Option object_output="./"/> |  | ||||||
| 				<Option type="1"/> |  | ||||||
| 				<Option compiler="gcc"/> |  | ||||||
| 				<Compiler> |  | ||||||
| 					<Add directory="/usr/include/c++/7"/> |  | ||||||
| 					<Add directory="/usr/include/x86_64-linux-gnu/c++/7"/> |  | ||||||
| 					<Add directory="/usr/include/c++/7/backward"/> |  | ||||||
| 					<Add directory="/usr/lib/gcc/x86_64-linux-gnu/7/include"/> |  | ||||||
| 					<Add directory="/usr/local/include"/> |  | ||||||
| 					<Add directory="/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed"/> |  | ||||||
| 					<Add directory="/usr/include/x86_64-linux-gnu"/> |  | ||||||
| 					<Add directory="/usr/include"/> |  | ||||||
| 				</Compiler> |  | ||||||
| 				<MakeCommands> |  | ||||||
| 					<Build command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 stress/fast"/> |  | ||||||
| 					<CompileFile command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 "$file""/> |  | ||||||
| 					<Clean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 					<DistClean command="/usr/bin/make -j4 -f "/home/dimercur/Travail/git/C-TP-RT/example/stress/cmake-build-debug/Makefile"  VERBOSE=1 clean"/> |  | ||||||
| 				</MakeCommands> |  | ||||||
| 			</Target> |  | ||||||
| 		</Build> |  | ||||||
| 		<Unit filename="/home/dimercur/Travail/git/C-TP-RT/example/stress/main.cpp"> |  | ||||||
| 			<Option target="stress"/> |  | ||||||
| 		</Unit> |  | ||||||
| 		<Unit filename="/home/dimercur/Travail/git/C-TP-RT/src/robot.cpp"> |  | ||||||
| 			<Option target="stress"/> |  | ||||||
| 		</Unit> |  | ||||||
| 		<Unit filename="/home/dimercur/Travail/git/C-TP-RT/src/robot.h"> |  | ||||||
| 			<Option target="stress"/> |  | ||||||
| 		</Unit> |  | ||||||
| 		<Unit filename="/home/dimercur/Travail/git/C-TP-RT/example/stress/CMakeLists.txt"> |  | ||||||
| 			<Option virtualFolder="CMake Files\"/> |  | ||||||
| 		</Unit> |  | ||||||
| 	</Project> |  | ||||||
| </CodeBlocks_project_file> |  | ||||||
							
								
								
									
										57
									
								
								software/raspberry/superviseur-robot/src.sav/definitions.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								software/raspberry/superviseur-robot/src.sav/definitions.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | ||||||
|  | /*
 | ||||||
|  |  * To change this license header, choose License Headers in Project Properties. | ||||||
|  |  * To change this template file, choose Tools | Templates | ||||||
|  |  * and open the template in the editor. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* 
 | ||||||
|  |  * File:   msg.h | ||||||
|  |  * Author: pehladik | ||||||
|  |  * | ||||||
|  |  * Created on 15 janvier 2018, 20:45 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef DEFINITIONS_H | ||||||
|  | #define DEFINITIONS_H | ||||||
|  | 
 | ||||||
|  | #define OPEN_COM_DMB  'o' | ||||||
|  | #define CLOSE_COM_DMB 'C' | ||||||
|  | 
 | ||||||
|  | #define DMB_PING                'p' | ||||||
|  | #define DMB_IDLE                'r' | ||||||
|  | #define DMB_START_WITHOUT_WD    'u' | ||||||
|  | #define DMB_START_WITH_WD       'W' | ||||||
|  | #define DMB_RELOAD_WD           'w' | ||||||
|  | #define DMB_GET_VBAT            'v' | ||||||
|  | #define DMB_IS_BUSY             'b' | ||||||
|  | #define DMB_MOVE                'M' | ||||||
|  | #define DMB_TURN                'T' | ||||||
|  | #define DMB_GO_FORWARD          'F' | ||||||
|  | #define DMB_GO_BACK             'B' | ||||||
|  | #define DMB_GO_LEFT             'L' | ||||||
|  | #define DMB_GO_RIGHT            'R' | ||||||
|  | #define DMB_STOP_MOVE           'S' | ||||||
|  | 
 | ||||||
|  | #define ROBOT_TIMED_OUT -3 | ||||||
|  | #define ROBOT_UKNOWN_CMD -2 | ||||||
|  | #define ROBOT_ERROR  -1 | ||||||
|  | #define ROBOT_CHECKSUM  -4 | ||||||
|  | #define ROBOT_OK    0 | ||||||
|  | 
 | ||||||
|  | #define CAM_OPEN                    'A' | ||||||
|  | #define CAM_CLOSE                   'I' | ||||||
|  | #define CAM_ASK_ARENA               'y' | ||||||
|  | #define CAM_ARENA_CONFIRM           'x' | ||||||
|  | #define CAM_ARENA_INFIRM            'z' | ||||||
|  | #define CAM_COMPUTE_POSITION        'p' | ||||||
|  | #define CAM_STOP_COMPUTE_POSITION   's' | ||||||
|  | 
 | ||||||
|  | #define DMB_BAT_LOW 0 | ||||||
|  | #define DMB_BAT_MEDIUM 1 | ||||||
|  | #define DMB_BAT_HIGHT 2 | ||||||
|  | 
 | ||||||
|  | #define DMB_BUSY 1 | ||||||
|  | #define DMB_DO_NOTHING 0 | ||||||
|  | 
 | ||||||
|  | #endif /* MSG_H */ | ||||||
|  | 
 | ||||||
							
								
								
									
										211
									
								
								software/raspberry/superviseur-robot/src.sav/image.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								software/raspberry/superviseur-robot/src.sav/image.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,211 @@ | ||||||
|  | /**
 | ||||||
|  |  * \file      image.cpp | ||||||
|  |  * \author    L.Senaneuch | ||||||
|  |  * \version   1.0 | ||||||
|  |  * \date      06/06/2017 | ||||||
|  |  * \brief     Fonctions de traitement d'image utilisable pour la détection du robot. | ||||||
|  |  * | ||||||
|  |  * \details   Ce fichier utilise la libraire openCV2 pour faciliter le traitement d'image dans le projet Destijl. | ||||||
|  |  *            Il permet de faciliter la détection de l'arène et la détection du robot. | ||||||
|  |  *			  /!\ Attention Bien que celui-ci soit un .cpp la structure du code n'est pas sous forme d'objet. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "image.h" | ||||||
|  | #include <iostream> | ||||||
|  | 
 | ||||||
|  | using namespace cv; | ||||||
|  | #ifndef __STUB__ | ||||||
|  | using namespace raspicam; | ||||||
|  | #else | ||||||
|  | Image stubImg; | ||||||
|  | #endif | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | float calculAngle(Position * positionRobot); | ||||||
|  | int cropArena(Image *imgInput, Image *imgOutput, Arene *AreneInput); | ||||||
|  | float euclideanDist(Point& p, Point& q); | ||||||
|  | 
 | ||||||
|  | void draw_arena(Image *imgInput, Image *imgOutput, Arene *monArene) | ||||||
|  | { | ||||||
|  |     if(imgInput!=imgOutput) | ||||||
|  |         *imgOutput=imgInput->clone(); | ||||||
|  |     rectangle(*imgOutput,monArene->tl(),monArene->br(),Scalar(0,0,125),2,8,0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int open_camera(Camera  *camera) | ||||||
|  | { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     camera->set(CV_CAP_PROP_FORMAT, CV_8UC3); | ||||||
|  |     camera->set(CV_CAP_PROP_FRAME_WIDTH,WIDTH); | ||||||
|  |     camera->set(CV_CAP_PROP_FRAME_HEIGHT,HEIGHT); | ||||||
|  | 
 | ||||||
|  |     printf("Opening Camera...\n"); | ||||||
|  |     if (!(camera->open())) { | ||||||
|  |         perror("Can't open Camera\n") ; | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         printf("Camera warmup 2sec\n"); | ||||||
|  |         sleep(2); | ||||||
|  |         printf("Start capture\n"); | ||||||
|  |         return 0; | ||||||
|  |     }    | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void get_image(Camera *camera, Image * monImage, const char  * fichier) // getImg(Camera, Image img); | ||||||
|  | { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     camera->grab(); | ||||||
|  |     camera->retrieve(*monImage); | ||||||
|  |     cvtColor(*monImage,*monImage,CV_BGR2RGB); | ||||||
|  | #else | ||||||
|  |     stubImg = imread(fichier, CV_LOAD_IMAGE_COLOR); | ||||||
|  |     stubImg.copyTo(*monImage); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void close_camera(Camera *camera) // closeCam(Camera) : camera Entrer
 | ||||||
|  | { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     camera->release(); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | int detect_arena(Image *monImage, Arene *rectangle) // Image en entrée // rectangle en sortie
 | ||||||
|  | { | ||||||
|  |     vector<vector<Point> > contours; | ||||||
|  |     vector<Point> approx; | ||||||
|  |     vector<Vec4i> hierarchy; | ||||||
|  | 
 | ||||||
|  |     Image imageTrt; | ||||||
|  |     cvtColor(*monImage,imageTrt,CV_RGB2GRAY); // conversion en niveau de gris
 | ||||||
|  |     threshold(imageTrt,imageTrt,128,255,CV_THRESH_BINARY); // Threshold les éléments les plus clair
 | ||||||
|  |     Canny(imageTrt, imageTrt, 100,200,3); // detection d'angle
 | ||||||
|  | 
 | ||||||
|  |     findContours(imageTrt, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0)); | ||||||
|  |     for(unsigned int i = 0; i < contours.size();i++) | ||||||
|  | 	{ | ||||||
|  |         approxPolyDP(Image(contours[i]), approx, arcLength(Image(contours[i]), true)*0.1, true); | ||||||
|  |         if(approx.size()==4 && fabs(cv::contourArea(contours[i])) > 100000) | ||||||
|  |         { | ||||||
|  |             *rectangle = boundingRect(Image(contours[i])); | ||||||
|  |             return 0; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return -1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int cropArena(Image *imgInput, Image *imgOutput, Arene *areneInput) // image // rectangle // image2
 | ||||||
|  | { | ||||||
|  |     Image img; | ||||||
|  |     img=imgInput->clone(); | ||||||
|  | 
 | ||||||
|  |     *imgOutput = img(*areneInput); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | float euclideanDist(Point& p, Point& q) { | ||||||
|  |     Point diff = p - q; | ||||||
|  |     return cv::sqrt(diff.x*diff.x + diff.y*diff.y); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void compress_image(Image *imgInput, Jpg *imageCompress) // image entrée // imageEncodé en sortie
 | ||||||
|  | { | ||||||
|  |     imencode(".jpg",*imgInput,*imageCompress); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | int detect_position(Image *imgInput, Position *posTriangle, Arene * monArene) // entree : image  / sortie tab pos
 | ||||||
|  | { | ||||||
|  |     vector<vector<Point> > contours; | ||||||
|  |     vector<Point> approx; | ||||||
|  |     vector<Vec4i> hierarchy; | ||||||
|  | 
 | ||||||
|  |     Image imgTraitment; | ||||||
|  | 
 | ||||||
|  |     if(monArene==NULL) | ||||||
|  |         imgTraitment=imgInput->clone(); | ||||||
|  |     else | ||||||
|  |         cropArena(imgInput,&imgTraitment, monArene); | ||||||
|  | 
 | ||||||
|  |     cvtColor(imgTraitment,imgTraitment,CV_RGB2GRAY); | ||||||
|  |     threshold(imgTraitment,imgTraitment,128,255,CV_THRESH_BINARY); | ||||||
|  |     findContours(imgTraitment, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0)); | ||||||
|  | 
 | ||||||
|  |     int nbrTriangle = 0; | ||||||
|  |     for(unsigned int i = 0;i < contours.size();i++) | ||||||
|  | 	{ | ||||||
|  |         approxPolyDP(Mat(contours[i]), approx, arcLength(Mat(contours[i]), true)*0.17, true); | ||||||
|  |         if(approx.size() == 3 && fabs(contourArea(contours[i])) > 200 && fabs(contourArea(contours[i])) < 700) | ||||||
|  |         { | ||||||
|  | 
 | ||||||
|  |             Point a,b,c; | ||||||
|  |             Point center; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             a = approx[0]; | ||||||
|  |             b = approx[1]; | ||||||
|  |             c = approx[2]; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |             if(monArene !=NULL) // ajout de l'offset de l'arène
 | ||||||
|  |             { | ||||||
|  |                a.x += monArene->x; | ||||||
|  |                a.y += monArene->y; | ||||||
|  |                b.x += monArene->x; | ||||||
|  |                b.y += monArene->y; | ||||||
|  |                c.x += monArene->x; | ||||||
|  |                c.y += monArene->y;		     | ||||||
|  |             } | ||||||
|  | 		 | ||||||
|  |             center.x = (a.x + b.x + c.x)/3; | ||||||
|  |             center.y = (a.y + b.y + c.y)/3; | ||||||
|  | 
 | ||||||
|  |             posTriangle[nbrTriangle].center=center; | ||||||
|  | 
 | ||||||
|  |             if(euclideanDist(center,b) > euclideanDist(center,a) && euclideanDist(center,b) > euclideanDist(center,c) ) | ||||||
|  |             { | ||||||
|  | 
 | ||||||
|  |                 posTriangle[nbrTriangle].direction=b; | ||||||
|  |                 //line(img,center,b,Scalar(0,125,0),2,8,0);
 | ||||||
|  |             } | ||||||
|  |             else if(euclideanDist(center,a) > euclideanDist(center,c)) | ||||||
|  |             { | ||||||
|  |                 posTriangle[nbrTriangle].direction=a; | ||||||
|  |                 //line(img,center,a,Scalar(0,125,0),2,8,0);
 | ||||||
|  | 
 | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 posTriangle[nbrTriangle].direction=c; | ||||||
|  |                 //line(img,center,c,Scalar(0,125,0),2,8,0);
 | ||||||
|  |             } | ||||||
|  |             posTriangle[nbrTriangle].angle=calculAngle(&posTriangle[nbrTriangle]); | ||||||
|  | 
 | ||||||
|  |             nbrTriangle++; | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     return nbrTriangle; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void draw_position(Image *imgInput, Image *imgOutput, Position *positionRobot) // img E/S   pos : E
 | ||||||
|  | { | ||||||
|  |     if(imgInput!=imgOutput) | ||||||
|  |     { | ||||||
|  |         *imgOutput=imgInput->clone(); | ||||||
|  |     } | ||||||
|  |     line(*imgOutput,positionRobot->center,positionRobot->direction,Scalar(0,125,0),2,8,0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | float calculAngle(Position * positionRobot) // position en entree
 | ||||||
|  | { | ||||||
|  |     float a = positionRobot->direction.x - positionRobot->center.x; | ||||||
|  |     float b = positionRobot->direction.y - positionRobot->center.y ; | ||||||
|  |     float angle = atan2(b,a); | ||||||
|  |     return angle * 180.f/M_PI; | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										128
									
								
								software/raspberry/superviseur-robot/src.sav/image.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								software/raspberry/superviseur-robot/src.sav/image.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,128 @@ | ||||||
|  | /**
 | ||||||
|  |  * \file      image.h | ||||||
|  |  * \author    L.Senaneuch | ||||||
|  |  * \version   1.0 | ||||||
|  |  * \date      06/06/2017 | ||||||
|  |  * \brief     Fonctions de traitement d'image utilisable pour la d<EFBFBD>tection du robot. | ||||||
|  |  * | ||||||
|  |  * \details   Ce fichier utilise la libraire openCV2 pour faciliter le traitement d'image dans le projet Destijl. | ||||||
|  |  *            Il permet de faciliter la d<EFBFBD>tection de l'ar<EFBFBD>ne et la d<EFBFBD>tection du robot. | ||||||
|  |  *			  /!\ Attention Bien que celui-ci soit un .cpp la structure du code n'est pas sous forme d'objet. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #ifndef IMAGERIE_H | ||||||
|  | #define IMAGERIE_H | ||||||
|  | 
 | ||||||
|  | #ifndef __STUB__ | ||||||
|  | #include <raspicam/raspicam_cv.h> | ||||||
|  | #else | ||||||
|  | #include <opencv2/highgui/highgui.hpp> | ||||||
|  | #endif | ||||||
|  | #include "opencv2/imgproc/imgproc.hpp" | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <math.h> | ||||||
|  | 
 | ||||||
|  | #define WIDTH 480 //1280 1024 640 480
 | ||||||
|  | #define HEIGHT 360 // 960 768 480 360
 | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | using namespace cv; | ||||||
|  | #ifndef __STUB__ | ||||||
|  | using namespace raspicam; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | typedef Mat Image; | ||||||
|  | #ifndef __STUB__ | ||||||
|  | typedef RaspiCam_Cv Camera; | ||||||
|  | #else | ||||||
|  | typedef int Camera; | ||||||
|  | #endif | ||||||
|  | typedef Rect Arene; | ||||||
|  | typedef vector<unsigned char> Jpg; | ||||||
|  | 
 | ||||||
|  | struct Position { | ||||||
|  |     Point center; | ||||||
|  |     Point direction; | ||||||
|  |     float angle; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Ouvre une camera. | ||||||
|  |  * \details    Met à jour le descripteur de fichier passé en paramètre pour correspondre à la camera ouverte | ||||||
|  |  *              | ||||||
|  |  * \param    *Camera      	Pointeur d'un file descriptor d'une camera ouverte | ||||||
|  |  * \return retourne 0 si la camera a été ouverte correctement et -1 si une erreur survient. | ||||||
|  |  */ | ||||||
|  | int open_camera(Camera *camera); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Ferme la camera passé en paramètre | ||||||
|  |  *              | ||||||
|  |  * \param    *Camera       Pointeur sur la camera à fermer | ||||||
|  |  */ | ||||||
|  | void close_camera(Camera *camera); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Capture une image avec la camera passée en entrée. En cas de test | ||||||
|  |  * sans camera, la fonction charge une image  | ||||||
|  |  * \details    La camera doit préalablement être ouverte via \a openCamera(...) | ||||||
|  |  *              | ||||||
|  |  * \param    *Camera       Pointeur sur la camera passée en entrée. | ||||||
|  |  * \param    *monImage 	   Pointeur sur une image capturée.  | ||||||
|  |  * \param    *fichier         chemin du fichier d'image | ||||||
|  |  * \return    Retourne -1 si une erreur survient. | ||||||
|  |  */ | ||||||
|  | void get_image(Camera *camera, Image * monImage, const char *fichier = NULL); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Détecte une arène dans une image fournis en paramètre. | ||||||
|  |  *              | ||||||
|  |  * \param    *monImage       Pointeur sur l'image d'entrée | ||||||
|  |  * \param    *rectangle 	 Pointeur sur les coordonnées du rectangles trouvé.  | ||||||
|  |  * \return    Retourne -1 si aucune arène n'est détectée. Sinon retourne 0 | ||||||
|  |  */ | ||||||
|  | int detect_arena(Image *monImage, Arene *rectangle); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Dessine le plus petit rectangle contenant l'arène | ||||||
|  |   | ||||||
|  |  * \param    *imgInput       Pointeur sur l'image d'entrée. | ||||||
|  |  * \param    *imgOutput      Pointeur sur l'image de sortie (image d'entrée + arène marquée) | ||||||
|  |  * \param    *monArene		 Pointeur de type Arène contenant les information à dessiner | ||||||
|  |  */ | ||||||
|  | void draw_arena(Image *imgInput, Image *imgOutput, Arene *monArene); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Détecte la position d'un robot. | ||||||
|  |  * \details    Détecte la position de triangles blanc sur une image /a imgInput passé en paramètre d'entrer. | ||||||
|  |  *              | ||||||
|  |  * \param    *imgInput       Pointeur sur l'image sur laquelle chercher la position du des robots. | ||||||
|  |  * \param    *posTriangle    Pointeur sur un tableau de position ou seront stocké les positions des triangles détectés. | ||||||
|  |  * \param    *monArene       Pointeur de type Arène si nécessaire d'affiner la recherche (optionnel)  | ||||||
|  |  * \return    Le nombre de triangles détectés. | ||||||
|  |  */ | ||||||
|  | int detect_position(Image *imgInput, Position *posTriangle, Arene * monArene = NULL); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Dessine sur une image en entrée la position d'un robot et sa direction. | ||||||
|  |  * \details    Sauvegarde l'image des coordonnées passées par positionRobot  | ||||||
|  |  * superposée à l'image d'entrée sur imgOutput. | ||||||
|  |  *              | ||||||
|  |  * \param      *imgInput	      	Pointeur sur l'image d'entrée | ||||||
|  |  * \param      *imgOutput    		Pointeur sur l'image de sortie ( image  | ||||||
|  |  * d'entrée + dessin de la position) | ||||||
|  |  * \param      *positionRobot   	Pointeur sur la structure position d'un robot. | ||||||
|  |  */ | ||||||
|  | void draw_position(Image *imgInput, Image *imgOutput, Position *positionRobot); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Détecte la position d'un robot. | ||||||
|  |  * \details    Détecte la position de triangles blanc sur une image /a imgInput passé en paramètre d'entrer. | ||||||
|  |  *              | ||||||
|  |  * \param    *imgInput      	Pointeur sur l'image à sauvegarder en mémoire sous format jpg. | ||||||
|  |  * \param    *imageCompress	Pointeur sur une image .jpg. | ||||||
|  |  */ | ||||||
|  | void compress_image(Image *imgInput, Jpg *imageCompress); | ||||||
|  | 
 | ||||||
|  | #endif // IMAGERIE_H
 | ||||||
							
								
								
									
										29
									
								
								software/raspberry/superviseur-robot/src.sav/message.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								software/raspberry/superviseur-robot/src.sav/message.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | /*
 | ||||||
|  |  * To change this license header, choose License Headers in Project Properties. | ||||||
|  |  * To change this template file, choose Tools | Templates | ||||||
|  |  * and open the template in the editor. | ||||||
|  |  */ | ||||||
|  | #include "message.h" | ||||||
|  | 
 | ||||||
|  | void set_msgToMon_header(MessageToMon *msg, char *header) { | ||||||
|  |     memcpy(msg->header, header, sizeof (header)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void set_msgToMon_data(MessageToMon *msg, void * data) { | ||||||
|  |     if (msg->data != NULL) { | ||||||
|  |         free(msg->data); | ||||||
|  |     } | ||||||
|  |     msg->data = malloc(sizeof (data)); | ||||||
|  |     memcpy(msg->data, data, sizeof (data)); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void free_msgToMon_data(MessageToMon *msg) { | ||||||
|  |     if (msg->data != NULL) { | ||||||
|  |         free(msg->data); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void print_msgToMon(MessageToMon *msg) { | ||||||
|  |     printf("header: %s\n", msg->header); | ||||||
|  |     printf("data: %s\n", msg->data); | ||||||
|  | } | ||||||
							
								
								
									
										33
									
								
								software/raspberry/superviseur-robot/src.sav/message.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								software/raspberry/superviseur-robot/src.sav/message.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | /*
 | ||||||
|  |  * To change this license header, choose License Headers in Project Properties. | ||||||
|  |  * To change this template file, choose Tools | Templates | ||||||
|  |  * and open the template in the editor. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* 
 | ||||||
|  |  * File:   message.h | ||||||
|  |  * Author: pehladik | ||||||
|  |  * | ||||||
|  |  * Created on 7 février 2018, 17:20 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef MESSAGE_H | ||||||
|  | #define MESSAGE_H | ||||||
|  | 
 | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <string.h> | ||||||
|  | 
 | ||||||
|  | typedef struct { | ||||||
|  |     char header[4]; | ||||||
|  |     void *data = NULL; | ||||||
|  | } MessageToMon; | ||||||
|  | 
 | ||||||
|  | void set_msgToMon_header(MessageToMon *msg, char *header); | ||||||
|  | void set_msgToMon_data(MessageToMon *msg, void * data); | ||||||
|  | void free_msgToMon_data(MessageToMon *msg); | ||||||
|  | void print_msgToMon(MessageToMon *msg); | ||||||
|  | 
 | ||||||
|  | #endif /* MESSAGE_H */ | ||||||
|  | 
 | ||||||
							
								
								
									
										161
									
								
								software/raspberry/superviseur-robot/src.sav/monitor.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								software/raspberry/superviseur-robot/src.sav/monitor.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,161 @@ | ||||||
|  | #include "monitor.h" | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | SOCKADDR_IN ssin; | ||||||
|  | SOCKET sock; | ||||||
|  | socklen_t recsize = sizeof (ssin); | ||||||
|  | 
 | ||||||
|  | /*Socket et contexte d'adressage du client */ | ||||||
|  | SOCKADDR_IN csin; | ||||||
|  | SOCKET csock; | ||||||
|  | socklen_t crecsize = sizeof (csin); | ||||||
|  | 
 | ||||||
|  | int sock_err; | ||||||
|  | pid_t pidNodejs; | ||||||
|  | 
 | ||||||
|  | string serverReceive(int size); | ||||||
|  | int serverSend(const void *data, int dataLength); | ||||||
|  | int receive(char *data); | ||||||
|  | 
 | ||||||
|  | int run_nodejs(const char * path, char * file) { | ||||||
|  |     int ret; | ||||||
|  |     //char *const parmList[] = {"/bin/ls", "-l", "/home", NULL};
 | ||||||
|  |     char * const parmList[] = {"node", file, NULL}; | ||||||
|  | 
 | ||||||
|  |     if ((ret = fork()) == -1) | ||||||
|  |         perror("fork error"); | ||||||
|  |     else if (ret == 0) { | ||||||
|  |         ret = execv(path, parmList); | ||||||
|  |     } | ||||||
|  |     return ret; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int kill_nodejs() { | ||||||
|  | #ifdef __VERBOSE__   | ||||||
|  |     printf("kill nodejs\n"); | ||||||
|  | #endif | ||||||
|  |     return kill(pidNodejs, SIGTERM); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int open_server(int port) { | ||||||
|  |     /* Création d'un socket */ | ||||||
|  |     sock = socket(AF_INET, SOCK_STREAM, 0); | ||||||
|  |     int enable = 1; | ||||||
|  | 
 | ||||||
|  |     /* Si la socket est valide */ | ||||||
|  |     if (sock != INVALID_SOCKET) { | ||||||
|  | #ifdef _WITH_TRACE_ | ||||||
|  |         printf("TCP/IP Socket %d opened\n", sock); | ||||||
|  | #endif | ||||||
|  |         setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof (enable)); | ||||||
|  | 
 | ||||||
|  |         /* Configuration */ | ||||||
|  |         ssin.sin_addr.s_addr = htonl(INADDR_ANY); /* Adresse IP automatique */ | ||||||
|  |         ssin.sin_family = AF_INET; /* Protocole familial (IP) */ | ||||||
|  |         ssin.sin_port = htons(port); /* Listage du port */ | ||||||
|  |         sock_err = bind(sock, (SOCKADDR*) & ssin, recsize); | ||||||
|  | 
 | ||||||
|  |         /* Si la socket fonctionne */ | ||||||
|  |         if (sock_err != SOCKET_ERROR) { | ||||||
|  |             /* Démarrage du listage (mode server) */ | ||||||
|  |             sock_err = listen(sock, 1); | ||||||
|  | 
 | ||||||
|  |             /* Si la socket fonctionne */ | ||||||
|  |             if (sock_err != SOCKET_ERROR) { | ||||||
|  |                 /* Attente pendant laquelle le client se connecte */ | ||||||
|  | #ifdef _WITH_TRACE_ | ||||||
|  |                 printf("Waiting a client on port %d\n", port); | ||||||
|  | #endif | ||||||
|  |                 csock = accept(sock, (SOCKADDR*) & csin, &crecsize); | ||||||
|  | #ifdef _WITH_TRACE_ | ||||||
|  |                 printf("Client connected\n"); | ||||||
|  | #endif | ||||||
|  |                 return 0; | ||||||
|  |             } else { | ||||||
|  |                 perror("listen"); | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             perror("bind"); | ||||||
|  |             return (-1); | ||||||
|  |         } | ||||||
|  |     } else { | ||||||
|  |         perror("socket"); | ||||||
|  |         return (-1); | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int close_server(void) { | ||||||
|  |     /* Fermeture de la socket client et de la socket serveur */ | ||||||
|  |     close(csock); | ||||||
|  |     close(sock); | ||||||
|  |     printf("Socket fermé\n"); | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int send_message_to_monitor(const char* typeMessage, const void * data) { | ||||||
|  |     if ((string) typeMessage == HEADER_STM_IMAGE) { | ||||||
|  |         Jpg * imgC = (Jpg*) data; | ||||||
|  |         serverSend("IMG", 3); | ||||||
|  |         serverSend(imgC->data(), imgC->size()); | ||||||
|  |         serverSend("TRAME", 5); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_POS) { | ||||||
|  |         char buffer[20]; | ||||||
|  |         Position * maPosition = (Position*) data; | ||||||
|  |         sprintf(buffer, "POScenter: %3d;%3d | %.1fTRAME", maPosition->center.x, maPosition->center.y, maPosition->angle); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_MES) { | ||||||
|  |         char buffer[50]; | ||||||
|  |         sprintf(buffer, "MSG%sTRAME", (const char*) data); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_ACK) { | ||||||
|  |         char buffer[50]; | ||||||
|  |         sprintf(buffer, "ACK%sTRAME", (const char*) data); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_BAT) { | ||||||
|  |         char buffer[50]; | ||||||
|  |         sprintf(buffer, "BAT%sTRAME", (const char*) data); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_NO_ACK) { | ||||||
|  |         char buffer[50]; | ||||||
|  |         sprintf(buffer, "NAK%sTRAME", (const char*) data); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else if ((string) typeMessage == HEADER_STM_LOST_DMB) { | ||||||
|  |         char buffer[50]; | ||||||
|  |         sprintf(buffer, "LCD%sTRAME", (const char*) data); | ||||||
|  |         serverSend(buffer, strlen(buffer)); | ||||||
|  |         return 0; | ||||||
|  |     } else { | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int receive_message_from_monitor(char *typeMessage, char *data) { | ||||||
|  |     char buffer[20]; | ||||||
|  |     int tBuffer = receive(buffer); | ||||||
|  |     sscanf(buffer, "%3s:%s", typeMessage, data); | ||||||
|  |     return tBuffer; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int receive(char *data) { | ||||||
|  |     int result; | ||||||
|  |     result = recv(csock, data, 20, 0); | ||||||
|  |     //cout <<"Data : " << data << endl;
 | ||||||
|  |     return result; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int serverSend(const void *data, int dataLength) { | ||||||
|  |     if (send(csock, data, dataLength, 0) != dataLength) { | ||||||
|  |         perror("Send failed : "); | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return true; | ||||||
|  | } | ||||||
							
								
								
									
										115
									
								
								software/raspberry/superviseur-robot/src.sav/monitor.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								software/raspberry/superviseur-robot/src.sav/monitor.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,115 @@ | ||||||
|  | //
 | ||||||
|  | // Created by lucien on 05/04/17.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #ifndef TCPSERVER_H | ||||||
|  | #define TCPSERVER_H | ||||||
|  | 
 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <sys/socket.h> | ||||||
|  | #include <netinet/in.h> | ||||||
|  | #include <arpa/inet.h> | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <signal.h> | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include "image.h" | ||||||
|  | #include "definitions.h" | ||||||
|  | 
 | ||||||
|  | #define HEADER_STM_IMAGE "IMG" // Envoi d'une image
 | ||||||
|  | #define HEADER_STM_BAT "BAT" // Envoi de l'état de la batterie
 | ||||||
|  | #define HEADER_STM_POS "POS" // Envoi de la position
 | ||||||
|  | #define HEADER_STM_NO_ACK "NAK" // Acquittement d'un échec
 | ||||||
|  | #define HEADER_STM_ACK "ACK" // Acquittement d'un succès
 | ||||||
|  | #define HEADER_STM_MES "MSG" // Message textuel
 | ||||||
|  | #define HEADER_STM_LOST_DMB "LCD" // Perte de la communication avec le robot
 | ||||||
|  | 
 | ||||||
|  | #define HEADER_MTS_MSG "MSG" // Message directe pour Console Dumber
 | ||||||
|  | #define HEADER_MTS_DMB_ORDER "DMB" // Message d'ordre pour le robot
 | ||||||
|  | #define HEADER_MTS_COM_DMB "COM" // Message de gestion de la communication avec le robot
 | ||||||
|  | #define HEADER_MTS_CAMERA "CAM" // Message de gestion de la camera
 | ||||||
|  | #define HEADER_MTS_STOP "STO" // Message d'arrêt du system
 | ||||||
|  | 
 | ||||||
|  | #define INVALID_SOCKET -1 | ||||||
|  | #define SOCKET_ERROR -1 | ||||||
|  | 
 | ||||||
|  | #define DEFAULT_PORT  8080 | ||||||
|  | #define DEFAULT_PARITY 0 | ||||||
|  | 
 | ||||||
|  | #define DETECT_ARENA    (1) | ||||||
|  | #define CHECK_ARENA     (2) | ||||||
|  | #define NO_ARENA        (3) | ||||||
|  | 
 | ||||||
|  | #define DEFAULT_NODEJS_PATH "/usr/bin/nodejs" | ||||||
|  | #define DEFAULT_INTERFACE_FILE "./interface.js" | ||||||
|  | 
 | ||||||
|  | #define closesocket(param) close(param) | ||||||
|  | 
 | ||||||
|  | typedef int SOCKET; | ||||||
|  | typedef struct sockaddr_in SOCKADDR_IN; | ||||||
|  | typedef struct sockaddr SOCKADDR; | ||||||
|  | 
 | ||||||
|  | typedef struct { | ||||||
|  |     char header[4]; | ||||||
|  |     char data[100]; | ||||||
|  | } MessageFromMon; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief    Lance nodejs . | ||||||
|  |  * \param    path    chemin de l'executable nodejs (défaut /usr/bin/nodejs) | ||||||
|  |  * \param    file  chemin du fichier de l'interface (défaut ./interface.js) | ||||||
|  |  * \return   retourne 0 si le process a été lancé et -1 sinon. | ||||||
|  |  */ | ||||||
|  | int run_nodejs(const char * path = DEFAULT_NODEJS_PATH, char * file = DEFAULT_INTERFACE_FILE); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief    Tue le process exécutant nodejs. | ||||||
|  |  * \return   retourne 0 en cas de succès et -1 sinon. | ||||||
|  |  */ | ||||||
|  | int kill_nodejs(); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief      Mise en place du serveur (port 8080 par défaut). | ||||||
|  |  * \param    port    numéro du port utilisé par le serveur (8080 par défaut). | ||||||
|  |  * \return   retourne 0 si le serveur est mis en place et -1 en cas de problème. | ||||||
|  |  */ | ||||||
|  | int open_server(int port = DEFAULT_PORT); //public
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief    Ferme le serveur. | ||||||
|  |  * \return   retourne 0 si le serveur est fermé et -1 en cas de problème. | ||||||
|  |  */ | ||||||
|  | int close_server(void); // public
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief    Envoi d'un message vers l'interface graphique | ||||||
|  |  * \param    typeMessage     Type du message envoyé. Les valeurs possibles sont  | ||||||
|  |  * IMG pour une image, MES pour un message à afficher dans la console, POS pour | ||||||
|  |  * la position du robot, BAT pour une valeur de la batterie et ACK pour valider | ||||||
|  |  * un message de l'interface. | ||||||
|  |  * \param  data   données associées au message. Le type de la donnée doit | ||||||
|  |  * correspondre au message : Image pour IMG, char * MES, Position pour POS,  | ||||||
|  |  * char * pour BAT et rien pour ACK. Attention, il n'y a aucune vérification | ||||||
|  |  * a posterio. | ||||||
|  |  * \return   retourne 0 si l'envoie a bien été réalisé et -1 en cas de problème. | ||||||
|  |  */ | ||||||
|  | int send_message_to_monitor(const char* typeMessage, const void * data = NULL); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief    Réception d'un message. La fonction est bloquante et retourne par | ||||||
|  |  * référence le type de message reçu (DMB pour un ordre au robot, ARN pour la | ||||||
|  |  * détection des arènes et POS pour un calcul de position) ainsi que les données | ||||||
|  |  * associées. | ||||||
|  |  * \param    typeMessage     Type du message reçu : DMB pour un ordre au robot,  | ||||||
|  |  * ARN pour la demande de détection de l'arène, POS pour un calcul de position | ||||||
|  |  * et MSG pour un message de l'interface | ||||||
|  |  * \param  data   données associées au message reçu. | ||||||
|  |  * \return   retourne 0 la taille du message reçu ou une valeur négative si la | ||||||
|  |  * connexion est perdue. | ||||||
|  |  */ | ||||||
|  | int receive_message_from_monitor(char *typeMessage, char *data); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #endif // TCPSERVER_H
 | ||||||
|  | @ -1,3 +1,13 @@ | ||||||
|  | /**
 | ||||||
|  |  * \file      robot.cpp | ||||||
|  |  * \author    L.Senaneuch | ||||||
|  |  * \version   1.0 | ||||||
|  |  * \date      06/06/2017 | ||||||
|  |  * \brief     Fonction permettant la communication avec le robot. | ||||||
|  |  * | ||||||
|  |  * \details   Ce fichier regroupe des fonctions facilitant la communication avec le robot en utilisant le port serie USART | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "robot.h" | #include "robot.h" | ||||||
| 
 | 
 | ||||||
| int fd; | int fd; | ||||||
|  | @ -190,19 +200,19 @@ int getChar(char * c) | ||||||
| 
 | 
 | ||||||
| int readSerial(char * msg) | int readSerial(char * msg) | ||||||
| { | { | ||||||
|     char car; |     char car=0; | ||||||
|     int i =0,j=0; |     int i=0; | ||||||
|     for(j = 0 ; j < 20 ; j++) |     for(int j = 0 ; j < 20 ; j++) | ||||||
|         msg[j]=0; |         msg[j]=0; | ||||||
|     while(car !='\r' && car!='\n') |      | ||||||
|     { |     while(car !='\r' && car!='\n') { | ||||||
|         if(i>=20) |         if(i>=20)  | ||||||
|             return -5; |             return -5; | ||||||
| 
 | 
 | ||||||
|         if(getChar(&car)==ROBOT_TIMED_OUT) |         if(getChar(&car)==ROBOT_TIMED_OUT) { | ||||||
|         { |  | ||||||
|             return ROBOT_TIMED_OUT; |             return ROBOT_TIMED_OUT; | ||||||
|         } |         } | ||||||
|  |          | ||||||
|         msg[i] = car; |         msg[i] = car; | ||||||
|         i++; |         i++; | ||||||
|     } |     } | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| /**
 | /**
 | ||||||
|  * \file      serial.h |  * \file      robot.h | ||||||
|  * \author    L.Senaneuch |  * \author    L.Senaneuch | ||||||
|  * \version   1.0 |  * \version   1.0 | ||||||
|  * \date      06/06/2017 |  * \date      06/06/2017 | ||||||
							
								
								
									
										349
									
								
								software/raspberry/superviseur-robot/src/Robot.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										349
									
								
								software/raspberry/superviseur-robot/src/Robot.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,349 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \file      robot.cpp | ||||||
|  |  * \author    L.Senaneuch | ||||||
|  |  * \version   1.0 | ||||||
|  |  * \date      06/06/2017 | ||||||
|  |  * \brief     Fonction permettant la communication avec le robot. | ||||||
|  |  * | ||||||
|  |  * \details   Ce fichier regroupe des fonctions facilitant la communication avec le robot en utilisant le port serie USART | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "Robot.h" | ||||||
|  | 
 | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <fcntl.h> | ||||||
|  | #include <termios.h> | ||||||
|  | 
 | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include "definitions.h" | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | #define ROBOT_CMD_ENDING_CHAR           '\r' | ||||||
|  | 
 | ||||||
|  | #define ROBOT_CMD_PING                  'p' | ||||||
|  | #define ROBOT_CMD_RESET                 'r' | ||||||
|  | #define ROBOT_CMD_START_WITHOUT_WD      'u' | ||||||
|  | #define ROBOT_CMD_START_WITH_WD         'W' | ||||||
|  | #define ROBOT_CMD_RELOAD_WD             'w' | ||||||
|  | #define ROBOT_CMD_GET_VBAT              'v' | ||||||
|  | #define ROBOT_CMD_IS_BUSY               'b' | ||||||
|  | #define ROBOT_CMD_MOVE                  'M' | ||||||
|  | #define ROBOT_CMD_TURN                  'T' | ||||||
|  | #define ROBOT_CMD_GET_VERSION           'V' | ||||||
|  | #define ROBOT_CMD_POWER_OFF             'z' | ||||||
|  | 
 | ||||||
|  | #define ROBOT_CMD_OK_ANS                "O" | ||||||
|  | #define ROBOT_CMD_ERR_ANS               "E" | ||||||
|  | #define ROBOT_CMD_UNKNOW_ANS            "C" | ||||||
|  | 
 | ||||||
|  | const string Robot::InvalidAnswerException = "Invalid answer exception"; | ||||||
|  | 
 | ||||||
|  | Robot::Robot() { | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | Robot::~Robot() { | ||||||
|  |     this->Close(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Robot::Open() { | ||||||
|  |     return Serial::Open(DEFAULT_SERIAL_PORT,9600); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Robot::Open(const char *path) { | ||||||
|  |     return Serial::Open(path,9600); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Robot::Close() { | ||||||
|  |     return Serial::Close(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int Robot::GetLastCommandStatus() { | ||||||
|  |     return this->lastCommandStatus; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::Ping() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_PING), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::Reset() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_RESET), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::StartWithoutWatchdog() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_START_WITHOUT_WD), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::StartWithWatchdog() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_START_WITH_WD), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::ResetWatchdog() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_RELOAD_WD), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::Move(int distance) { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_MOVE) + "="+to_string(distance), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::Turn(int angle) { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_TURN) + "="+to_string(angle), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::PowerOff() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_POWER_OFF), &ans); | ||||||
|  | 
 | ||||||
|  |     CheckAnswer(ans); | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Robot::GetBatteryLevel() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  | 
 | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_GET_VBAT), &ans); | ||||||
|  |     lastCommandStatus=SUCCESS; | ||||||
|  | 
 | ||||||
|  |     if (ans.length()==1) { | ||||||
|  |         if ((ans[0] != '2') && (ans[0] != '1') && (ans[0] != '0')) { | ||||||
|  |             lastCommandStatus=INVALID_ANSWER; | ||||||
|  |             throw (InvalidAnswerException + " raised in Robot::GetBatteryLevel. Invalid battery value (" + ans[0] +")\n"); | ||||||
|  |         } | ||||||
|  |     } else { | ||||||
|  |         lastCommandStatus=INVALID_ANSWER; | ||||||
|  |         throw (InvalidAnswerException + " raised in Robot::GetBatteryLevel. Invalid answer length (" + to_string(ans.length())+")\n"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return ans[0]; | ||||||
|  | #else | ||||||
|  |     return BATTERY_FULL; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | string Robot::GetVersion() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  | 
 | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_GET_VERSION), &ans); | ||||||
|  |     lastCommandStatus=SUCCESS; | ||||||
|  | 
 | ||||||
|  |     if (ans.find("version")== string::npos) { | ||||||
|  |         lastCommandStatus=INVALID_ANSWER; | ||||||
|  |         throw (InvalidAnswerException + " raised in Robot::GetVersion. Invalid version (" + ans +")\n"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return ans; | ||||||
|  | #else | ||||||
|  |     return "1.3"; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool Robot::IsBusy() { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     string ans; | ||||||
|  | 
 | ||||||
|  |     SendCommand(string(1,ROBOT_CMD_IS_BUSY), &ans); | ||||||
|  |     lastCommandStatus=SUCCESS; | ||||||
|  | 
 | ||||||
|  |     if (ans.length()!=1) { | ||||||
|  |         lastCommandStatus=INVALID_ANSWER; | ||||||
|  |         throw (InvalidAnswerException + " raised in Robot::GetBatteryLevel. Invalid answer length (" + to_string(ans.length())+")\n"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if (ans[0]=='1') | ||||||
|  |         return true; | ||||||
|  |     else if (ans[0]=='0') | ||||||
|  |         return false; | ||||||
|  |     else { | ||||||
|  |         lastCommandStatus=INVALID_ANSWER; | ||||||
|  |         throw (InvalidAnswerException + " raised in Robot::IsBusy. Invalid value (" + ans[0] +")\n"); | ||||||
|  |     } | ||||||
|  | #else | ||||||
|  |     return false; | ||||||
|  | #endif /* __STUB__ */ | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::CommunicationProlog() {} | ||||||
|  | void Robot::CommunicationEpilog() {} | ||||||
|  | 
 | ||||||
|  | /****************************/ | ||||||
|  | /* PRIVATE                  */ | ||||||
|  | /****************************/ | ||||||
|  | 
 | ||||||
|  | char Robot::SendCommand(string cmd, string *ans) { | ||||||
|  |     string commandString; | ||||||
|  |     commandString = this->AddChecksum(cmd); | ||||||
|  | 
 | ||||||
|  |     this->CommunicationProlog(); // action avant le debut de la commande
 | ||||||
|  | 
 | ||||||
|  |     ssize_t status = Send(commandString); | ||||||
|  | 
 | ||||||
|  |     if (status == (ssize_t)commandString.length()) { | ||||||
|  |         // Recuperation de la reponse
 | ||||||
|  |         string commandResponse; | ||||||
|  |         vector<char> endingChars; | ||||||
|  | 
 | ||||||
|  |         endingChars.push_back('\r'); | ||||||
|  |         try { | ||||||
|  |             commandResponse = Serial::Receive(endingChars,30); | ||||||
|  |         } catch (string e) { | ||||||
|  |             if (e.find("Timeout")!= string::npos) | ||||||
|  |                 lastCommandStatus= TIMEOUT_COMMAND; | ||||||
|  |             else | ||||||
|  |                 lastCommandStatus=INVALID_ANSWER; | ||||||
|  | 
 | ||||||
|  |             if (lastCommandStatus == TIMEOUT_COMMAND) | ||||||
|  |                 throw (Serial::TimeoutException + " raised in Robot::SendCommand. Timeout while receiving answer from robot.\n"); | ||||||
|  |             else | ||||||
|  |                 throw (e + " raised in Robot::SendCommand.\n"); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         this->CommunicationEpilog(); // Action a faire apres la commande
 | ||||||
|  | 
 | ||||||
|  |         if (ValidateChecksum(&commandResponse, commandResponse)) { | ||||||
|  |             ans->assign(commandResponse); | ||||||
|  |         } else { | ||||||
|  |             lastCommandStatus = INVALID_ANSWER; | ||||||
|  |             throw InvalidAnswerException; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         lastCommandStatus=SUCCESS; | ||||||
|  |     } else { | ||||||
|  |         lastCommandStatus=INVALID_COMMUNICATION_PORT; | ||||||
|  | 
 | ||||||
|  |         throw IOErrorException; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return lastCommandStatus; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void Robot::CheckAnswer(string ans) { | ||||||
|  | 
 | ||||||
|  |     if (ans.length()==1) | ||||||
|  |     { | ||||||
|  |         switch (ans.at(0)) { | ||||||
|  |             case 'o': | ||||||
|  |             case 'O': | ||||||
|  |                 lastCommandStatus=SUCCESS; | ||||||
|  |                 break; | ||||||
|  |             case 'e': | ||||||
|  |             case 'E': | ||||||
|  |                 lastCommandStatus=REJECTED_COMMAND; | ||||||
|  |                 break; | ||||||
|  |             case 'c': | ||||||
|  |             case 'C': | ||||||
|  |                 lastCommandStatus=INVALID_COMMAND; | ||||||
|  |                 break; | ||||||
|  |             default: | ||||||
|  |                 lastCommandStatus = INVALID_ANSWER; | ||||||
|  |                 throw InvalidAnswerException; | ||||||
|  |         } | ||||||
|  |     } else { | ||||||
|  |         lastCommandStatus = INVALID_ANSWER; | ||||||
|  |         throw InvalidAnswerException; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | string Robot::AddChecksum(string cmd) { | ||||||
|  |     string commandWithChecksum(cmd); | ||||||
|  |     char checksum=0; | ||||||
|  | 
 | ||||||
|  |     commandWithChecksum.resize(cmd.length()+2, ' '); | ||||||
|  | 
 | ||||||
|  |     for (size_t i=0; i<commandWithChecksum.length()-2; i++) { | ||||||
|  |         checksum = checksum^commandWithChecksum.at(i); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     commandWithChecksum.at(commandWithChecksum.length()-2) = checksum; | ||||||
|  |     commandWithChecksum.at(commandWithChecksum.length()-1) = '\r'; | ||||||
|  | 
 | ||||||
|  |     return commandWithChecksum; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool Robot::ValidateChecksum(string *answerWithoutChecksum, string answer) { | ||||||
|  |     string localAnswer(answer, 0, answer.length()-1); // recopie de la chaine initiale, sans le dernier caractere (checksum)
 | ||||||
|  |     char checksum=0; | ||||||
|  |     bool status=false; | ||||||
|  | 
 | ||||||
|  |     if (answer.length()<2) // trop court pour contenir un checksum
 | ||||||
|  |         throw InvalidAnswerException; | ||||||
|  |     else { | ||||||
|  |         for (size_t i=0; i< answer.length()-1; i++) { | ||||||
|  |             checksum = checksum^answer.at(i); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (answer.at(answer.length()-1) == checksum) { | ||||||
|  |             status=true; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     answerWithoutChecksum->assign(localAnswer); | ||||||
|  |     return status; | ||||||
|  | } | ||||||
							
								
								
									
										84
									
								
								software/raspberry/superviseur-robot/src/Robot.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								software/raspberry/superviseur-robot/src/Robot.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,84 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | /**
 | ||||||
|  |  * \file      robot.h | ||||||
|  |  * \author    L.Senaneuch | ||||||
|  |  * \version   1.0 | ||||||
|  |  * \date      06/06/2017 | ||||||
|  |  * \brief     Fonction permettant la communication avec le robot. | ||||||
|  |  * | ||||||
|  |  * \details   Ce fichier regroupe des fonctions facilitant la communication avec le robot en utilisant le port serie USART | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef __ROBOT_H__ | ||||||
|  | #define __ROBOT_H__ | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include <string> | ||||||
|  | #include <Serial.h> | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | #define REJECTED_COMMAND                    -3 | ||||||
|  | #define INVALID_COMMAND                     -4 | ||||||
|  | #define TIMEOUT_COMMAND                     -5 | ||||||
|  | #define INVALID_ANSWER                      -6 | ||||||
|  | 
 | ||||||
|  | #define BATTERY_FULL                        2 | ||||||
|  | #define BATTERY_LOW                         1 | ||||||
|  | #define BATTERY_EMPTY                       0 | ||||||
|  | 
 | ||||||
|  | class Robot : public Serial { | ||||||
|  |     public: | ||||||
|  |         Robot(); | ||||||
|  |         virtual ~Robot(); | ||||||
|  | 
 | ||||||
|  |         char Open(); | ||||||
|  |         char Open(const char *path); | ||||||
|  |         char Close(); | ||||||
|  | 
 | ||||||
|  |         int GetLastCommandStatus(); | ||||||
|  | 
 | ||||||
|  |         void Ping(); | ||||||
|  |         void Reset(); | ||||||
|  | 
 | ||||||
|  |         void StartWithoutWatchdog(); | ||||||
|  |         void StartWithWatchdog(); | ||||||
|  |         void ResetWatchdog(); | ||||||
|  | 
 | ||||||
|  |         void Move(int distance); | ||||||
|  |         void Turn(int angle); | ||||||
|  | 
 | ||||||
|  |         void PowerOff(); | ||||||
|  | 
 | ||||||
|  |         char GetBatteryLevel(); | ||||||
|  |         string GetVersion(); | ||||||
|  |         bool IsBusy(); | ||||||
|  | 
 | ||||||
|  |         // Ces deux methodes virtuelles sont a redefinir (surcharger) dans une classe qui etends la classe Robot
 | ||||||
|  |         // Servez vous en pour faire une action avant (prologue) ou apres (epilogue) une commande au robot
 | ||||||
|  |         virtual void CommunicationProlog(); | ||||||
|  |         virtual void CommunicationEpilog(); | ||||||
|  | 
 | ||||||
|  |         static const string InvalidAnswerException; | ||||||
|  |     private: | ||||||
|  | 
 | ||||||
|  |         int lastCommandStatus; | ||||||
|  | 
 | ||||||
|  |         char SendCommand(string cmd, string *ans); | ||||||
|  |         string AddChecksum(string cmd); | ||||||
|  |         bool ValidateChecksum(string *answerWithoutChecksum, string answer); | ||||||
|  |         void CheckAnswer(string ans); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif //__ROBOT_H__
 | ||||||
							
								
								
									
										164
									
								
								software/raspberry/superviseur-robot/src/Serial.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								software/raspberry/superviseur-robot/src/Serial.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,164 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Part of code Copyright ST Microelectronics. | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | 
 | ||||||
|  | #include <Serial.h> | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <fcntl.h> | ||||||
|  | #include <termios.h> | ||||||
|  | 
 | ||||||
|  | #include <stdlib.h> | ||||||
|  | 
 | ||||||
|  | #include <algorithm> | ||||||
|  | 
 | ||||||
|  | const string Serial::TimeoutException = "Timeout exception"; | ||||||
|  | const string Serial::IOErrorException = "IO error exception"; | ||||||
|  | const string Serial::BufferOverflowException = "Buffer overflow exception"; | ||||||
|  | 
 | ||||||
|  | Serial::Serial() { | ||||||
|  |     this->serialPortDescriptor=-1; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | Serial::~Serial() { | ||||||
|  |     this->Close(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Serial::Open(void) { | ||||||
|  |     return this->Open(DEFAULT_SERIAL_PORT, DEFAULT_BAUDRATE); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Serial::Open(int baudrate) { | ||||||
|  |     return this->Open(DEFAULT_SERIAL_PORT, baudrate); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Serial::Open(const char *path, int baudrate) { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     struct termios options; | ||||||
|  | 
 | ||||||
|  |     if (this->IsOpen() == true) return COMMUNICATION_PORT_ALREADY_OPENED; | ||||||
|  | 
 | ||||||
|  |     this->serialPortDescriptor = open(path, O_RDWR | O_NOCTTY | O_NDELAY); | ||||||
|  | 
 | ||||||
|  |     if(this->serialPortDescriptor >= 0) { | ||||||
|  |         fcntl(this->serialPortDescriptor, F_SETFL, 0); | ||||||
|  |         tcgetattr(this->serialPortDescriptor, &options); | ||||||
|  |         options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); | ||||||
|  |         cfsetospeed (&options, this->SetBaudrate(baudrate)); | ||||||
|  |         cfsetispeed (&options, this->SetBaudrate(baudrate)); | ||||||
|  |         options.c_cc[VMIN]=0; | ||||||
|  |         options.c_cc[VTIME]=10; | ||||||
|  |         tcsetattr(this->serialPortDescriptor, TCSANOW, &options); | ||||||
|  | 
 | ||||||
|  |         return SUCCESS; | ||||||
|  |     } | ||||||
|  |     else { | ||||||
|  |         std::cerr << "[Robot::Open] Can't open port " << path; | ||||||
|  |         return INVALID_COMMUNICATION_PORT; | ||||||
|  |     } | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Serial::Close(void) { | ||||||
|  | #ifndef __STUB__ | ||||||
|  |     if (this->serialPortDescriptor<0) { | ||||||
|  |         if (close(this->serialPortDescriptor) == 0) | ||||||
|  |             return SUCCESS; | ||||||
|  |         else return INVALID_COMMUNICATION_PORT; | ||||||
|  |     } else return SUCCESS; | ||||||
|  | #else | ||||||
|  |     return SUCCESS; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool Serial::IsOpen() { | ||||||
|  |     if(this->serialPortDescriptor >= 0) | ||||||
|  |         return true; | ||||||
|  |     else | ||||||
|  |         return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ssize_t Serial::Send(string mes) { | ||||||
|  |     ssize_t n; | ||||||
|  | 
 | ||||||
|  |     n=write(this->serialPortDescriptor, (void*)mes.c_str(), mes.length()); | ||||||
|  | 
 | ||||||
|  |     if (n< (ssize_t)mes.length()) | ||||||
|  |         throw (IOErrorException + " raised in Serial::Send. Requested to send " + to_string(mes.length()) + " characters, sent only " + to_string(n) +"\n"); | ||||||
|  |     else | ||||||
|  |         return n; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | string Serial::Receive(int size) { | ||||||
|  |     string mes; | ||||||
|  | 
 | ||||||
|  |     while(mes.length() < (unsigned int)size){ | ||||||
|  |         mes += this->GetChar(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return mes; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | string Serial::Receive(vector<char> endingChars,int maxLength) { | ||||||
|  |     string mes; | ||||||
|  |     char c; | ||||||
|  | 
 | ||||||
|  |     bool characterFound = false; | ||||||
|  | 
 | ||||||
|  |     do { | ||||||
|  |         c= GetChar(); | ||||||
|  | 
 | ||||||
|  |         if (std::find(endingChars.begin(), endingChars.end(), c)!=endingChars.end()) //recherche du caractere dans la liste des caractere de fin
 | ||||||
|  |             characterFound=true; | ||||||
|  |         else { | ||||||
|  |             mes += c; | ||||||
|  |         } | ||||||
|  |     } while ((mes.length()<(unsigned int)maxLength) && (characterFound==false)); | ||||||
|  | 
 | ||||||
|  |     if (mes.length()>=(unsigned int)maxLength) { | ||||||
|  |         throw (BufferOverflowException + " raised in Serial::Receive. Received data exceed " + to_string(maxLength) + "chars\n"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return mes; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int Serial::SetBaudrate(int baudrate) { | ||||||
|  |     switch(baudrate){ | ||||||
|  |         case 4800: | ||||||
|  |             return baudrate = B4800; | ||||||
|  |         case 9600: | ||||||
|  |             return baudrate = B9600; | ||||||
|  |         case 38400: | ||||||
|  |             return baudrate = B38400; | ||||||
|  |         case 57600: | ||||||
|  |             return baudrate = B57600; | ||||||
|  |         case 115200: | ||||||
|  |             return baudrate = B115200; | ||||||
|  |         default: | ||||||
|  |             std::cerr << "Baudrate not supported" << std::endl; | ||||||
|  |             return -1; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | char Serial::GetChar() { | ||||||
|  |     char c; | ||||||
|  | 
 | ||||||
|  |     if (read(this->serialPortDescriptor, &c, 1) > 0) | ||||||
|  |         return c; | ||||||
|  |     else | ||||||
|  |         throw (TimeoutException + " raised in Serial::GetChar\n"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
							
								
								
									
										49
									
								
								software/raspberry/superviseur-robot/src/Serial.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								software/raspberry/superviseur-robot/src/Serial.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,49 @@ | ||||||
|  | /*
 | ||||||
|  |  * Serial.h | ||||||
|  |  * | ||||||
|  |  *  Created on: 12 oct. 2018 | ||||||
|  |  *      Author: dimercur | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef SERIAL_H_ | ||||||
|  | #define SERIAL_H_ | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include <string> | ||||||
|  | #include <vector> | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | #define SUCCESS                             0 | ||||||
|  | #define INVALID_COMMUNICATION_PORT          -1 | ||||||
|  | #define COMMUNICATION_PORT_ALREADY_OPENED   -2 | ||||||
|  | 
 | ||||||
|  | #define DEFAULT_SERIAL_PORT             "/dev/ttyS0" | ||||||
|  | #define DEFAULT_BAUDRATE                9600 | ||||||
|  | 
 | ||||||
|  | class Serial { | ||||||
|  |     public: | ||||||
|  |         static const string TimeoutException; | ||||||
|  |         static const string IOErrorException; | ||||||
|  |         static const string BufferOverflowException; | ||||||
|  | 
 | ||||||
|  |         Serial(); | ||||||
|  |         virtual ~Serial(); | ||||||
|  | 
 | ||||||
|  |         char Open(void); | ||||||
|  |         char Open(int baudrate); | ||||||
|  |         char Open(const char *path, int baudrate); | ||||||
|  |         char Close(void); | ||||||
|  | 
 | ||||||
|  |         bool IsOpen(); | ||||||
|  |         ssize_t Send(string mes); | ||||||
|  |         string Receive(int size); | ||||||
|  |         string Receive(vector<char> endingChars, int maxLength); | ||||||
|  | 
 | ||||||
|  |     private: | ||||||
|  |         int serialPortDescriptor; | ||||||
|  |         int SetBaudrate(int baudrate); | ||||||
|  |         char GetChar(); // read 1 char
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif /* SERIAL_H_ */ | ||||||
							
								
								
									
										93
									
								
								software/raspberry/superviseur-robot/src/TcpServer.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										93
									
								
								software/raspberry/superviseur-robot/src/TcpServer.cpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,93 @@ | ||||||
|  | /*******************************************************************************
 | ||||||
|  |  * Copyright (c) 2018 INSA - GEI, Toulouse, France. | ||||||
|  |  * All rights reserved. This program and the accompanying materials | ||||||
|  |  * are made available "AS IS", without any warranty of any kind. | ||||||
|  |  * | ||||||
|  |  * INSA assumes no responsibility for errors or omissions in the  | ||||||
|  |  * software or documentation available.  | ||||||
|  |  * | ||||||
|  |  * Part of code Copyright ST Microelectronics. | ||||||
|  |  * | ||||||
|  |  * Contributors: | ||||||
|  |  *     Lucien Senaneuch - Initial API and implementation | ||||||
|  |  *     Sebastien DI MERCURIO - Maintainer since Octobre 2018 | ||||||
|  |  *******************************************************************************/ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #include "TcpServer.h" | ||||||
|  | #include <netinet/in.h> | ||||||
|  | #include <zconf.h> | ||||||
|  | #include <vector> | ||||||
|  | 
 | ||||||
|  | TcpServer::TcpServer() { | ||||||
|  |     this->socketFD = -1; | ||||||
|  |     this->socketClients.clear(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int TcpServer::Listen (int port) { | ||||||
|  |     struct sockaddr_in server; | ||||||
|  | 
 | ||||||
|  |     this->socketFD = socket(AF_INET, SOCK_STREAM, 0); | ||||||
|  |     if(this->socketFD < 0){ | ||||||
|  |         throw invalid_argument("Can not create socket"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     server.sin_addr.s_addr = INADDR_ANY; | ||||||
|  |     server.sin_family = AF_INET; | ||||||
|  |     server.sin_port = htons(port); | ||||||
|  | 
 | ||||||
|  |     if(bind(this->socketFD, (struct sockaddr *) &server, sizeof(server)) < 0) { | ||||||
|  |         throw invalid_argument("Can not bind socket"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     listen(this->socketFD , NB_CONNECTION_MAX); | ||||||
|  | 
 | ||||||
|  |     return this->socketFD; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int TcpServer::AcceptClient() { | ||||||
|  |     struct sockaddr_in client; | ||||||
|  |     int c = sizeof(struct sockaddr_in); | ||||||
|  | 
 | ||||||
|  |     int fd = accept(this->socketFD,(struct sockaddr *) &client, (socklen_t*)&c); | ||||||
|  | 
 | ||||||
|  |     if (fd >=0 ) | ||||||
|  |         this->socketClients.push_back(fd); | ||||||
|  |     else throw invalid_argument("Accept failed in TcpServer::AcceptClient"); | ||||||
|  | 
 | ||||||
|  |     return fd; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int TcpServer::Send(int client, string mes) { | ||||||
|  |     return write(client, mes.c_str(), mes.size()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | string TcpServer::Receive(int client_fd, int size){ | ||||||
|  |     char tab[size]; | ||||||
|  | 
 | ||||||
|  |     if(recv(client_fd,tab,size,0) >0) { | ||||||
|  |         tab[size] = 0; | ||||||
|  |         return string(tab); | ||||||
|  |     } else | ||||||
|  |         return string(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | int TcpServer::Broadcast(string mes) { | ||||||
|  |     for (int socket : this->socketClients) { | ||||||
|  |         int err = write(socket, mes.c_str(), mes.size()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const vector<int> &TcpServer::getSocketClients() const { | ||||||
|  |     return socketClients; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void TcpServer::SetSocketClients(const std::vector<int> &socketClients) { | ||||||
|  |     this->socketClients = socketClients; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | TcpServer::~TcpServer() { | ||||||
|  |     close(this->socketFD); | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								software/raspberry/superviseur-robot/src/TcpServer.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								software/raspberry/superviseur-robot/src/TcpServer.h
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | //
 | ||||||
|  | // Created by senaneuc on 12/06/18.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #ifndef TCP_SERVER_H_ | ||||||
|  | #define TCP_SERVER_H_ | ||||||
|  | 
 | ||||||
|  | #define NB_CONNECTION_MAX 5 | ||||||
|  | 
 | ||||||
|  | #include <iostream> | ||||||
|  | #include <vector> | ||||||
|  | 
 | ||||||
|  | using namespace std; | ||||||
|  | 
 | ||||||
|  | class TcpServer { | ||||||
|  | public: | ||||||
|  |     TcpServer(); | ||||||
|  |     virtual ~TcpServer(); | ||||||
|  | 
 | ||||||
|  |     int Listen (int port); | ||||||
|  |     int AcceptClient(); | ||||||
|  |     int Send(int clien_fd, string mes); | ||||||
|  |     int Broadcast(string mes); | ||||||
|  |     string Receive(int client_fd, int size); | ||||||
|  | 
 | ||||||
|  |     const vector<int> &getSocketClients() const; | ||||||
|  | 
 | ||||||
|  |     void SetSocketClients(const vector<int> &socketClients); | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     vector<int> socketClients; | ||||||
|  |     int socketFD; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif /* TCP_SERVER_H_ */ | ||||||
|  | @ -14,30 +14,6 @@ | ||||||
| #ifndef DEFINITIONS_H | #ifndef DEFINITIONS_H | ||||||
| #define DEFINITIONS_H | #define DEFINITIONS_H | ||||||
| 
 | 
 | ||||||
| #define OPEN_COM_DMB  'o' |  | ||||||
| #define CLOSE_COM_DMB 'C' |  | ||||||
| 
 |  | ||||||
| #define DMB_PING                'p' |  | ||||||
| #define DMB_IDLE                'r' |  | ||||||
| #define DMB_START_WITHOUT_WD    'u' |  | ||||||
| #define DMB_START_WITH_WD       'W' |  | ||||||
| #define DMB_RELOAD_WD           'w' |  | ||||||
| #define DMB_GET_VBAT            'v' |  | ||||||
| #define DMB_IS_BUSY             'b' |  | ||||||
| #define DMB_MOVE                'M' |  | ||||||
| #define DMB_TURN                'T' |  | ||||||
| #define DMB_GO_FORWARD          'F' |  | ||||||
| #define DMB_GO_BACK             'B' |  | ||||||
| #define DMB_GO_LEFT             'L' |  | ||||||
| #define DMB_GO_RIGHT            'R' |  | ||||||
| #define DMB_STOP_MOVE           'S' |  | ||||||
| 
 |  | ||||||
| #define ROBOT_TIMED_OUT -3 |  | ||||||
| #define ROBOT_UKNOWN_CMD -2 |  | ||||||
| #define ROBOT_ERROR  -1 |  | ||||||
| #define ROBOT_CHECKSUM  -4 |  | ||||||
| #define ROBOT_OK    0 |  | ||||||
| 
 |  | ||||||
| #define CAM_OPEN                    'A' | #define CAM_OPEN                    'A' | ||||||
| #define CAM_CLOSE                   'I' | #define CAM_CLOSE                   'I' | ||||||
| #define CAM_ASK_ARENA               'y' | #define CAM_ASK_ARENA               'y' | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| /**
 | /**
 | ||||||
|  * \file      imagerie.cpp |  * \file      image.cpp | ||||||
|  * \author    L.Senaneuch |  * \author    L.Senaneuch | ||||||
|  * \version   1.0 |  * \version   1.0 | ||||||
|  * \date      06/06/2017 |  * \date      06/06/2017 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| /**
 | /**
 | ||||||
|  * \file      imagerie.h |  * \file      image.h | ||||||
|  * \author    L.Senaneuch |  * \author    L.Senaneuch | ||||||
|  * \version   1.0 |  * \version   1.0 | ||||||
|  * \date      06/06/2017 |  * \date      06/06/2017 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue