From 1d1b2a7e5263d0ccbe194645e68c288d172eaab8 Mon Sep 17 00:00:00 2001 From: dimercur Date: Thu, 11 Jan 2024 17:13:19 +0100 Subject: [PATCH] =?UTF-8?q?Corrections=20de=20quelques=20bugs=20li=C3=A9s?= =?UTF-8?q?=20=C3=A0=20la=20gestion=20des=20commandes=20+=20modifications?= =?UTF-8?q?=20cosmetiques?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 16 ++++ hardware/meca/Dumber_2022/Dumber_2022_git.ipj | Bin 0 -> 10050 bytes software/dumber3/.cproject | 11 +++ .../dumber3/.settings/language.settings.xml | 6 +- software/dumber3/Application/application.c | 16 +++- software/dumber3/Application/config.h | 4 +- software/dumber3/Application/xbee.c | 30 +++++-- software/dumber3/Dumber3 Debug.launch | 9 +- software/robot/robot Release.launch | 78 ++++++++++++++++++ 9 files changed, 150 insertions(+), 20 deletions(-) create mode 100644 hardware/meca/Dumber_2022/Dumber_2022_git.ipj create mode 100644 software/robot/robot Release.launch diff --git a/.gitignore b/.gitignore index 904782b..380a750 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,19 @@ GUI *.7z *.rar +# Images +*.jpg +*.png +*.gif +*.bmp +*.jpeg +*.tiff +*.svg + +# Documents +*.pdf +*.chm + # Trucs de MDK *.uvgui* *.bak @@ -70,4 +83,7 @@ GUI /software/dumber3/Tests/ /software/dumber3/workspace/ +/hardware/meca/Dumber_2022/Pieces/ +/hardware/meca/Dumber_2022/OldVersions/ + /doc/Doc\ robot/doxygen/ diff --git a/hardware/meca/Dumber_2022/Dumber_2022_git.ipj b/hardware/meca/Dumber_2022/Dumber_2022_git.ipj new file mode 100644 index 0000000000000000000000000000000000000000..705267b3c7fa177787d6c92f034dd2c5e772c7df GIT binary patch literal 10050 zcmeI2Z&Two5XSZTK85FA^j!|}AEuNW3gt@M0|q!cebsSd2k3=xmk?S$a=%2|-y@;3 z?0_Avgl0N7o>l6Ie6t#)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%UOS#S%)I^dUpRuBExtbNKtWx?y*$(DQ6 zb(W+PrkJ)KHme?@NEl(TaExcAS_Z85@Dc}=cHF=s+n|=A0x6w-d`q)Z5!)M zt@n`SD&`R4vTNa3w2PU1XfGVl-sD>JZdjCQ8E}4smp;axt1xb3iHhZf zv;2d0!zQI_b*=;?Wy!)?o_dwKS{wGiPp{ZwzG#d?d6og+WBVQ_CF+RGTP##j>97** zRVe#l-J$I9lSKAv7gPW-l7e?yHQ-G z7)8im%w_w+(PfG*es*zp*Lv<2-o$Al#tSv>JdM1JR*800WsiyqT~@frn6O;J<b$x73cS6VNKlR?aW~t$kEprG|VxkZe+O znUTDUtXKKI_5k6&3XRULbPgb&q;FxKGV>25(#ZcFQ=KS>C%W^W*JeFErs3&wIHr3; zpT|F>4bS8KiLyoypU&W|Sk~^*TnQwd#nV%Tb|^gc fuETu;p)b59=uUdncWV0DCGQj5yKn!7Ms)uGE}~=` literal 0 HcmV?d00001 diff --git a/software/dumber3/.cproject b/software/dumber3/.cproject index adf1094..dcb431f 100644 --- a/software/dumber3/.cproject +++ b/software/dumber3/.cproject @@ -74,6 +74,17 @@ + + + + + + + + + + + diff --git a/software/dumber3/.settings/language.settings.xml b/software/dumber3/.settings/language.settings.xml index 3deb75d..04bbd36 100644 --- a/software/dumber3/.settings/language.settings.xml +++ b/software/dumber3/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -27,7 +27,7 @@ - + diff --git a/software/dumber3/Application/application.c b/software/dumber3/Application/application.c index f7a5f81..67b5b79 100644 --- a/software/dumber3/Application/application.c +++ b/software/dumber3/Application/application.c @@ -35,6 +35,10 @@ * 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). * @@ -216,6 +220,7 @@ 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); @@ -405,10 +410,15 @@ 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); - } // 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 + } 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 (((systemInfos.cmd == CMD_MOVE) && (systemInfos.distance ==0)) || ((systemInfos.cmd == CMD_TURN) && (systemInfos.turns ==0))) { systemInfos.endOfMouvement = 1; diff --git a/software/dumber3/Application/config.h b/software/dumber3/Application/config.h index b9231b8..31936ea 100644 --- a/software/dumber3/Application/config.h +++ b/software/dumber3/Application/config.h @@ -44,8 +44,8 @@ * Version in plain text and as a numeric value */ ///@{ -#define SYSTEM_VERSION_STR "2.1" -#define SYSTEM_VERSION 0x0201 // Upper byte: major version, lower byte: minor version +#define SYSTEM_VERSION_STR "2.2" +#define SYSTEM_VERSION 0x0202 // Upper byte: major version, lower byte: minor version ///@} #define STACK_SIZE 0x100 diff --git a/software/dumber3/Application/xbee.c b/software/dumber3/Application/xbee.c index d52a8ba..816c654 100644 --- a/software/dumber3/Application/xbee.c +++ b/software/dumber3/Application/xbee.c @@ -40,6 +40,11 @@ /** @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 + * * @{ */ @@ -110,9 +115,7 @@ 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 @@ -122,9 +125,7 @@ StaticSemaphore_t xSemaphoreTX; */ void XBEE_Init(void) { xHandleSemaphoreTX = xSemaphoreCreateBinaryStatic( &xSemaphoreTX ); - //xHandleSemaphoreTX_ACK = xSemaphoreCreateBinaryStatic( &xSemaphoreTX_ACK ); xSemaphoreGive(xHandleSemaphoreTX); - //xSemaphoreTake(xHandleSemaphoreTX_ACK); xHandleSemaphoreRX = xSemaphoreCreateBinaryStatic( &xSemaphoreRx ); @@ -204,10 +205,6 @@ 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); @@ -261,6 +258,12 @@ 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 */ @@ -298,6 +301,12 @@ 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 */ @@ -306,6 +315,11 @@ 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; diff --git a/software/dumber3/Dumber3 Debug.launch b/software/dumber3/Dumber3 Debug.launch index d7cc674..10b1f0c 100644 --- a/software/dumber3/Dumber3 Debug.launch +++ b/software/dumber3/Dumber3 Debug.launch @@ -35,10 +35,11 @@ - + + @@ -70,7 +71,7 @@ - + @@ -80,9 +81,9 @@ - + - + diff --git a/software/robot/robot Release.launch b/software/robot/robot Release.launch new file mode 100644 index 0000000..12e8e37 --- /dev/null +++ b/software/robot/robot Release.launch @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +