0% found this document useful (0 votes)
12 views2 pages

Examen de Robotique 2023/2024

The document contains two coding exercises. The first exercise involves calculating the radius of a turn, change in angle, and change in position based on drive speeds and pause times. The second exercise involves coding a robot to draw a regular polygon using drive_goto and pause functions in a for loop, calculating ticks for the side length and angle based on geometry formulas.

Uploaded by

fatimakhalil929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Examen de Robotique 2023/2024

The document contains two coding exercises. The first exercise involves calculating the radius of a turn, change in angle, and change in position based on drive speeds and pause times. The second exercise involves coding a robot to draw a regular polygon using drive_goto and pause functions in a for loop, calculating ticks for the side length and angle based on geometry formulas.

Uploaded by

fatimakhalil929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Initiation à la robotique – 2ITE S2

2023/2024
Examen (Correction)

Exercice 1 :
Soit le code suivant :
drive_speed(128, 128);
pause(1000);
drive_speed(128, 83);
pause(2266);
drive_speed(128, 128);
pause(1000);
drive_speed(0, 0);
On suppose que la position de départ du robot est (𝑥0 = 0, 𝑦0 = 0) est l’orientation initial est
𝜃0 = 0° .
Après l’exécution du code :
1. Calculer le rayon du virage 𝑟𝑚
𝑑 𝑑 𝑟 −𝑟
𝑟𝑙 = 𝜃𝑙 et 𝑟𝑟 = 𝜃𝑟 𝑟𝑚 = 𝑙 2 𝑟=248 mm
2. Calculer le changement d'angle 𝜃𝑓 .
𝑑𝑙 − 𝑑𝑟
𝜃𝑓 = = 180°
𝑤
3. Calculer le changement de position 𝑥𝑓 𝑒𝑡 𝑦𝑓 .

𝑥1 = 0, 𝑦1 = 128 ∗ 1 ∗ 3,25 = 416


𝑥2 = 496, 𝑦2 = 128 ∗ 1 ∗ 3,25 = 416
𝑥2 = 496, 𝑦2 = 0

Exercice 2 :
#include "simpletools.h" // Include simpletools

#include "abdrive.h"

int main() // Main function

float pi, ext_pol_angle,side;

int n = 36;

Pr Errattahi
int r = 150;

pi = 4 * atan(1);

ext_pol_angle = 2 * pi / n;

int ticks_for_angle = round(ext_pol_angle * (52.9/2.35)); //


number of ticks

side = sqrt(2) * r * sqrt(1-cos(2*pi/n));

int Side_ticks = round(side/3.25);

for (int i = 1; i <= n; i++)

drive_goto(Side_ticks,Side_ticks);

pause(10);

drive_goto(ticks_for_angle, -ticks_for_angle);

pause(10);

Pr Errattahi

You might also like