Last commit to branch master.

after that next commits will be in branch dev or stable
This commit is contained in:
Sébastien DI MERCURIO 2018-10-19 10:53:20 +02:00
parent 6bf2742136
commit 2451177ccd
41 changed files with 2211 additions and 841 deletions

View file

@ -1,2 +1,11 @@
build/
src.sav/
cmake-build-debug/
futur/
build/
CMakeFiles/
Makefile
*.cmake
CMakeCache.txt

View file

@ -0,0 +1 @@
ProjDestijl

View file

@ -0,0 +1,29 @@
<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>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/superviseur-robot.iml" filepath="$PROJECT_DIR$/.idea/superviseur-robot.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

View file

@ -0,0 +1,864 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" shouldDeleteObsolete="true" buildAllGenerated="true">
<generated>
<config projectName="ProjDestijl" targetName="superviseur" />
<config projectName="ProjDestijl" targetName="destijl" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="true">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="4c044020-a391-4234-8366-64abd3f0f464" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/superviseur-pthread/CMakeLists.txt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/superviseur-pthread/src/Program.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/superviseur-pthread/src/Tasks.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/superviseur-pthread/src/Tasks.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/destijl_init/Makefile" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/examples/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/examples/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/lib/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/Robot.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/Serial.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/TcpServer.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/definitions.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/image.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/message.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/monitor.h" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/Robot.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/Serial.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/TcpServer.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/image.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/message.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/monitor.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/superviseur-xenomai/src/Program.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/superviseur-xenomai/src/Tasks.cpp" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/superviseur-xenomai/src/Tasks.h" beforeDir="false" />
</list>
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
<ignored path="$PROJECT_DIR$/CMakeFiles/" />
<ignored path="$PROJECT_DIR$/superviseur/CMakeFiles/" />
<ignored path="$PROJECT_DIR$/lib/CMakeFiles/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" 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="FUSProjectUsageTrigger">
<session id="-329952360">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="2" />
<entry key="project.open.time.3" value="1" />
<entry key="project.open.time.9" value="1" />
<entry key="project.opened" value="2" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="cmake" value="1" />
<entry key="cpp" value="36" />
<entry key="gitignore" value="1" />
<entry key="h" value="18" />
<entry key="txt" value="20" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="CMakeLists.txt" value="21" />
<entry key="ObjectiveC" value="54" />
<entry key="PLAIN_TEXT" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="cpp" value="3165" />
<entry key="gitignore" value="19" />
<entry key="h" value="1381" />
<entry key="txt" value="1035" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="CMakeLists.txt" value="1035" />
<entry key="Doxygen file" value="2" />
<entry key="ObjectiveC" value="4544" />
<entry key="PLAIN_TEXT" value="19" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="81" selection-start-column="81" selection-end-column="81" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/image.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="17" selection-start-line="17" selection-end-line="17" />
<folding>
<element signature="e#566#599#0" expanded="true" />
<element signature="e#635#673#0" expanded="true" />
<element signature="e#865#890#0" expanded="true" />
<element signature="e#935#962#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/message.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="27" column="32" selection-start-line="27" selection-start-column="32" selection-end-line="27" selection-end-column="32" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/monitor.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="64" column="94" selection-start-line="64" selection-start-column="94" selection-end-line="64" selection-end-column="94" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/monitor.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="338">
<caret line="104" column="23" selection-start-line="104" selection-start-column="23" selection-end-line="104" selection-end-column="23" />
</state>
</provider>
</entry>
</file>
<file 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="330">
<caret line="22" selection-start-line="22" selection-end-line="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/superviseur/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/superviseur/src/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="89" column="13" selection-start-line="89" selection-start-column="13" selection-end-line="89" selection-end-column="13" />
<folding>
<element signature="e#88#106#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/superviseur/src/functions.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="51" column="21" selection-start-line="51" selection-start-column="12" selection-end-line="51" selection-end-column="21" />
<folding>
<element signature="e#319#337#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/superviseur/src/functions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="19" selection-start-line="20" selection-start-column="19" selection-end-line="20" selection-end-column="19" />
</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$/.gitignore" />
<option value="$PROJECT_DIR$/lib/Definition.h" />
<option value="$PROJECT_DIR$/lib/src/Robot.cpp" />
<option value="$PROJECT_DIR$/lib/Image.h" />
<option value="$PROJECT_DIR$/lib/Camera.h" />
<option value="$PROJECT_DIR$/lib/src/Camera.cpp" />
<option value="$PROJECT_DIR$/lib/src/Image.cpp" />
<option value="$PROJECT_DIR$/destijl_init/CMakeLists.txt" />
<option value="$PROJECT_DIR$/monitor/CMakeLists.txt" />
<option value="$PROJECT_DIR$/monitor/src/functions.h" />
<option value="$PROJECT_DIR$/monitor/src/main.cpp" />
<option value="$PROJECT_DIR$/monitor-pc/CMakeLists.txt" />
<option value="$PROJECT_DIR$/monitor-pc/src/functions.cpp" />
<option value="$PROJECT_DIR$/monitor-pc/src/functions.h" />
<option value="$PROJECT_DIR$/monitor-pc/src/main.cpp" />
<option value="$PROJECT_DIR$/monitor-pthread/CMakeLists.txt" />
<option value="$PROJECT_DIR$/superviseur-pthread/src/Functions.h" />
<option value="$PROJECT_DIR$/superviseur-pthread/src/Functions.cpp" />
<option value="$PROJECT_DIR$/lib/src/TcpServer.cpp" />
<option value="$PROJECT_DIR$/lib/TcpServer.h" />
<option value="$PROJECT_DIR$/lib/src/Messages.cpp" />
<option value="$PROJECT_DIR$/lib/Messages.h" />
<option value="$PROJECT_DIR$/superviseur-pthread/src/Tasks.h" />
<option value="$PROJECT_DIR$/superviseur-pthread/src/Program.cpp" />
<option value="$PROJECT_DIR$/superviseur-pthread/src/Tasks.cpp" />
<option value="$PROJECT_DIR$/superviseur-pthread/CMakeLists.txt" />
<option value="$PROJECT_DIR$/examples/CMakeLists.txt" />
<option value="$PROJECT_DIR$/superviseur-xenomai/CMakeLists.txt" />
<option value="$PROJECT_DIR$/superviseur-xenomai/src/Program.cpp" />
<option value="$PROJECT_DIR$/lib/MsgManager.h" />
<option value="$PROJECT_DIR$/superviseur-xenomai/src/Tasks.cpp" />
<option value="$PROJECT_DIR$/superviseur-xenomai/src/Tasks.h" />
<option value="$PROJECT_DIR$/lib/CMakeLists.txt" />
<option value="$PROJECT_DIR$/lib/image.h" />
<option value="$PROJECT_DIR$/lib/src/message.cpp" />
<option value="$PROJECT_DIR$/lib/monitor.h" />
<option value="$PROJECT_DIR$/lib/src/monitor.cpp" />
<option value="$PROJECT_DIR$/superviseur/src/functions.h" />
<option value="$PROJECT_DIR$/superviseur/src/functions.cpp" />
<option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/superviseur/src/main.cpp" />
<option value="$PROJECT_DIR$/superviseur/CMakeLists.txt" />
</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="OCFindUsagesOptions" text="true" ivars="false" properties="true" derivedClasses="false" />
<component name="ProjectFrameBounds">
<option name="x" value="260" />
<option name="y" value="101" />
<option name="width" value="1660" />
<option name="height" value="1088" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="ProjDestijl" type="b2602c69:ProjectViewProjectNode" />
<item name="superviseur-robot" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ProjDestijl" type="b2602c69:ProjectViewProjectNode" />
<item name="superviseur-robot" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ProjDestijl" type="b2602c69:ProjectViewProjectNode" />
<item name="superviseur-robot" type="462c0819:PsiDirectoryNode" />
<item name="superviseur" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ProjDestijl" type="b2602c69:ProjectViewProjectNode" />
<item name="superviseur-robot" type="462c0819:PsiDirectoryNode" />
<item name="superviseur" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="ProjDestijl" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/superviseur/bin/superviseur" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.General" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/destijl_init" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/lib" />
<recent name="$PROJECT_DIR$/destijl_init/src" />
</key>
</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.superviseur">
<configuration name="Build All" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" EXPLICIT_BUILD_TARGET_NAME="all">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="destijl" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ProjDestijl" TARGET_NAME="destijl" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="superviseur" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ProjDestijl" TARGET_NAME="superviseur" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="ProjDestijl" RUN_TARGET_NAME="superviseur">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="Application.Build All" />
<item itemvalue="Application.destijl" />
<item itemvalue="Application.superviseur" />
</list>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="4c044020-a391-4234-8366-64abd3f0f464" name="Default Changelist" comment="" />
<created>1539692092358</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1539692092358</updated>
<workItem from="1539692095452" duration="3090000" />
<workItem from="1539698076207" duration="43886000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="46976000" />
</component>
<component name="ToolWindowManager">
<frame x="260" y="101" width="1660" height="1088" extended-state="0" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.21277915" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.2114165" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39957717" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Messages" order="8" weight="0.3118393" />
<window_info anchor="bottom" id="Terminal" order="9" weight="0.32980973" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="11" show_stripe_button="false" />
<window_info anchor="bottom" id="CMake" order="12" weight="0.32980973" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Database" order="3" />
</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>
<breakpoints>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/examples/src/serverTest.cpp</url>
<line>28</line>
<option name="timeStamp" value="1" />
</line-breakpoint>
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
<url>file://$PROJECT_DIR$/superviseur/src/functions.cpp</url>
<line>16</line>
<option name="timeStamp" value="6" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/destijl_init/src/functions.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/destijl_init/src/main.cpp">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/Camera.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="795">
<caret line="53" column="19" selection-start-line="53" selection-start-column="19" selection-end-line="53" selection-end-column="19" />
<folding>
<element signature="e#43#62#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/Image.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="35" column="52" selection-start-line="35" selection-start-column="52" selection-end-line="35" selection-end-column="52" />
<folding>
<element signature="e#80#99#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/Definition.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" column="10" selection-start-line="22" selection-start-column="10" selection-end-line="22" selection-end-column="10" />
<folding>
<element signature="e#90#128#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/Camera.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="435">
<caret line="29" selection-start-line="29" selection-end-line="29" />
<folding>
<element signature="e#82#120#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/destijl_init/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="21" selection-start-line="6" selection-start-column="21" selection-end-line="6" selection-end-column="21" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor/src/functions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="615">
<caret line="41" column="41" selection-start-line="41" selection-start-column="41" selection-end-line="41" selection-end-column="41" />
<folding>
<element signature="e#1028#1087#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor/src/functions.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="203">
<caret line="33" selection-start-line="24" selection-end-line="33" />
<folding>
<element signature="e#319#337#0" expanded="true" />
<element signature="e#446#577#0" expanded="true" />
<element signature="e#588#616#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build/CMakeFiles/Makefile.cmake">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="16" selection-start-line="6" selection-start-column="16" selection-end-line="6" selection-end-column="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pc/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="68" selection-start-column="68" selection-end-column="68" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor/src/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1185">
<caret line="20" selection-start-line="20" selection-end-line="20" />
<folding>
<element signature="e#88#106#0" expanded="true" />
<element signature="e#308#328#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pc/src/functions.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="434">
<caret line="68" lean-forward="true" selection-start-line="30" selection-end-line="68" />
<folding>
<element signature="e#319#337#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pc/src/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-510">
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pc/src/functions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="824">
<caret line="214" column="11" lean-forward="true" selection-start-line="214" selection-start-column="11" selection-end-line="214" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/image.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1260">
<caret line="12" selection-start-line="12" selection-end-line="12" />
<folding>
<element signature="e#494#512#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/image.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-810" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pthread/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="43" lean-forward="true" selection-start-line="2" selection-start-column="43" selection-end-line="2" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/monitor-pthread/src/functions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2655" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/monitor.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1680">
<caret line="112" lean-forward="true" selection-start-line="19" selection-end-line="112" />
<folding>
<element signature="e#82#104#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/message.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="2" lean-forward="true" selection-start-line="9" selection-start-column="2" selection-end-line="9" selection-end-column="2" />
<folding>
<element signature="e#312#330#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/Serial.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1080" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/message.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="27" column="36" lean-forward="true" selection-start-line="26" selection-start-column="4" selection-end-line="27" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src.sav/monitor.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="433">
<caret line="151" column="1" selection-start-line="146" selection-end-line="151" selection-end-column="1" />
<folding>
<element signature="e#1030#1072#0" expanded="true" />
<element signature="e#1814#1860#0" expanded="true" />
<element signature="e#1973#2002#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/TcpServer.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="299">
<caret line="76" selection-start-line="76" selection-end-line="76" />
<folding>
<element signature="e#648#670#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/Robot.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-495" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/TcpServer.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="14" column="17" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-pthread/src/Program.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="419">
<caret line="107" selection-start-line="107" selection-end-line="107" />
<folding>
<element signature="e#90#108#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="22" selection-start-line="9" selection-start-column="22" selection-end-line="9" selection-end-column="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-pthread/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="60" selection-start-line="7" selection-start-column="60" selection-end-line="7" selection-end-column="60" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-pthread/src/Tasks.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="33" column="40" selection-start-line="33" selection-start-column="40" selection-end-line="33" selection-end-column="40" />
<folding>
<element signature="e#319#338#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-pthread/src/Tasks.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="509">
<caret line="245" column="27" selection-start-line="245" selection-start-column="27" selection-end-line="245" selection-end-column="27" />
<folding>
<element signature="e#0#18#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-xenomai/src/Program.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="373">
<caret line="148" column="7" selection-start-line="145" selection-start-column="6" selection-end-line="148" selection-end-column="7" />
<folding>
<element signature="e#88#106#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/Robot.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="29" column="19" selection-start-line="29" selection-start-column="19" selection-end-line="29" selection-end-column="19" />
<folding>
<element signature="e#891#909#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-xenomai/src/Tasks.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="748">
<caret line="84" column="60" selection-start-line="84" selection-start-column="60" selection-end-line="84" selection-end-column="60" />
<folding>
<element signature="e#316#341#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/MsgManager.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-151">
<caret line="20" column="8" selection-start-line="20" selection-start-column="8" selection-end-line="20" selection-end-column="8" />
<folding>
<element signature="e#86#105#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-xenomai/src/Tasks.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="410">
<caret line="92" column="35" lean-forward="true" selection-start-line="92" selection-start-column="35" selection-end-line="92" selection-end-column="35" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<element signature="e#876#929#0" expanded="true" />
<element signature="e#1024#1083#0" expanded="true" />
<element signature="e#1218#1293#0" expanded="true" />
<element signature="e#1799#1852#0" expanded="true" />
<element signature="e#1939#2002#0" expanded="true" />
<element signature="e#2104#2194#0" expanded="true" />
<element signature="e#2383#2442#0" expanded="true" />
<element signature="e#2683#2730#0" expanded="true" />
<element signature="e#3232#3297#0" expanded="true" />
<element signature="e#3735#3816#0" expanded="true" />
<element signature="e#3922#3978#0" expanded="true" />
<element signature="e#6217#6275#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/Image.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="419">
<caret line="51" column="6" selection-start-line="51" selection-start-column="6" selection-end-line="51" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/MsgManager.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="339">
<caret line="136" column="23" selection-start-line="136" selection-start-column="23" selection-end-line="136" selection-end-column="23" />
<folding>
<element signature="e#44#64#0" expanded="true" />
<element signature="e#751#793#0" expanded="true" />
<element signature="e#832#878#0" expanded="true" />
<element signature="e#938#967#0" expanded="true" />
<element signature="e#1253#1282#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur-xenomai/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="82" selection-start-line="4" selection-start-column="82" selection-end-line="4" selection-end-column="82" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/image.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="17" selection-start-line="17" selection-end-line="17" />
<folding>
<element signature="e#566#599#0" expanded="true" />
<element signature="e#635#673#0" expanded="true" />
<element signature="e#865#890#0" expanded="true" />
<element signature="e#935#962#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/message.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="405">
<caret line="27" column="32" selection-start-line="27" selection-start-column="32" selection-end-line="27" selection-end-column="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/monitor.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="64" column="94" selection-start-line="64" selection-start-column="94" selection-end-line="64" selection-end-column="94" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/monitor.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="338">
<caret line="104" column="23" selection-start-line="104" selection-start-column="23" selection-end-line="104" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur/src/functions.h">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="51" column="21" selection-start-line="51" selection-start-column="12" selection-end-line="51" selection-end-column="21" />
<folding>
<element signature="e#319#337#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="330">
<caret line="22" selection-start-line="22" selection-end-line="22" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state>
<caret column="81" selection-start-column="81" selection-end-column="81" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" selection-start-line="9" selection-end-line="9" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur/src/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="89" column="13" selection-start-line="89" selection-start-column="13" selection-end-line="89" selection-end-column="13" />
<folding>
<element signature="e#88#106#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/superviseur/src/functions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="19" selection-start-line="20" selection-start-column="19" selection-end-line="20" selection-end-column="19" />
</state>
</provider>
</entry>
</component>
</project>

View file

@ -1,13 +1,23 @@
cmake_minimum_required(VERSION 3.9)
project(ProjDestjil CXX)
cmake_minimum_required(VERSION 3.6)
project(ProjDestijl CXX)
set (ProjDestjil_VERSION_MAJOR 1)
set (ProjDestjil_VERSION_MINOR 0)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/superviseur/bin)
option(BUILD_FOR_XENOMAI "Build for Raspberry" OFF)
set(CMAKE_BUILD_TYPE DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt")
add_subdirectory("lib")
add_subdirectory("examples")
#add_subdirectory("destjil_init")
#add_subdirectory("examples")
add_subdirectory("superviseur")

View file

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6"/>
<Project>
<Option title="ProjDestijl"/>
<Option makefile_is_custom="1"/>
<Option compiler="gcc"/>
<Option virtualFolders="CMake Files\;CMake Files\lib\;CMake Files\superviseur\;"/>
<Build>
<Target title="all">
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot"/>
<Option type="4"/>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 all"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="rebuild_cache">
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot"/>
<Option type="4"/>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 rebuild_cache"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="edit_cache">
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot"/>
<Option type="4"/>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 edit_cache"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="destijl">
<Option output="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/lib/libdestijl.a" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib"/>
<Option object_output="./"/>
<Option type="2"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/."/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 destijl"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="destijl/fast">
<Option output="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/lib/libdestijl.a" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib"/>
<Option object_output="./"/>
<Option type="2"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/."/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 destijl/fast"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="superviseur">
<Option output="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur/bin/superviseur" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/../superviseur/bin"/>
<Option object_output="./"/>
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/./src"/>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/../lib"/>
<Add directory="/usr/xenomai/include"/>
<Add directory="/usr/xenomai/include/mercury"/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 superviseur"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
<Target title="superviseur/fast">
<Option output="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur/bin/superviseur" prefix_auto="0" extension_auto="0"/>
<Option working_dir="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/../superviseur/bin"/>
<Option object_output="./"/>
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/./src"/>
<Add directory="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/../lib"/>
<Add directory="/usr/xenomai/include"/>
<Add directory="/usr/xenomai/include/mercury"/>
</Compiler>
<MakeCommands>
<Build command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 superviseur/fast"/>
<CompileFile command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 &quot;$file&quot;"/>
<Clean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 clean"/>
<DistClean command="/usr/bin/make -f &quot;/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/Makefile&quot; VERBOSE=1 clean"/>
</MakeCommands>
</Target>
</Build>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/image.cpp">
<Option target="destijl"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/message.cpp">
<Option target="destijl"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/monitor.cpp">
<Option target="destijl"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/robot.cpp">
<Option target="destijl"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/functions.cpp">
<Option target="superviseur"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/functions.h">
<Option target="superviseur"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/main.cpp">
<Option target="superviseur"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/CMakeLists.txt">
<Option virtualFolder="CMake Files\"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/CMakeLists.txt">
<Option virtualFolder="CMake Files\lib\"/>
</Unit>
<Unit filename="/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/CMakeLists.txt">
<Option virtualFolder="CMake Files\superviseur\"/>
</Unit>
</Project>
</CodeBlocks_project_file>

View file

@ -0,0 +1,32 @@
[
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/. -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/destijl.dir/src/robot.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/robot.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/robot.cpp"
},
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/. -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/destijl.dir/src/monitor.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/monitor.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/monitor.cpp"
},
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/. -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/destijl.dir/src/message.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/message.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/message.cpp"
},
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/. -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/destijl.dir/src/image.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/image.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/lib/src/image.cpp"
},
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/./src -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/../lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/superviseur.dir/src/main.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/main.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/main.cpp"
},
{
"directory": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur",
"command": "/usr/bin/g++ -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/./src -I/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/../lib -I/usr/xenomai/include -I/usr/xenomai/include/mercury -I/usr/xenomai/include/mercury -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -g3 -gdwarf-2 -std=gnu++11 -o CMakeFiles/superviseur.dir/src/functions.cpp.o -c /home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/functions.cpp",
"file": "/home/dimercur/Documents/Travail/git/dumber/software/raspberry/superviseur-robot/superviseur/src/functions.cpp"
}
]

View file

@ -1,36 +0,0 @@
CC=g++
CFLAGS=-D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -c -g -D_WITH_TRACE_ -I/usr/xenomai/include/ -I/usr/xenomai/include/mercury -MMD -MP
LDFLAGS=-D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__MERCURY__ -I/usr/xenomai/include/alchemy -L/usr/xenomai/lib -lalchemy -lcopperplate -lmercury -L/opt/vc/lib -I/usr/local/include -lopencv_highgui -lopencv_core -lopencv_imgproc -Wl,--no-as-needed -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=/usr/xenomai/lib/dynlist.ld -L/usr/xenomai/lib -lmercury -lpthread -lrt -Wl,-rpath /usr/xenomai/lib -lopencv_highgui -lopencv_core -lopencv_imgcodecs -lraspicam_cv -lopencv_imgproc -lpthread
EXEC=superviseur
SRC= $(wildcard *.cpp ./src/*.cpp ./../src/*.cpp)
OBJ= $(SRC:.cpp=.o)
all: $(EXEC)
$(EXEC): $(OBJ)
@$(CC) -o $@ $^ $(LDFLAGS)
main.o: main.cpp
%.o: %.cpp
@$(CC) -o $@ -c $< $(CFLAGS)
.PHONY: clean mrproper
clean:
@rm -rf *.o
@rm -rf *.d
@rm -rf ./src/*.o
@rm -rf ./src/*.d
@rm -rf ./../src/*o
@rm -rf ./../src/*.d
mrproper: clean
@rm -rf $(EXEC)

View file

@ -4,8 +4,8 @@ set(serialTest_FILES ./src/serialTest.cpp)
set(serverTest_FILES ./src/serverTest.cpp)
include_directories(./src ../lib)
add_executable(serialTest ${serialTest_FILES})
target_link_libraries(serialTest destjil)
add_executable(serialtest ${serialTest_FILES})
target_link_libraries(serialtest destijl)
add_executable(serverTest ${serverTest_FILES})
target_link_libraries(serverTest destjil)
add_executable(servertest ${serverTest_FILES})
target_link_libraries(servertest destijl)

View file

@ -1 +1,6 @@
CMakeFiles/
libdestjil.a
Makefile
*.cmake

View file

@ -1,5 +1,5 @@
set(LIB_FILES ./src/Serial.cpp ./src/Robot.cpp ./src/TcpServer.cpp)
set(LIB_FILES ./src/robot.cpp ./src/monitor.cpp ./src/message.cpp ./src/image.cpp)
include_directories("./")
add_library(destjil STATIC ${LIB_FILES})
add_library(destijl STATIC ${LIB_FILES})

View file

@ -1,84 +0,0 @@
/*******************************************************************************
* 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__

View file

@ -1,49 +0,0 @@
/*
* 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_ */

View file

@ -1,35 +0,0 @@
//
// 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_ */

View file

@ -14,6 +14,30 @@
#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'

View file

@ -14,6 +14,8 @@
#ifndef IMAGERIE_H
#define IMAGERIE_H
#define __STUB__
#ifndef __STUB__
#include <raspicam/raspicam_cv.h>
#else

View file

@ -62,7 +62,7 @@ typedef struct {
* \param file chemin du fichier de l'interface (défaut ./interface.js)
* \return retourne 0 si le process a é lancé et -1 sinon.
*/
int run_nodejs(const char * path = DEFAULT_NODEJS_PATH, char * file = DEFAULT_INTERFACE_FILE);
int run_nodejs(const char *path = (const char*)DEFAULT_NODEJS_PATH, char *file = (const char*)DEFAULT_INTERFACE_FILE);
/**
* \brief Tue le process exécutant nodejs.

View file

@ -0,0 +1,64 @@
/**
* \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 DUMBERC_SERIAL_H_H
#define DUMBERC_SERIAL_H_H
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <string.h>
#include <stdlib.h>
#include "definitions.h"
#define serialPort "/dev/ttyS0"
typedef struct
{
char header[4];
char data[20];
} MessageToRobot;
/**
* \brief Ouvre la communication avec le robot.
* \details Ouvre le serial port passé en paramétre. Par defaut cette fonction ouvre le port ttySO connecté au module xbee.
*
* \param *path chaine de caractère indiquant le path du port serie à ouvrir.
* \return Return -1 si l'ouverture c'est mal passé et 0 si le port est ouvert.
*/
int open_communication_robot(const char * path=serialPort);
/**
* \brief Ferme la communication avec le robot.
* \details Ferme le descripteur de fichier du port serie contrôlant le robot.
*
* \param void aucun
* \return Retourne -1 en cas d'erreur ou 0 en cas de fermeture effectué
*/
int close_communication_robot(void);
/**
* \brief Envoi une commande au robot et attends sa réponse.
* \details Envoi une commande au robot en ajoutant le checksum et lis la réponse du robot en verifiant le checksum.
Le premier paramétre \a cmd correspond au type de commande ex : PING, SETMOVE ...
Le second paramétre \a *arg correspond aux arguments à la commande ex : SETMOVE, "100"
La fonction retourne un code confirmation transmise par le robot (ROBOT_CHEKSUM, ROBOT_ERROR, ROBOT_TIMED_OUT, ROBOT_OK, ROBOT_UKNOW_CMD)
*
* \param cmd Entête de la commande
* \param *arg Argument de la commande
* \return retourne un code confirmation.
*/
int send_command_to_robot(char cmd, const char * arg=NULL);
#endif //DUMBERC_SERIAL_H_H

View file

@ -1,349 +0,0 @@
/*******************************************************************************
* 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;
}

View file

@ -1,164 +0,0 @@
/*******************************************************************************
* 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");
}

View file

@ -1,93 +0,0 @@
/*******************************************************************************
* 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);
}

View file

@ -25,5 +25,5 @@ void free_msgToMon_data(MessageToMon *msg) {
void print_msgToMon(MessageToMon *msg) {
printf("header: %s\n", msg->header);
printf("data: %s\n", msg->data);
printf("data: %s\n", (char*)msg->data);
}

View file

@ -102,7 +102,7 @@ int send_message_to_monitor(const char* typeMessage, const void * data) {
serverSend("TRAME", 5);
return 0;
} else if ((string) typeMessage == HEADER_STM_POS) {
char buffer[20];
char buffer[400];
Position * maPosition = (Position*) data;
sprintf(buffer, "POScenter: %3d;%3d | %.1fTRAME", maPosition->center.x, maPosition->center.y, maPosition->angle);
serverSend(buffer, strlen(buffer));

View file

@ -0,0 +1,236 @@
/**
* \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"
int fd;
int getChar(char * c);
int readSerial(char * msg);
char checkSumGO(char * msg);
int receiveMsg(void);
int sendCmd(char cmd, const char * arg);
int open_communication_robot(const char * path)
{
#ifndef __STUB__
struct termios options;
fd = open(path, O_RDWR | O_NOCTTY | O_NDELAY);
if(fd !=-1)
{
fcntl(fd, F_SETFL, 0);
tcgetattr(fd, &options);
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
cfsetospeed (&options, B9600);
cfsetispeed (&options, B9600);
options.c_cc[VMIN]=0;
options.c_cc[VTIME]=0;
tcsetattr(fd, TCSANOW, &options);
return 0;
}
else
{
perror("can't openSerial");
return -1;
}
#else
return 0;
#endif
}
int close_communication_robot(void)
{
#ifndef __STUB__
return close(fd);
#else
return 0;
#endif
}
int send_command_to_robot(char cmd, const char * arg)
{
#ifndef __STUB__
sendCmd(cmd,arg);
// TODO : check return from sendCmd
return receiveMsg();
#else
int reponse;
switch(cmd)
{
case DMB_PING:
reponse = 0;
break;
case DMB_IDLE:
reponse = 0;
break;
case DMB_START_WITH_WD:
reponse = 0;
break;
case DMB_RELOAD_WD:
reponse = 0;
break;
case DMB_GET_VBAT:
reponse = 2;
break;
case DMB_IS_BUSY:
reponse = 1;
break;
case DMB_START_WITHOUT_WD:
reponse = 0;
break;
case DMB_MOVE:
reponse = 0;
break;
case DMB_TURN:
reponse = 0;
break;
case DMB_GO_FORWARD:
reponse = 0;
break;
case DMB_GO_BACK:
reponse = 0;
break;
case DMB_GO_LEFT:
reponse = 0;
break;
case DMB_GO_RIGHT:
reponse = 0;
break;
case DMB_STOP_MOVE:
reponse = 0;
break;
default:
reponse = 0;
break;
}
return reponse;
#endif
}
/****************************/
/* PRIVATE */
/****************************/
int sendCmd(char cmd, const char * arg)
{
char cmdWithArg[20]={};
cmdWithArg[0]=cmd;
switch(cmd)
{
case DMB_GO_FORWARD: strcpy(cmdWithArg,"M=+64000");
break;
case DMB_GO_BACK: strcpy(cmdWithArg,"M=-64000");
break;
case DMB_GO_LEFT: strcpy(cmdWithArg,"T=+64000");
break;
case DMB_GO_RIGHT: strcpy(cmdWithArg,"T=-64000");
break;
case DMB_STOP_MOVE: strcpy(cmdWithArg,"M=0");
break;
case DMB_MOVE: strcat(cmdWithArg,"=");
strcat(cmdWithArg,arg);
break;
case DMB_TURN: strcat(cmdWithArg,"=");
strcat(cmdWithArg,arg);
break;
}
int sizeCmd = strlen(cmdWithArg);
cmdWithArg[sizeCmd] = checkSumGO(cmdWithArg);
cmdWithArg[sizeCmd+1] = '\r';
cmdWithArg[sizeCmd+2] = '\0';
return write(fd,cmdWithArg,strlen(cmdWithArg));
}
int receiveMsg(void)
{
char msg[20];
int b;
if((b = readSerial(msg))!=ROBOT_TIMED_OUT)
{
int taille = strlen(msg);
char checksum = msg[taille-2];
msg[taille-1] = 0;
msg[taille-2] = 0;
if(checksum!=checkSumGO(msg))
{
return ROBOT_CHECKSUM;
}
else
{
switch(msg[0])
{
case 'O' : return 0;
case 'E' : return ROBOT_ERROR;
case 'C' : return ROBOT_UKNOWN_CMD;
default : return atoi(&msg[0]);
}
}
}
else
{
return ROBOT_TIMED_OUT;
}
}
int getChar(char * c)
{
int n =0;
int delay =0;
while((n=read(fd,c,1)) <=0)
{
usleep(5000);
delay++;
if(delay > 10)
{
return ROBOT_TIMED_OUT;
}
}
return n;
}
int readSerial(char * msg)
{
char car=0;
int i=0;
for(int j = 0 ; j < 20 ; j++)
msg[j]=0;
while(car !='\r' && car!='\n') {
if(i>=20)
return -5;
if(getChar(&car)==ROBOT_TIMED_OUT) {
return ROBOT_TIMED_OUT;
}
msg[i] = car;
i++;
}
return i;
}
char checkSumGO(char * msg)
{
char resultat = 0;
int i = 0;
int taille = strlen(msg);
for(i=0;i<taille;i++)
{
resultat^=msg[i];
}
return resultat;
}

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="0">
<df name="lib">
<df name="src">
<in>image.cpp</in>
<in>message.cpp</in>
<in>monitor.cpp</in>
<in>robot.cpp</in>
</df>
</df>
<df name="superviseur">
<df name="src">
<in>functions.cpp</in>
<in>main.cpp</in>
</df>
<in>.gitignore</in>
</df>
</df>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false"
kind="IMPORTANT_FILES_FOLDER">
<itemPath>CMakeLists.txt</itemPath>
<itemPath>Makefile</itemPath>
<itemPath>nbproject/private/launcher.properties</itemPath>
</logicalFolder>
</logicalFolder>
<sourceFolderFilter>^(nbproject)$</sourceFolderFilter>
<sourceRootList>
<Elem>.</Elem>
</sourceRootList>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="Default" type="0">
<toolsSet>
<compilerSet>default</compilerSet>
<dependencyChecking>false</dependencyChecking>
<rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<flagsDictionary>
<element flagsID="0" commonFlags="-std=gnu++11"/>
</flagsDictionary>
<codeAssistance>
</codeAssistance>
<makefileType>
<makeTool>
<buildCommandWorkingDir>.</buildCommandWorkingDir>
<buildCommand>${MAKE} -f Makefile</buildCommand>
<cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
<executablePath></executablePath>
<ccTool>
<preprocessorList>
<Elem>_GNU_SOURCE</Elem>
<Elem>_REENTRANT</Elem>
<Elem>__MERCURY__</Elem>
</preprocessorList>
</ccTool>
</makeTool>
<preBuild>
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
<preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_C_FLAGS_DEBUG="-g3 -gdwarf-2" -DCMAKE_CXX_FLAGS_DEBUG="-g3 -gdwarf-2" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .</preBuildCommand>
</preBuild>
</makefileType>
<folder path="0/lib">
<ccTool>
<incDir>
<pElem>lib</pElem>
<pElem>/usr/xenomai/include/mercury</pElem>
<pElem>/usr/xenomai/include</pElem>
<pElem>/usr/xenomai/include/alchemy</pElem>
</incDir>
</ccTool>
</folder>
<folder path="0/superviseur">
<ccTool>
<incDir>
<pElem>superviseur/src</pElem>
<pElem>lib</pElem>
<pElem>/usr/xenomai/include</pElem>
<pElem>/usr/xenomai/include/mercury</pElem>
<pElem>/usr/xenomai/include/alchemy</pElem>
<pElem>superviseur</pElem>
</incDir>
</ccTool>
</folder>
<item path="lib/src/image.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="lib/src/message.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="lib/src/monitor.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="lib/src/robot.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="superviseur/.gitignore" ex="false" tool="3" flavor2="0">
</item>
<item path="superviseur/src/functions.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
<item path="superviseur/src/main.cpp" ex="false" tool="1" flavor2="8">
<ccTool flags="0">
</ccTool>
</item>
</conf>
</confs>
</configurationDescriptor>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>superviseur-robot</name>
<c-extensions/>
<cpp-extensions>cpp,cxx</cpp-extensions>
<header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects/>
<sourceRootList>
<sourceRootElem>.</sourceRootElem>
</sourceRootList>
<confList>
<confElem>
<name>Default</name>
<type>0</type>
</confElem>
</confList>
<formatting>
<project-formatting-style>false</project-formatting-style>
</formatting>
</data>
</configuration>
</project>

View file

@ -0,0 +1,9 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../superviseur-pthread/bin)
set(superviseur_pthread_FILES ./src/Program.cpp src/Tasks.cpp)
include_directories(./src ../lib)
add_executable(superviseur-pthread ${superviseur_pthread_FILES})
target_link_libraries(superviseur-pthread destijl pthread rt)

View file

@ -0,0 +1,273 @@
/*
* File: Program.c
* Author: dimercur
*
* Created on 23 octobre 2018, 19:45
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <sys/mman.h>
#include <pthread.h>
#include <semaphore.h>
#include <mqueue.h>
#include <sched.h>
#include "Tasks.h"
using namespace std;
class Program {
public:
// Déclaration des handleurs de tache
pthread_t th_server;
pthread_t th_sendToMon;
pthread_t th_receiveFromMon;
pthread_t th_openComRobot;
pthread_t th_startRobot;
pthread_t th_move;
// Déclaration des priorités des taches
int PRIORITY_TSERVER = 30;
int PRIORITY_TOPENCOMROBOT = 20;
int PRIORITY_TMOVE = 10;
int PRIORITY_TSENDTOMON = 25;
int PRIORITY_TRECEIVEFROMMON = 22;
int PRIORITY_TSTARTROBOT = 20;
// Declaration de mutex
pthread_mutex_t mutex_robotStarted;
pthread_mutex_t mutex_move;
//declaration de semaphores
sem_t sem_barrier;
sem_t sem_openComRobot;
sem_t sem_serverOk;
sem_t sem_startRobot;
// Déclaration des files de message
mqd_t q_messageToMon;
struct mq_attr q_messageToMonAttr;
int MSG_QUEUE_SIZE = 10;
// Déclaration des ressources partagées
int etatCommMoniteur = 1;
int robotStarted = 0;
Program();
virtual ~Program();
/**
* \fn void initStruct(void)
* \brief Initialisation des structures de l'application (tâches, mutex,
* semaphore, etc.)
*/
void initStruct(void);
/**
* \fn void startTasks(void)
* \brief Démarrage des tâches
*/
void startTasks(void);
/**
* \fn void deleteTasks(void)
* \brief Arrêt des tâches
*/
void deleteTasks(void);
/**
* \fn int run(void)
* \brief execute program
*/
int run(void);
};
int main(int argc, char **argv) {
int err;
Program myProg;
TcpServer server;
Tasks::messages.SetServer(&server);
//Lock the memory to avoid memory swapping for this program
mlockall(MCL_CURRENT | MCL_FUTURE);
printf("#################################\n");
printf("# DE STIJL PROJECT #\n");
printf("#################################\n");
return myProg.run();
}
Program::Program() {}
Program::~Program() {}
int Program::run(void) {
this->initStruct();
this->startTasks();
//sem_post(&sem_barrier);
pause();
this->deleteTasks();
}
void Program::initStruct(void) {
int err;
/* Creation des mutex */
mutex_robotStarted=PTHREAD_MUTEX_INITIALIZER;
mutex_move=PTHREAD_MUTEX_INITIALIZER;
/* Creation du semaphore */
if (sem_init(&sem_barrier, 0, 0) == -1) {
printf("Error semaphore create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
if (sem_init(&sem_openComRobot, 0, 0) == -1) {
printf("Error semaphore create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
if (sem_init(&sem_serverOk, 0, 0) == -1) {
printf("Error semaphore create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
if (sem_init(&sem_startRobot, 0, 0) == -1) {
printf("Error semaphore create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* Sous pthread, les taches sont executées dés leur creation
* la creation des taches se fait donc dans startTask */
/* Creation des files de messages */
q_messageToMonAttr.mq_flags = 0;
q_messageToMonAttr.mq_maxmsg = 10;
q_messageToMonAttr.mq_msgsize = 200;
q_messageToMonAttr.mq_curmsgs = 0;
q_messageToMon = mq_open("MessageToMon", O_CREAT | O_RDWR, 0644, &q_messageToMonAttr);
if((mqd_t)-1 != q_messageToMon){
printf("Error msg queue create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
// if (err = rt_queue_create(&q_messageToMon, "toto", MSG_QUEUE_SIZE * sizeof (MessageToRobot), MSG_QUEUE_SIZE, Q_FIFO)) {
// printf("Error msg queue create: %s\n", strerror(-err));
// exit(EXIT_FAILURE);
// }
}
void Program::startTasks() {
int err;
pthread_attr_t tattr;
pthread_t tid;
int ret;
sched_param param;
/* initialized with default attributes */
ret = pthread_attr_init (&tattr);
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TSTARTROBOT;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
/* Creation des taches */
if ((err = pthread_create(&th_startRobot, &tattr, (void* (*)(void*))Tasks::f_startRobot, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TRECEIVEFROMMON;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
if ((err = pthread_create(&th_receiveFromMon, &tattr, (void* (*)(void*))Tasks::f_receiveFromMon, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TSENDTOMON;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
if ((err = pthread_create(&th_sendToMon, &tattr, (void* (*)(void*))Tasks::f_sendToMon, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TOPENCOMROBOT;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
if ((err = pthread_create(&th_openComRobot, &tattr, (void* (*)(void*))Tasks::f_openComRobot, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TMOVE;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
if ((err = pthread_create(&th_move, &tattr, (void* (*)(void*))Tasks::f_move, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
/* safe to get existing scheduling param */
ret = pthread_attr_getschedparam (&tattr, &param);
/* set the priority; others are unchanged */
param.sched_priority = PRIORITY_TSERVER;
/* setting the new scheduling param */
ret = pthread_attr_setschedparam (&tattr, &param);
if ((err = pthread_create(&th_server, &tattr, (void* (*)(void*))Tasks::f_server, NULL))) {
printf("Error task create: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
}
void Program::deleteTasks() {
pthread_cancel(th_server);
pthread_cancel(th_openComRobot);
pthread_cancel(th_move);
}

View file

@ -0,0 +1,246 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <pthread.h>
#include <semaphore.h>
#include <mqueue.h>
#include <sched.h>
#include <Robot.h>
#include <Camera.h>
#include <Image.h>
#include <TcpServer.h>
#include <MsgManager.h>
//#include "../../lib/Robot.h"
//#include "../../lib/Camera.h"
//#include "../../lib/Image.h"
//#include "../../lib/TcpServer.h"
#include "Tasks.h"
void Tasks::f_server(void *arg) {
// int err;
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
// err = run_nodejs("/usr/local/bin/node", "/home/pi/Interface_Robot/server.js");
//
// if (err < 0) {
// printf("Failed to start nodejs: %s\n", strerror(-err));
// exit(EXIT_FAILURE);
// } else {
//#ifdef _WITH_TRACE_
// printf("%s: nodejs started\n", info.name);
//#endif
// open_server();
// rt_sem_broadcast(&sem_serverOk);
// }
}
void Tasks::f_sendToMon(void * arg) {
// int err;
// MessageToMon msg;
//
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
//#ifdef _WITH_TRACE_
// printf("%s : waiting for sem_serverOk\n", info.name);
//#endif
// rt_sem_p(&sem_serverOk, TM_INFINITE);
// while (1) {
//
//#ifdef _WITH_TRACE_
// printf("%s : waiting for a message in queue\n", info.name);
//#endif
// if (rt_queue_read(&q_messageToMon, &msg, sizeof (MessageToRobot), TM_INFINITE) >= 0) {
//#ifdef _WITH_TRACE_
// printf("%s : message {%s,%s} in queue\n", info.name, msg.header, msg.data);
//#endif
//
// send_message_to_monitor(msg.header, msg.data);
// free_msgToMon_data(&msg);
// rt_queue_free(&q_messageToMon, &msg);
// } else {
// printf("Error msg queue write: %s\n", strerror(-err));
// }
// }
}
void Tasks::f_receiveFromMon(void *arg) {
// MessageFromMon msg;
// int err;
//
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
//#ifdef _WITH_TRACE_
// printf("%s : waiting for sem_serverOk\n", info.name);
//#endif
// rt_sem_p(&sem_serverOk, TM_INFINITE);
// do {
//#ifdef _WITH_TRACE_
// printf("%s : waiting for a message from monitor\n", info.name);
//#endif
// err = receive_message_from_monitor(msg.header, msg.data);
//#ifdef _WITH_TRACE_
// printf("%s: msg {header:%s,data=%s} received from UI\n", info.name, msg.header, msg.data);
//#endif
// if (strcmp(msg.header, HEADER_MTS_COM_DMB) == 0) {
// if (msg.data[0] == OPEN_COM_DMB) { // Open communication supervisor-robot
//#ifdef _WITH_TRACE_
// printf("%s: message open Xbee communication\n", info.name);
//#endif
// rt_sem_v(&sem_openComRobot);
// }
// } else if (strcmp(msg.header, HEADER_MTS_DMB_ORDER) == 0) {
// if (msg.data[0] == DMB_START_WITHOUT_WD) { // Start robot
//#ifdef _WITH_TRACE_
// printf("%s: message start robot\n", info.name);
//#endif
// rt_sem_v(&sem_startRobot);
//
// } else if ((msg.data[0] == DMB_GO_BACK)
// || (msg.data[0] == DMB_GO_FORWARD)
// || (msg.data[0] == DMB_GO_LEFT)
// || (msg.data[0] == DMB_GO_RIGHT)
// || (msg.data[0] == DMB_STOP_MOVE)) {
//
// rt_mutex_acquire(&mutex_move, TM_INFINITE);
// move = msg.data[0];
// rt_mutex_release(&mutex_move);
//#ifdef _WITH_TRACE_
// printf("%s: message update movement with %c\n", info.name, move);
//#endif
//
// }
// }
// } while (err > 0);
}
void Tasks::f_openComRobot(void * arg) {
// int err;
//
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
// while (1) {
//#ifdef _WITH_TRACE_
// printf("%s : Wait sem_openComRobot\n", info.name);
//#endif
// rt_sem_p(&sem_openComRobot, TM_INFINITE);
//#ifdef _WITH_TRACE_
// printf("%s : sem_openComRobot arrived => open communication robot\n", info.name);
//#endif
// err = open_communication_robot();
// if (err == 0) {
//#ifdef _WITH_TRACE_
// printf("%s : the communication is opened\n", info.name);
//#endif
// MessageToMon msg;
// set_msgToMon_header(&msg, HEADER_STM_ACK);
// write_in_queue(&q_messageToMon, msg);
// } else {
// MessageToMon msg;
// set_msgToMon_header(&msg, HEADER_STM_NO_ACK);
// write_in_queue(&q_messageToMon, msg);
// }
// }
}
void Tasks::f_startRobot(void * arg) {
// int err;
//
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
// while (1) {
//#ifdef _WITH_TRACE_
// printf("%s : Wait sem_startRobot\n", info.name);
//#endif
// rt_sem_p(&sem_startRobot, TM_INFINITE);
//#ifdef _WITH_TRACE_
// printf("%s : sem_startRobot arrived => Start robot\n", info.name);
//#endif
// err = send_command_to_robot(DMB_START_WITHOUT_WD);
// if (err == 0) {
//#ifdef _WITH_TRACE_
// printf("%s : the robot is started\n", info.name);
//#endif
// rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
// robotStarted = 1;
// rt_mutex_release(&mutex_robotStarted);
// MessageToMon msg;
// set_msgToMon_header(&msg, HEADER_STM_ACK);
// write_in_queue(&q_messageToMon, msg);
// } else {
// MessageToMon msg;
// set_msgToMon_header(&msg, HEADER_STM_NO_ACK);
// write_in_queue(&q_messageToMon, msg);
// }
// }
}
void Tasks::f_move(void *arg) {
// /* INIT */
// RT_TASK_INFO info;
// rt_task_inquire(NULL, &info);
// printf("Init %s\n", info.name);
// rt_sem_p(&sem_barrier, TM_INFINITE);
//
// /* PERIODIC START */
//#ifdef _WITH_TRACE_
// printf("%s: start period\n", info.name);
//#endif
// rt_task_set_periodic(NULL, TM_NOW, 100000000);
// while (1) {
//#ifdef _WITH_TRACE_
// printf("%s: Wait period \n", info.name);
//#endif
// rt_task_wait_period(NULL);
//#ifdef _WITH_TRACE_
// printf("%s: Periodic activation\n", info.name);
// printf("%s: move equals %c\n", info.name, move);
//#endif
// rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
// if (robotStarted) {
// rt_mutex_acquire(&mutex_move, TM_INFINITE);
// send_command_to_robot(move);
// rt_mutex_release(&mutex_move);
//#ifdef _WITH_TRACE_
// printf("%s: the movement %c was sent\n", info.name, move);
//#endif
// }
// rt_mutex_release(&mutex_robotStarted);
// }
}
void Tasks::write_in_queue(mqd_t *queue, MsgManager msg) {
// void *buff;
// buff = rt_queue_alloc(&q_messageToMon, sizeof (MessageToMon));
// memcpy(buff, &msg, sizeof (MessageToMon));
// rt_queue_send(&q_messageToMon, buff, sizeof (MessageToMon), Q_NORMAL);
}
MsgManager Tasks::messages;

View file

@ -0,0 +1,44 @@
/*
* 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: functions.h
* Author: pehladik
*
* Created on 15 janvier 2018, 12:50
*/
#ifndef TASKS_H
#define TASKS_H
#include <mqueue.h>
#include <MsgManager.h>
class Tasks {
public:
static MsgManager messages;
static void f_server(void *arg);
static void f_sendToMon(void *arg);
static void f_receiveFromMon(void *arg);
static void f_openComRobot(void *arg);
static void f_move(void *arg);
static void f_startRobot(void *arg);
private:
char mode_start;
static void write_in_queue(mqd_t *queue, MsgManager msg);
Tasks() {}
};
#endif /* TASKS_H */

View file

@ -0,0 +1,9 @@
bin/
build/
CMakeFiles/
.dep.inc
Makefile
*.cmake
*.o

View file

@ -0,0 +1,15 @@
set(superviseur_FILES ./src/main.cpp src/functions.cpp)
include_directories(./src ../lib /usr/xenomai/include /usr/xenomai/include/mercury)
link_directories(/usr/xenomai/lib)
add_executable(superviseur ${superviseur_FILES})
target_link_libraries(superviseur destijl)
#add_custom_command(TARGET superviseur POST_BUILD
# COMMAND sudo chown root ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/superviseur
# COMMAND sudo chgrp root ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/superviseur
# COMMAND sudo chmod +s ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/superviseur
# WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
# COMMENT "Add sticky bit"
#)

View file

@ -1,4 +1,4 @@
#include "../header/functions.h"
#include "functions.h"
char mode_start;
@ -102,7 +102,7 @@ void f_receiveFromMon(void *arg) {
|| (msg.data[0] == DMB_STOP_MOVE)) {
rt_mutex_acquire(&mutex_move, TM_INFINITE);
move = msg.data[0];
robotMove = msg.data[0];
rt_mutex_release(&mutex_move);
#ifdef _WITH_TRACE_
printf("%s: message update movement with %c\n", info.name, move);
@ -207,7 +207,7 @@ void f_move(void *arg) {
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
if (robotStarted) {
rt_mutex_acquire(&mutex_move, TM_INFINITE);
send_command_to_robot(move);
send_command_to_robot(robotMove);
rt_mutex_release(&mutex_move);
#ifdef _WITH_TRACE_
printf("%s: the movement %c was sent\n", info.name, move);

View file

@ -25,10 +25,10 @@
#include <alchemy/sem.h>
#include <alchemy/queue.h>
#include "../../src/monitor.h"
#include "../../src/robot.h"
#include "../../src/image.h"
#include "../../src/message.h"
#include "monitor.h"
#include "robot.h"
#include "image.h"
#include "message.h"
extern RT_TASK th_server;
extern RT_TASK th_sendToMon;
@ -49,7 +49,7 @@ extern RT_QUEUE q_messageToMon;
extern int etatCommMoniteur;
extern int robotStarted;
extern char move;
extern char robotMove;
extern int MSG_QUEUE_SIZE;

View file

@ -16,7 +16,7 @@
#include <alchemy/sem.h>
#include <alchemy/queue.h>
#include "./header/functions.h"
#include "functions.h"
// Déclaration des taches
RT_TASK th_server;
@ -51,7 +51,7 @@ int MSG_QUEUE_SIZE = 10;
// Déclaration des ressources partagées
int etatCommMoniteur = 1;
int robotStarted = 0;
char move = DMB_STOP_MOVE;
char robotMove = DMB_STOP_MOVE;
/**
* \fn void initStruct(void)
@ -91,10 +91,11 @@ int main(int argc, char **argv) {
}
void initStruct(void) {
int err;
/* Creation des mutex */
if (err = rt_mutex_create(&mutex_robotStarted, NULL)) {
printf("Error mutex create: %s\n", strerror(-err));
printf("Error mutex create: %d %s\n", err, strerror(-err));
exit(EXIT_FAILURE);
}
if (err = rt_mutex_create(&mutex_move, NULL)) {
@ -103,20 +104,20 @@ void initStruct(void) {
}
/* Creation du semaphore */
if (err = rt_sem_create(&sem_barrier, NULL, 0, S_FIFO)) {
printf("Error semaphore create: %s\n", strerror(-err));
if (err = rt_sem_create(&sem_barrier, "truc", 0, S_FIFO)) {
printf("Error semaphore create 1: %d %s\n", err, strerror(-err));
exit(EXIT_FAILURE);
}
if (err = rt_sem_create(&sem_openComRobot, NULL, 0, S_FIFO)) {
printf("Error semaphore create: %s\n", strerror(-err));
printf("Error semaphore create 2: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
if (err = rt_sem_create(&sem_serverOk, NULL, 0, S_FIFO)) {
printf("Error semaphore create: %s\n", strerror(-err));
printf("Error semaphore create 3: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}
if (err = rt_sem_create(&sem_startRobot, NULL, 0, S_FIFO)) {
printf("Error semaphore create: %s\n", strerror(-err));
printf("Error semaphore create 4: %s\n", strerror(-err));
exit(EXIT_FAILURE);
}