Compare commits

..

20 commits

Author SHA1 Message Date
Robin Marin-Muller
0121dc5707 Fixed timing issue with battery 2024-05-15 20:15:47 +02:00
Robin Marin-Muller
d89d36d040 Fully working positions with multiple robots 2024-05-15 19:37:20 +02:00
Robin Marin-Muller
ce68e09679 Added basic position management. 2024-05-15 18:39:08 +02:00
Robin Marin-Muller
5b9656c67a Fixed mutex issues with arena. Fully working arena. 2024-05-15 17:32:53 +02:00
fc2a05ab13 Added comments. *maybe* fixed issue with overlay not showing when choosing arena. 2024-05-14 21:44:18 +02:00
0792fc301d Added semaphore for ManageCamera Task. Added some comments. 2024-05-14 20:49:26 +02:00
9df1899580 Added semaphore for Arena 2024-05-14 13:55:27 +02:00
Robin Marin-Muller
8b39e4e099 Fixed issues with Arena, but not displaying overlay yet 2024-05-14 10:56:58 +02:00
866412162b Renamed Tasks to respect requirements 2024-05-11 22:14:08 +02:00
61b7855f3c Fixed issue with cam opening/closing. Changing how Camera behaves and Arena 2024-05-11 14:35:51 +02:00
e018b5d0f4 Storing into a vector the choosen Arena 2024-05-11 12:11:24 +02:00
5904a21007 Added Mutex and Thread management for arenaChoice. 2024-05-11 11:20:44 +02:00
Robin Marin-Muller
8f84e6d42e Arena detection working without Mutexes 2024-05-07 20:03:15 +02:00
Robin Marin-Muller
80fa2240f8 Fixed battery error 2024-04-04 18:13:03 +02:00
Robin Marin-Muller
c67814a39b Added acknowledge, created SendToRobot() 2024-04-04 17:55:02 +02:00
Robin Marin-Muller
b7fae99df4 Fully working Camera closing 2024-04-04 17:27:28 +02:00
Marin-Muller Robin
b75a775775 Fully working Camera opening 2024-04-04 17:07:38 +02:00
8d8dc0586f Camera: Added boilerplate for camera opening and image gathering (to test). Battery: Sending data to monitor. 2024-03-26 23:17:38 +01:00
Marin-Muller Robin
7d8d4456aa Battery is now fully working. 2024-03-26 16:52:41 +01:00
Marin-Muller Robin
9a88a66cc1 Added battery monitoring task 2024-03-26 15:27:20 +01:00
28 changed files with 888 additions and 177 deletions

16
.gitignore vendored
View file

@ -54,19 +54,6 @@ GUI
*.7z
*.rar
# Images
*.jpg
*.png
*.gif
*.bmp
*.jpeg
*.tiff
*.svg
# Documents
*.pdf
*.chm
# Trucs de MDK
*.uvgui*
*.bak
@ -83,7 +70,4 @@ GUI
/software/dumber3/Tests/
/software/dumber3/workspace/
/hardware/meca/Dumber_2022/Pieces/
/hardware/meca/Dumber_2022/OldVersions/
/doc/Doc\ robot/doxygen/

18
.vscode/c_cpp_properties.json vendored Normal file
View file

@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "linux-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "linux-gcc-x64",
"compilerArgs": [
""
]
}
],
"version": 4
}

59
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

View file

@ -8,3 +8,6 @@ Depot du projet de temps reel 4eme année au departement GEI de l'INSA Toulouse.
- doc: contient les sujets de TD et TP
- aruco_markers: Script de generation des tags (aruco) utilisés sur les robots
/home/xenomai/.netbeans/remote/10.105.0.144/insa-10577-Linux-x86_64/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/dist/Debug__RPI_/GNU-Linux

View file

@ -74,17 +74,6 @@
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.1896077029" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
</toolChain>
</folderInfo>
<fileInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1504381080.16019415" name="application.c" rcbsApplicability="disable" resourcePath="Application/application.c" toolsToInvoke="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1474341646.81377361">
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1474341646.81377361" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.1474341646">
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.2042394482" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
</tool>
<tool customBuildStep="true" id="org.eclipse.cdt.managedbuilder.ui.rcbs.381948089" name="Resource Custom Build Step">
<inputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.inputtype.2085933829" name="Resource Custom Build Step Input Type">
<additionalInput kind="additionalinputdependency"/>
</inputType>
<outputType id="org.eclipse.cdt.managedbuilder.ui.rcbs.outputtype.1128986474" name="Resource Custom Build Step Output Type"/>
</tool>
</fileInfo>
<sourceEntries>
<entry excluding="Xbee-API|XBEE" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Application"/>
<entry excluding="XBEE" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>

View file

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="117839523036237333" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1052077282282430101" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="117839523036237333" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1052077282282430101" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -27,7 +27,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="117839523036237333" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-1052077282282430101" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View file

@ -35,10 +35,6 @@
* Robot is basically controlled by a supervisor program and move depending on commands send by supervisor.
* Movements are controlled by a camera.
*
* @warning Very important information: robot is use a 2.5V power supply so
* XBEE MODULES FROM S1 GENERATION DON'T WORK
* Use, at least, module from S2 generation
*
* @copyright Copyright 2023 INSA-GEI, Toulouse, France. All rights reserved.
* @copyright This project is released under the Lesser GNU Public License (LGPL-3.0-only).
*
@ -220,7 +216,6 @@ void APPLICATION_Thread(void* params) {
case CMD_TEST:
case CMD_DEBUG:
cmdSendAnswer(ANS_OK);
break;
case CMD_POWER_OFF:
systemInfos.powerOffRequired=1;
cmdSendAnswer(ANS_OK);
@ -410,15 +405,10 @@ void APPLICATION_StateMachine(void) {
if (((systemInfos.cmd == CMD_MOVE) && (systemInfos.distance !=0)) ||
((systemInfos.cmd == CMD_TURN) && (systemInfos.turns !=0))) {
systemInfos.endOfMouvement = 0;
cmdSendAnswer(ANS_OK);
APPLICATION_TransitionToNewState(stateInMouvement);
} else {
if (((systemInfos.cmd == CMD_MOVE) && (systemInfos.distance ==0)) || // This case (M=0 or T=0) correspond to STOP
((systemInfos.cmd == CMD_TURN) && (systemInfos.turns ==0))) {
systemInfos.endOfMouvement = 1;
}
}
cmdSendAnswer(ANS_OK);
} else if (systemInfos.state == stateInMouvement) { // in this state, MOVE and TURN cmds are accepted only if they come with no parameter (0)
} // if TURN and MOVE are sent without parameter, do nothing: we are still in run state
} else if (systemInfos.state == stateInMouvement) { // in this state, MOVE and TURN cmds are accepted only if they come with no parameter
if (((systemInfos.cmd == CMD_MOVE) && (systemInfos.distance ==0)) ||
((systemInfos.cmd == CMD_TURN) && (systemInfos.turns ==0))) {
systemInfos.endOfMouvement = 1;

View file

@ -44,8 +44,8 @@
* Version in plain text and as a numeric value
*/
///@{
#define SYSTEM_VERSION_STR "2.2"
#define SYSTEM_VERSION 0x0202 // Upper byte: major version, lower byte: minor version
#define SYSTEM_VERSION_STR "2.1"
#define SYSTEM_VERSION 0x0201 // Upper byte: major version, lower byte: minor version
///@}
#define STACK_SIZE 0x100

View file

@ -40,11 +40,6 @@
/** @addtogroup XBEE
* Xbee driver handles RF communications with supervisor
*
* @warning Very important information: robot is use a 2.5V power supply so
* XBEE MODULES FROM S1 GENERATION DON'T WORK
* Use, at least, module from S2 generation
*
* @{
*/
@ -115,7 +110,9 @@ uint16_t rxIndex;
/****** TX part ******/
SemaphoreHandle_t xHandleSemaphoreTX = NULL;
//SemaphoreHandle_t xHandleSemaphoreTX_ACK = NULL;
StaticSemaphore_t xSemaphoreTX;
//StaticSemaphore_t xSemaphoreTX_ACK;
/**
* @brief Function for initializing xbee system
@ -125,7 +122,9 @@ StaticSemaphore_t xSemaphoreTX;
*/
void XBEE_Init(void) {
xHandleSemaphoreTX = xSemaphoreCreateBinaryStatic( &xSemaphoreTX );
//xHandleSemaphoreTX_ACK = xSemaphoreCreateBinaryStatic( &xSemaphoreTX_ACK );
xSemaphoreGive(xHandleSemaphoreTX);
//xSemaphoreTake(xHandleSemaphoreTX_ACK);
xHandleSemaphoreRX = xSemaphoreCreateBinaryStatic( &xSemaphoreRx );
@ -205,6 +204,10 @@ int XBEE_SendData(char* data) {
if answer is false, it means timeout appends
We should probably reset something in "else" branch */
// while (LL_USART_IsEnabledIT_TXE(hlpuart1.Instance)) {
// vTaskDelay(pdMS_TO_TICKS(1));
// }
strncpy((char*)txBuffer,data,XBEE_TX_BUFFER_MAX_LENGTH-1);
txBuffer[XBEE_TX_BUFFER_MAX_LENGTH-1]=0;
txRemainingData = strlen((char*)txBuffer);
@ -258,12 +261,6 @@ void XBEE_TX_IRQHandler(void) {
*
* Wait for incoming message and send them to application mailbox
*
* @warning Very important information: robot is use a 2.5V power supply so
* XBEE MODULES FROM S1 GENERATION DON'T WORK
* Use, at least, module from S2 generation
* Behavior of using S1 generation is that you receive only two '0' chars than nothing. In
* case of this behavior, check module generation
*
* @param[in] params Initial task parameters
* @return None
*/
@ -301,12 +298,6 @@ void XBEE_RxThread(void* params) {
* This ISR is called when USART reception register is full, containing a newly received char
* A Semaphore is used to signal end of frame reception to \ref XBEE_RxThread function
*
* @warning Very important information: robot is use a 2.5V power supply so
* XBEE MODULES FROM S1 GENERATION DON'T WORK
* Use, at least, module from S2 generation
* Behavior of using S1 generation is that you receive only two '0' chars than nothing. In
* case of this behavior, check module generation
*
* @param None
* @return None
*/
@ -315,11 +306,6 @@ void XBEE_RX_IRQHandler(void) {
uint8_t data;
data = LL_USART_ReceiveData8(hlpuart1.Instance); // lecture de l'octet reçu
/*
* In case you only receive '0' chars (than nothing), check you XBEE module generation
* XBEE MODULES FROM S1 GENERATION DON'T WORK because robot is 2.5V and modules need more
* Use, at least, module from S2 generation
*/
if (data != XBEE_ENDING_CHAR) { // end of command not received
rxBuffer[rxIndex] = data;

View file

@ -35,11 +35,10 @@
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="3344"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.CTI_ALLOW_HALT" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.CTI_SIGNAL_HALT" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.openocd.DBG_DEVICE_SHAREABLE_ALLOWED" value="false"/>
@ -71,7 +70,7 @@
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="enable"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="freertos"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverAuto" value="false"/>
@ -81,9 +80,9 @@
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.stlink"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.openocd"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>

View file

@ -41,9 +41,21 @@
kind="IMPORTANT_FILES_FOLDER">
<itemPath>./Makefile</itemPath>
</logicalFolder>
<logicalFolder name="TestFiles"
displayName="Test Files"
projectFiles="false"
kind="TEST_LOGICAL_FOLDER">
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false"
kind="IMPORTANT_FILES_FOLDER">
<itemPath>./Makefile</itemPath>
</logicalFolder>
</logicalFolder>
<sourceRootList>
<Elem>lib</Elem>
<Elem>lib</Elem>
</sourceRootList>
<projectmakefile>./Makefile</projectmakefile>
<confs>

View file

@ -41,7 +41,7 @@
</conf>
<conf name="Debug__RPI_" type="1">
<toolsSet>
<developmentServer>xenomai@10.105.1.7:22</developmentServer>
<developmentServer>xenomai@10.105.0.146:22</developmentServer>
<platform>2</platform>
</toolsSet>
<dbx_gdbdebugger version="1">

View file

@ -6,6 +6,9 @@
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/home/boujon/Documents/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
<file>file:/home/boujon/Documents/dumber/software/raspberry/superviseur-robot/tasks.h</file>
</group>
</open-files>
</project-private>

View file

@ -0,0 +1,39 @@
#Tue Mar 26 14:16:07 CET 2024
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1711457904172
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1711457904197
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1711458297850
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/Makefile=c1711457904018
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.h=c1711457904155
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.h=c1711457904169
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1711458297867
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1711457904114
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1711457904187
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1711457904245
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1711457904021
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1711458720366
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1711457904182
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1711457904238
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1711457904124
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1711457904242
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1711457904151
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1711458948692
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1711457904162
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.h=c1711457904141
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1711457904135
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.cpp=c1711457904159
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.h=c1711457904130
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1711457904132
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.h=c1711457904148
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/wrapper.c=c1711457904248
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.cpp=c1711457904138
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.cpp=c1711457904165
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/gdbsudo.sh=c1711457904109
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1711457904127
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1711457904121
VERSION=1.3
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1711457904144
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1711457904185
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1711457904190
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.gitignore=c1711457904015
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.properties=c1711457904230
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1711457904118

View file

@ -0,0 +1,39 @@
#Thu Apr 04 18:04:54 CEST 2024
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1712238648769
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1712238648773
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1712238648790
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/Makefile=c1712238648634
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.h=c1712238648755
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.h=c1712238648766
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1712238648775
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1712238648721
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1712238648782
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1712246527533
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1712238648637
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1712238648826
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1712238648778
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1712238648829
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1712238648730
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1712246689680
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1712238648753
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1712238648629
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1712238648760
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.h=c1712238648744
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1712238648739
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.cpp=c1712238648758
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.h=c1712238648735
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1712238648737
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.h=c1712238648750
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/wrapper.c=c1712238648838
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.cpp=c1712238648742
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.cpp=c1712238648763
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/gdbsudo.sh=c1712238648718
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1712238648733
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1712238648728
VERSION=1.3
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1712238648747
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1712238648780
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1712238648784
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.gitignore=c1712238648632
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.properties=c1712238648823
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1712238648726

View file

@ -0,0 +1,39 @@
#Tue Mar 26 16:47:57 CET 2024
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1711457904172
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1711457904197
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1711458297850
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/Makefile=c1711457904018
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.h=c1711457904155
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.h=c1711457904169
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1711458297867
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1711457904114
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1711457904187
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1711467801732
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1711457904021
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1711458720366
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1711457904182
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1711457904238
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1711457904124
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1711468071294
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1711457904151
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1711457904162
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1711458948692
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.h=c1711457904141
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1711457904135
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.cpp=c1711457904159
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.h=c1711457904130
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1711457904132
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.h=c1711457904148
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/wrapper.c=c1711457904248
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.cpp=c1711457904138
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.cpp=c1711457904165
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/gdbsudo.sh=c1711457904109
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1711457904127
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1711457904121
VERSION=1.3
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1711457904144
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1711457904185
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1711457904190
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.gitignore=c1711457904015
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.properties=c1711457904230
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1711457904118

View file

@ -0,0 +1,39 @@
#Tue May 07 19:37:34 CEST 2024
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1712238648769
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1712238648773
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1712238648790
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/Makefile=c1712238648634
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.h=c1712238648755
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.h=c1712238648766
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1712238648775
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1712238648721
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1712238648782
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1715102079582
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1712238648637
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1712238648826
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1712238648778
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1712238648829
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1712238648730
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1715103442554
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1712238648753
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1712238648629
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1712238648760
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.h=c1712238648744
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1712238648739
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.cpp=c1712238648758
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.h=c1712238648735
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1712238648737
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.h=c1712238648750
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/wrapper.c=c1712238648838
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.cpp=c1712238648742
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.cpp=c1712238648763
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/gdbsudo.sh=c1712238648718
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1712238648733
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1712238648728
VERSION=1.3
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1712238648747
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1712238648780
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1712238648784
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.gitignore=c1712238648632
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.properties=c1712238648823
/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1712238648726

View file

@ -1,2 +1,2 @@
#Tue Nov 13 11:04:27 CET 2018
#Tue May 14 13:44:12 CEST 2024
project.license=gpl30

View file

@ -11,6 +11,7 @@
<make-dep-projects/>
<sourceRootList>
<sourceRootElem>lib</sourceRootElem>
<sourceRootElem>lib</sourceRootElem>
</sourceRootList>
<confList>
<confElem>

View file

@ -17,15 +17,26 @@
#include "tasks.h"
#include <stdexcept>
#include <vector>
// Déclaration des priorités des taches
// Task priority: higher has the best priority
#define PRIORITY_TSERVER 30
#define PRIORITY_TOPENCOMROBOT 20
#define PRIORITY_TMOVE 20
#define PRIORITY_TSENDTOMON 22
#define PRIORITY_TRECEIVEFROMMON 25
#define PRIORITY_TSTARTROBOT 20
// Added Priorities
// Camera is the most important as it has the most demanding timing request (10ms)
#define PRIORITY_TCAMERA 21
// Battery has a timing request of 500ms which is not important
#define PRIORITY_TBATTERY 19
// These priorities are for "Semaphored" tasks, not periodic.
// Their priority is lower.
#define PRIORITY_TSETCAMERA 18
#define PRIOTITY_TARENA 17
#define PRIOTITY_TPOSITION 16
/*
* Some remarks:
@ -37,7 +48,7 @@
* 3- Data flow is probably not optimal
*
* 4- Take into account that ComRobot::Write will block your task when serial buffer is full,
* time for internal buffer to flush
* time for interponal buffer to flush
*
* 5- Same behavior existe for ComMonitor::Write !
*
@ -73,6 +84,28 @@ void Tasks::Init() {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
// Added Mutexes
if (err = rt_mutex_create(&mutex_batteryGet, NULL)) {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_mutex_create(&mutex_cameraStatus, NULL)) {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_mutex_create(&mutex_camera, NULL)) {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_mutex_create(&mutex_arena, NULL)) {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_mutex_create(&mutex_arenaStatus, NULL)) {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
cout << "Mutexes created successfully" << endl << flush;
/**************************************************************************************/
@ -94,6 +127,20 @@ void Tasks::Init() {
cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
// Added Semaphores
if (err = rt_sem_create(&sem_instantBattery, NULL, 0, S_FIFO)) {
cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_sem_create(&sem_manageCamera, NULL, 0, S_FIFO)) {
cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_sem_create(&sem_arenaChoice, NULL, 0, S_FIFO)) {
cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
cout << "Semaphores created successfully" << endl << flush;
/**************************************************************************************/
@ -123,6 +170,28 @@ void Tasks::Init() {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
// Added tasks
if (err = rt_task_create(&th_batteryPeriodic, "th_batteryPeriodic", 0, PRIORITY_TBATTERY, 0)) {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_create(&th_battery, "th_battery", 0, PRIORITY_TBATTERY, 0)) {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_create(&th_cameraManage, "th_cameraManage", 0, PRIORITY_TSETCAMERA, 0)) {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_create(&th_cameraImage, "th_cameraImage", 0, PRIORITY_TCAMERA, 0)) {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_create(&th_arenaChoice, "th_arenaChoice", 0, PRIOTITY_TARENA, 0)) {
cerr << "Error task create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
cout << "Tasks created successfully" << endl << flush;
/**************************************************************************************/
@ -167,6 +236,28 @@ void Tasks::Run() {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
// Added Tasks
if (err = rt_task_start(&th_batteryPeriodic, (void(*)(void*)) & Tasks::BatteryPeriodicTask, this)) {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_start(&th_battery, (void(*)(void*)) & Tasks::BatteryTask, this)) {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_start(&th_cameraManage, (void(*)(void*)) & Tasks::ManageCameraTask, this)) {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_start(&th_cameraImage, (void(*)(void*)) & Tasks::ImageCameraTask, this)) {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
if (err = rt_task_start(&th_arenaChoice, (void(*)(void*)) & Tasks::ArenaChoiceTask, this)) {
cerr << "Error task start: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
cout << "Tasks launched" << endl << flush;
}
@ -192,7 +283,7 @@ void Tasks::Join() {
*/
void Tasks::ServerTask(void *arg) {
int status;
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are started)
rt_sem_p(&sem_barrier, TM_INFINITE);
@ -219,7 +310,7 @@ void Tasks::ServerTask(void *arg) {
*/
void Tasks::SendToMonTask(void* arg) {
Message *msg;
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
@ -244,11 +335,11 @@ void Tasks::SendToMonTask(void* arg) {
*/
void Tasks::ReceiveFromMonTask(void *arg) {
Message *msgRcv;
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
/**************************************************************************************/
/* The task receiveFromMon starts here */
/**************************************************************************************/
@ -276,6 +367,77 @@ void Tasks::ReceiveFromMonTask(void *arg) {
move = msgRcv->GetID();
rt_mutex_release(&mutex_move);
}
// Added messages
// Battery
else if (msgRcv->CompareID(MESSAGE_ROBOT_BATTERY_GET)) {
rt_mutex_acquire(&mutex_batteryGet, TM_INFINITE);
batteryEnabled = true;
rt_mutex_release(&mutex_batteryGet);
// Calling BatteryTask, unblocking the thread.
rt_sem_v(&sem_instantBattery);
}
// Camera
else if (msgRcv->CompareID(MESSAGE_CAM_OPEN)) {
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
if(CameraStatusEnum::CLOSED == cameraStatus)
cameraStatus = CameraStatusEnum::OPENING;
rt_mutex_release(&mutex_cameraStatus);
// Calling manageCamera, unblocking the thread.
rt_sem_v(&sem_manageCamera);
}
else if (msgRcv->CompareID(MESSAGE_CAM_CLOSE)) {
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
if(CameraStatusEnum::OPENED == cameraStatus)
cameraStatus = CameraStatusEnum::CLOSING;
rt_mutex_release(&mutex_cameraStatus);
// Calling manageCamera, unblocking the thread.
rt_sem_v(&sem_manageCamera);
}
// Arena
else if (msgRcv->CompareID(MESSAGE_CAM_ASK_ARENA)) {
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
if(ArenaStatusEnum::NONE == arenaStatus)
arenaStatus = ArenaStatusEnum::SEARCHING;
rt_mutex_release(&mutex_arenaStatus);
// Calling arenaChoice, unblocking the thread.
rt_sem_v(&sem_arenaChoice);
}
else if (msgRcv->CompareID(MESSAGE_CAM_ARENA_CONFIRM)) {
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
if(ArenaStatusEnum::SEARCHED == arenaStatus)
arenaStatus = ArenaStatusEnum::CONFIRM;
rt_mutex_release(&mutex_arenaStatus);
// Calling arenaChoice, unblocking the thread.
rt_sem_v(&sem_arenaChoice);
}
else if (msgRcv->CompareID(MESSAGE_CAM_ARENA_INFIRM)) {
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
if(ArenaStatusEnum::SEARCHED == arenaStatus)
arenaStatus = ArenaStatusEnum::INFIRM;
rt_mutex_release(&mutex_arenaStatus);
// Calling arenaChoice, unblocking the thread.
rt_sem_v(&sem_arenaChoice);
}
else if (msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_START)){
rt_mutex_acquire(&mutex_positionEnabled, TM_INFINITE);
positionEnabled = true;
rt_mutex_release(&mutex_positionEnabled);
}
else if (msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_STOP)){
rt_mutex_acquire(&mutex_positionEnabled, TM_INFINITE);
positionEnabled = false;
rt_mutex_release(&mutex_positionEnabled);
}
else if (msgRcv->CompareID(MESSAGE_CAM_IMAGE)) {
//?
}
delete(msgRcv); // mus be deleted manually, no consumer
}
}
@ -290,7 +452,7 @@ void Tasks::OpenComRobot(void *arg) {
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
/**************************************************************************************/
/* The task openComRobot starts here */
/**************************************************************************************/
@ -320,7 +482,7 @@ void Tasks::StartRobotTask(void *arg) {
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
/**************************************************************************************/
/* The task startRobot starts here */
/**************************************************************************************/
@ -336,7 +498,7 @@ void Tasks::StartRobotTask(void *arg) {
cout << ")" << endl;
cout << "Movement answer: " << msgSend->ToString() << endl << flush;
WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
if (msgSend->GetID() == MESSAGE_ANSWER_ACK) {
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
@ -352,11 +514,11 @@ void Tasks::StartRobotTask(void *arg) {
void Tasks::MoveTask(void *arg) {
int rs;
int cpMove;
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
/**************************************************************************************/
/* The task starts here */
/**************************************************************************************/
@ -364,7 +526,7 @@ void Tasks::MoveTask(void *arg) {
while (1) {
rt_task_wait_period(NULL);
cout << "Periodic movement update";
//cout << "Periodic movement update";
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
rs = robotStarted;
rt_mutex_release(&mutex_robotStarted);
@ -372,14 +534,14 @@ void Tasks::MoveTask(void *arg) {
rt_mutex_acquire(&mutex_move, TM_INFINITE);
cpMove = move;
rt_mutex_release(&mutex_move);
cout << " move: " << cpMove;
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
robot.Write(new Message((MessageID)cpMove));
robot.Write(new Message((MessageID) cpMove));
rt_mutex_release(&mutex_robot);
}
cout << endl << flush;
//cout << endl << flush;
}
}
@ -415,3 +577,298 @@ Message *Tasks::ReadInQueue(RT_QUEUE *queue) {
return msg;
}
/************************************************************************/
/* Added Tasks */
/************************************************************************/
void Tasks::BatteryPeriodicTask(void * arg) {
// Variables
int rs(0);
bool be(false);
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
// Periodic task set to 500ms
rt_task_set_periodic(NULL, TM_NOW, 500000000);
while (1) {
rt_task_wait_period(NULL);
this->SendBattery(rs,be);
}
}
void Tasks::BatteryTask(void * arg) {
// Variables
int rs(0);
bool be(false);
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
while(1)
{
// Called when semaphore arenChoice incremented
rt_sem_p(&sem_instantBattery, TM_INFINITE);
this->SendBattery(rs,be);
}
}
void Tasks::ManageCameraTask(void * arg)
{
// Variables
int rs(0);
CameraStatusEnum cs(CameraStatusEnum::CLOSED);
// Checking if all tasks started
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
rt_sem_p(&sem_barrier, TM_INFINITE);
while(1)
{
// Called when semaphore manageCamera incremented
rt_sem_p(&sem_manageCamera, TM_INFINITE);
// Check the status of the camera and store it in a local variable
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
cs = cameraStatus;
rt_mutex_release(&mutex_cameraStatus);
// Opening the camera
if(CameraStatusEnum::OPENING == cs)
{
const MessageID tempMessage = this->OpenCamera();
WriteInQueue(&q_messageToMon, new Message(tempMessage));
}
// Closing the camera
if(CameraStatusEnum::CLOSING == cs)
{
this->CloseCamera();
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK));
}
}
}
void Tasks::ImageCameraTask(void * arg)
{
// Variables
CameraStatusEnum cs = CameraStatusEnum::CLOSED;
Arena a = Arena();
std::vector<MessagePosition*> msgPos = {};
MessageImg *msgImg = nullptr;
bool pe = false;
std::list<Position> listPos = {};
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
// Periodic task set to 10ms
rt_task_set_periodic(NULL, TM_NOW, 100000000);
while(1)
{
rt_task_wait_period(NULL);
// Check the status of the camera
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
const CameraStatusEnum cs = cameraStatus;
rt_mutex_release(&mutex_cameraStatus);
// Gathering arena
rt_mutex_acquire(&mutex_arena, TM_INFINITE);
a = arena;
rt_mutex_release(&mutex_arena);
rt_mutex_acquire(&mutex_positionEnabled, TM_INFINITE);
pe = positionEnabled;
rt_mutex_release(&mutex_positionEnabled);
// Only gather image if opened
if(CameraStatusEnum::OPENED == cs)
{
// Gathering an image from the camera
rt_mutex_acquire(&mutex_camera, TM_INFINITE);
Img * img = new Img(cam->Grab());
rt_mutex_release(&mutex_camera);
// If arena has been found, draw overlay
if(!a.IsEmpty())
img->DrawArena(a);
// Gathering position
if(pe)
{
// Gather every robot available
listPos = img->SearchRobot(a);
// For every position, draw the robot and send the message
for(auto l : listPos)
{
img->DrawRobot(l);
msgPos.emplace_back(new MessagePosition(MESSAGE_CAM_POSITION, l));
}
}
msgImg= new MessageImg(MESSAGE_CAM_IMAGE, img);
rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
// Writing every message position
for(auto mp : msgPos)
monitor.Write(mp);
// Writing every message image
monitor.Write(msgImg);
rt_mutex_release(&mutex_monitor);
// clearing the vector because all its values are unassigned
msgPos.clear();
}
}
}
void Tasks::ArenaChoiceTask(void * arg)
{
// Variables
Img* img = nullptr;
Arena a;
ArenaStatusEnum as(ArenaStatusEnum::NONE);
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
rt_sem_p(&sem_barrier, TM_INFINITE);
while(1)
{
// Called when semaphore arenChoice incremented
rt_sem_p(&sem_arenaChoice, TM_INFINITE);
// Check the status of the arena
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
as = arenaStatus;
rt_mutex_release(&mutex_arenaStatus);
// ASK_ARENA
if(as == ArenaStatusEnum::SEARCHING)
{
// Change status for next command
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
arenaStatus = ArenaStatusEnum::SEARCHED;
rt_mutex_release(&mutex_arenaStatus);
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
const CameraStatusEnum cs = cameraStatus;
rt_mutex_release(&mutex_cameraStatus);
// Only search if camera is already opened
if(CameraStatusEnum::OPENED == cs)
{
// Prepare to close the camera
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
cameraStatus = CameraStatusEnum::CLOSING;
rt_mutex_release(&mutex_cameraStatus);
// Gathering last image
rt_mutex_acquire(&mutex_camera, TM_INFINITE);
img = new Img(cam->Grab());
rt_mutex_release(&mutex_camera);
// Closing camera when prompted
this->CloseCamera();
// Putting the arena overlay if found
a = img->SearchArena();
}
if(a.IsEmpty())
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK));
// If arena is not empty show the arena
else {
// Adding overlay on the image
img->DrawArena(a);
// Sending it to the writing queue
MessageImg *msgImg = new MessageImg(MESSAGE_CAM_IMAGE, img);
rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
monitor.Write(msgImg);
rt_mutex_release(&mutex_monitor);
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK));
}
}
// ARENA_CONFIRM / INFIRM
if((ArenaStatusEnum::CONFIRM == as) || (ArenaStatusEnum::INFIRM == as))
{
rt_mutex_acquire(&mutex_arena, TM_INFINITE);
arena = a;
rt_mutex_release(&mutex_arena);
// empty the temporary arena
a = Arena();
// Re-open the camera (showing overlay if arena is stored)
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
cameraStatus = CameraStatusEnum::OPENING;
rt_mutex_release(&mutex_cameraStatus);
this->OpenCamera();
// Change the status of the arena to default value
rt_mutex_acquire(&mutex_arenaStatus, TM_INFINITE);
arenaStatus = ArenaStatusEnum::NONE;
rt_mutex_release(&mutex_arenaStatus);
}
}
}
/************************************************************************/
/* Added functions */
/************************************************************************/
void Tasks::SendBattery(int& rs, bool& be)
{
// Verify that the robot has started
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
rs = robotStarted;
rt_mutex_release(&mutex_robotStarted);
// Checking if battery should be gathered
rt_mutex_acquire(&mutex_batteryGet, TM_INFINITE);
be = batteryEnabled;
rt_mutex_release(&mutex_batteryGet);
if ((rs != 0) && be) {
// Acquire the battery level and send it to the message queue
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
Message* msg = robot.Write(new Message(MESSAGE_ROBOT_BATTERY_GET));
rt_mutex_release(&mutex_robot);
WriteInQueue(&q_messageToMon, msg);
}
}
MessageID Tasks::OpenCamera()
{
cout << "Called " << __PRETTY_FUNCTION__ << endl << flush;
// Opening camera
rt_mutex_acquire(&mutex_camera, TM_INFINITE);
const bool isOpened = cam->Open();
rt_mutex_release(&mutex_camera);
// Changing status if succeeded
if(isOpened)
{
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
cameraStatus = CameraStatusEnum::OPENED;
rt_mutex_release(&mutex_cameraStatus);
}
return (isOpened ? MESSAGE_ANSWER_ACK : MESSAGE_ANSWER_NACK);
}
void Tasks::CloseCamera()
{
cout << "\n\nCalled " << __PRETTY_FUNCTION__ << "\n\n" << flush;
// Closing Camera
rt_mutex_acquire(&mutex_camera, TM_INFINITE);
cam->Close();
rt_mutex_release(&mutex_camera);
// Changing Status
rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE);
cameraStatus = CameraStatusEnum::CLOSED;
rt_mutex_release(&mutex_cameraStatus);
}

View file

@ -36,6 +36,33 @@
using namespace std;
/**
* @brief The monitor can change the shared data 'cameraStatus' to
* either 'OPENING' or 'CLOSING'. ManageCamera() will be awake afterwards.
* Then the variable can switch state to open or close the camera.
* Default value should be 'CLOSED'.
*/
enum class CameraStatusEnum {
CLOSED,
OPENING,
OPENED,
CLOSING
};
/**
* @ref CameraStatusEnum "Same principle"
* @brief The arena can change the shared data 'arenaStatus' to
* either 'SEARCHING', 'CONFIRM' or 'INFIRM'. The other status will be
* changed by the task ArenaChoice().
*/
enum class ArenaStatusEnum {
NONE,
SEARCHING,
SEARCHED,
CONFIRM,
INFIRM
};
class Tasks {
public:
/**
@ -52,12 +79,12 @@ public:
* @brief Stops tasks
*/
void Stop();
/**
* @brief Suspends main thread
*/
void Join();
private:
/**********************************************************************/
/* Shared data */
@ -66,7 +93,24 @@ private:
ComRobot robot;
int robotStarted = 0;
int move = MESSAGE_ROBOT_STOP;
/************************************************************************/
/* Added variables */
/************************************************************************/
// when gathering battery, set to true
bool batteryEnabled = false;
// current status of the camera
CameraStatusEnum cameraStatus = CameraStatusEnum::CLOSED;
// camera object
Camera* cam = new Camera(sm, 10);
// current status of the arena
ArenaStatusEnum arenaStatus = ArenaStatusEnum::NONE;
// arena object (overlay of the arena on the img)
Arena arena;
// when gathering position, set to true
bool positionEnabled = false;
/**********************************************************************/
/* Tasks */
/**********************************************************************/
@ -77,6 +121,12 @@ private:
RT_TASK th_startRobot;
RT_TASK th_move;
RT_TASK th_batteryPeriodic;
RT_TASK th_battery;
RT_TASK th_cameraManage;
RT_TASK th_cameraImage;
RT_TASK th_arenaChoice;
/**********************************************************************/
/* Mutex */
/**********************************************************************/
@ -85,6 +135,21 @@ private:
RT_MUTEX mutex_robotStarted;
RT_MUTEX mutex_move;
// Added mutexes
// Locking the variable 'robotBatteryGet'
RT_MUTEX mutex_batteryGet;
// Locking the variable 'cameraStatus'
RT_MUTEX mutex_cameraStatus;
// Locking the variable 'cam'
RT_MUTEX mutex_camera;
// Locking the variable 'arena'
RT_MUTEX mutex_arena;
// Locking the variable 'arenaStatus'
RT_MUTEX mutex_arenaStatus;
// Locking the variable 'positionEnabled'
RT_MUTEX mutex_positionEnabled;
/**********************************************************************/
/* Semaphores */
/**********************************************************************/
@ -93,12 +158,21 @@ private:
RT_SEM sem_serverOk;
RT_SEM sem_startRobot;
// Added semaphores
// Used when we want to show the battery once.
RT_SEM sem_instantBattery;
// Used to call ManageCameraTask (non-periodic)
RT_SEM sem_manageCamera;
// Used to call ArenaChoiceTask (non-periodic)
RT_SEM sem_arenaChoice;
/**********************************************************************/
/* Message queues */
/**********************************************************************/
int MSG_QUEUE_SIZE;
RT_QUEUE q_messageToMon;
/**********************************************************************/
/* Tasks' functions */
/**********************************************************************/
@ -106,17 +180,17 @@ private:
* @brief Thread handling server communication with the monitor.
*/
void ServerTask(void *arg);
/**
* @brief Thread sending data to monitor.
*/
void SendToMonTask(void *arg);
/**
* @brief Thread receiving data from monitor.
*/
void ReceiveFromMonTask(void *arg);
/**
* @brief Thread opening communication with the robot.
*/
@ -126,12 +200,67 @@ private:
* @brief Thread starting the communication with the robot.
*/
void StartRobotTask(void *arg);
/**
* @brief Thread handling control of the robot.
*/
void MoveTask(void *arg);
/************************************************************************/
/* Added Tasks */
/************************************************************************/
/**
* @brief [periodic: 500ms]
* Task managing the battery. When prompted will get the battery
* from the robot and resend it to the monitor.
*/
void BatteryPeriodicTask(void * arg);
void BatteryTask(void * arg);
/**
* @brief Task managing the camera opening and closing. Will check what
* state the camera has and change depending on what the monitor asks.
*/
void ManageCameraTask(void * arg);
/**
* @brief [periodic: 10ms]
* Task Managing the image received by the camera. Will send each frame
* if camera's state is opened.
*/
void ImageCameraTask(void * arg);
/**
* @brief Task managing the Arena.
* Will search for a camera and overlay if found.
* Will store the arena and then show it afterwards.
*/
void ArenaChoiceTask(void * arg);
void FindPositionTask(void * arg);
/************************************************************************/
/* Added functions */
/************************************************************************/
void SendBattery(int& rs, bool& be);
/**
* @brief Thread safe. Will open the camera and change the status if succeeded.
*
* @return MessageID returns MESSAGE_ANSWER_ACK if successful, NACK if not.
*/
MessageID OpenCamera();
/**
* @brief Thread safe. Will close the camera and change the status.
*/
void CloseCamera();
/**********************************************************************/
/* Queue services */
/**********************************************************************/
@ -141,7 +270,7 @@ private:
* @param msg Message to be stored
*/
void WriteInQueue(RT_QUEUE *queue, Message *msg);
/**
* Read a message from a given queue, block if empty
* @param queue Queue identifier
@ -149,7 +278,10 @@ private:
*/
Message *ReadInQueue(RT_QUEUE *queue);
};
#endif // __TASKS_H__

View file

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.cubeprog_external_loaders" value="[]"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug/robot.elf&quot;,&quot;fProjectName&quot;:&quot;robot&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="/home/dimercur/Travail/git/dumber/software/robot/Release/st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fVersion&quot;:1,&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Software system reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Software system reset&quot;,&quot;fLaunchAttribute&quot;:&quot;system_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Hardware reset&quot;,&quot;fLaunchAttribute&quot;:&quot;hardware_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset hardware\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;Core reset&quot;,&quot;fLaunchAttribute&quot;:&quot;core_reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset core\n&quot;],&quot;fCmdOptions&quot;:[&quot;-g&quot;]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[&quot;-g&quot;]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]},&quot;fStartApplication&quot;:true}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverAuto" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverPort" value="cortex_m0"/>
<intAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyPort" value="60000"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.stlink"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/robot.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="robot"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.412926795"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/robot"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="com.st.stm32cube.ide.mcu.debug.launch.HardwareDebugProcessFactory"/>
</launchConfiguration>