Modifications

Sauter à la navigation Sauter à la recherche
1 301 octets supprimés ,  8 mars 2021 à 16:28
Ligne 1 : Ligne 1 : −
{{Redirect|C programming language|the book|The C Programming Language}}
  −
{{Use mdy dates|date=March 2020}}
  −
{{short description|general-purpose programming language}}
  −
{{Infobox programming language
  −
| name = C
  −
| logo = File:The C Programming Language logo.svg
  −
| logo size = 140px
  −
| logo alt = Text in light blue serif capital letters on white background and very large light blue sans-serif letter C.
  −
| logo caption = ''[[The C Programming Language]]''<ref name="k&r1e" /> (often referred to as ''K&R''), the seminal book on C
  −
| paradigm = [[Imperative programming|Imperative]] ([[Procedural programming|procedural]]), [[structured programming|structured]]
  −
| designer = [[Dennis Ritchie]]
  −
| developer = [[Dennis Ritchie]] & [[Bell Labs]] (creators); ANSI X3J11 ([[ANSI C]]); {{nobr|ISO/IEC JTC1/SC22/WG14}} (ISO C)
  −
| latest release version = [[C17 (C standard revision)|C17]]
  −
| latest release date = {{start date and age|2018|06}}
  −
| latest preview version = [[C2x]] ([http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2596.pdf N2596])
  −
| latest preview date = {{start date and age|2020|12|11}}<ref>{{cite web |url=https://en.cppreference.com/w/c/language/history
  −
|title=History of C |last=Fruderica |date=13 December 2020 |work=The cppreference.com |access-date=24 October 2020}}</ref>
  −
| typing = [[Type system|Static]], [[Weak typing|weak]], [[manifest typing|manifest]], [[Nominal type system|nominal]]
  −
| implementations = [[#K&R C|K&R C]], [[GNU Compiler Collection|GCC]], [[Clang]], {{nowrap|[[Intel C++ Compiler|Intel C]],}} [[C++Builder]], {{nowrap|[[Microsoft Visual C++]]}}, {{nowrap|[[Watcom C/C++|Watcom C]]}}
  −
| dialects = [[Cyclone (programming language)|Cyclone]], [[Unified Parallel C]], [[Split-C]], [[Cilk]], [[C*]]
  −
| influenced = [[:Category:C programming language family|Numerous]]: [[AMPL]], [[AWK]], [[C shell|csh]], [[C++]], [[C--]], [[C Sharp (programming language)|C#]], [[Objective-C]], [[D (programming language)|D]], [[Go (programming language)|Go]], [[Java (programming language)|Java]], [[JavaScript]], [[Julia (programming language)|Julia]], [[Limbo (programming language)|Limbo]], [[LPC (programming language)|LPC]], [[Perl]], [[PHP]], [[Pike (programming language)|Pike]], [[Processing (programming language)|Processing]], [[Python (programming language)|Python]], [[Rust (programming language)|Rust]], [[Seed7]], [[Vala (programming language)|Vala]], [[Verilog]] (HDL),<ref name="vinsp">{{cite web|title=Verilog HDL (and C)|url=http://cs.anu.edu.au/courses/ENGN3213/lectures/lecture6_VERILOG_2010.pdf|date=June 3, 2010|access-date=August 19, 2013|publisher=The Research School of Computer Science at the Australian National University|quote=1980s: ; Verilog first introduced ; Verilog inspired by the C programming language|url-status=dead|archive-url=https://web.archive.org/web/20131106064022/http://cs.anu.edu.au/courses/ENGN3213/lectures/lecture6_VERILOG_2010.pdf|archive-date=November 6, 2013}}</ref> [[Nim (programming language)|Nim]], [[Zig (programming language)|Zig]]
  −
| operating system = [[Cross-platform]]
  −
| year = {{start date and age|1972}}<ref name="dottcl_2" />
  −
| turing-complete = Yes
  −
| influenced_by = [[B (programming language)|B]] ([[BCPL]], [[CPL (programming language)|CPL]]), [[ALGOL 68]],<ref name="dottcl" /> [[Assembly language|Assembly]], [[PL/I]], [[FORTRAN]]
  −
| file ext = .c, .h
  −
| website = {{URL|https://www.iso.org/standard/74528.html}}<br/> {{URL|http://www.open-std.org/jtc1/sc22/wg14/}}
  −
| wikibooks = C Programming
  −
}}
  −
   
Dans cette partie nous décrivons l'état du robot actuel, nos décisions, les projets en cours autour du robot. Cette année nous sommes suffisamment nombreux pour travailler sur un deuxième robot que nous vous encourageons à consulter également.
 
Dans cette partie nous décrivons l'état du robot actuel, nos décisions, les projets en cours autour du robot. Cette année nous sommes suffisamment nombreux pour travailler sur un deuxième robot que nous vous encourageons à consulter également.
   Ligne 77 : Ligne 47 :     
=Actionneurs=
 
=Actionneurs=
 +
 +
=Explication Programme=
 +
Le programme peut être séparé en 3 principales parties :
 +
- Le Main.c et FreeRTOS
 +
- Les fichiers de configuration
 +
- Les tâches
 +
==Main.c et FreeRTOS==
 +
 +
==Les fichiers de configuration==
 +
 +
===Odometry===
 +
====MCP233.c====
 +
Ce fichier contient les commandes permettant de configurer le moteur
 +
====rbtMovement.c====
 +
On trouvera ici toutes les commandes de déplacement pour le robot
 +
 +
<syntaxhighlight lang="c">
 +
void rbtMovement Init ( uint16_t whDist , uint16_t dmWh1, uint16_t dmWh2,
 +
uint16_t ticks 1 , uint16_t ticks 2 )
 +
</syntaxhighlight>
 +
 +
Cette fonction permet de configurer les encodeurs :
 +
 +
1. whDist = distance entre les 2 encodeurs
 +
 +
2. dmWh1 et dmWh2 = diamètre en mm de chaque encodeur
 +
 +
3. ticks1 et ticks2 = nombre de ticks par rotation des encodeurs
 +
 +
<syntaxhighlight lang="c">
 +
void rbtMove ( int32_t dist ) //Deplacement du robo t en ligne droite en mm
 +
void rbt_turn ( int16_t angle ) // Rotation du robot en degre
 +
</syntaxhighlight>
 +
 +
 +
<syntaxhighlight lang="c">
 +
static void rb tS ta teMachine ( int32_t targetEncoderCountsM1 , int32_ttargetEncoderCountsM2 )
 +
</syntaxhighlight>
 +
 +
Cette fonction permet de recevoir l’état du robot :
 +
 +
1. BLOCKED = le robot ne bouge pas
 +
 +
2. READY_TO_SEND = prêt à envoyer une commande
 +
 +
3. IDLE = prêt à recevoir une commmande
 +
 +
4. BUSY = En train d’exécuter une commande
 +
 +
5. PAUSED = une commande a été annulée, le mouvement doit reprendre avant de repasser en état IDLE
 +
 +
6. RESUMING = compléte la commande qui a été annulée avant de repasser en IDLE
 +
 +
==Tâches==
 +
 +
===movementTask.c===
 +
 +
Les taches que le robot pourra effectuer Pour l’instant il n'y en a qu’une seule : movement-Task.c
    
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
long some_function();
+
#include "movementTask.h"
/* int */ other_function();
+
#include "rbtMovement.h"
 +
#include "MCP233.h"
   −
/* int */ calling_function()
  −
{
  −
    long test1;
  −
    register /* int */ test2;
     −
     test1 = some_function();
+
/* Variables */
    if (test1 > 0)
+
 
          test2 = 0;
+
robotState_t robotState = BLOCKED;
    else
+
 
          test2 = other_function();
+
 
    return test2;
+
/* Task */
 +
 
 +
     void StartSendMovementCmd(void const * argument){
 +
/******** Initializations ********/
 +
//TODO measure accurately
 +
 +
rbtMovementInit(265, 88, 88, 4096, 4096);
 +
drive_forward(0); //making sure that the MCP command buffer is empty
 +
 
 +
robotState = IDLE;
 +
 
 +
/******** Movement path command list ********/
 +
 +
/*Aller retour x2*/
 +
 +
rbtMove(1000); //distance en mm
 +
rbt_turn(180); //angle en degres, (-) pour tourner a gauche et (+) pour tourner a droite
 +
rbtMove(1000);
 +
rbt_turn(180);
 +
 
 +
while(1){
 +
osDelay(1); //boucle pour debugger, le programme devrait rester bloquer ici a la fin de son execution
 +
}
 +
 
 +
  /* USER CODE END 5 */
 
}
 
}
 +
 
</syntaxhighlight>
 
</syntaxhighlight>
38

modifications

Menu de navigation