mirror of
https://github.com/RobotechLille/cdf2018-principal
synced 2024-12-22 05:30:37 +01:00
Misc
This commit is contained in:
parent
9802230d13
commit
d30f0ed548
|
@ -36,24 +36,26 @@ void barilletUnCran()
|
|||
{
|
||||
|
||||
ax12a.setEndless(ID, ON);
|
||||
ax12a.turn(ID, LEFT, 1220);
|
||||
ax12a.turn(ID, LEFT, 1224);
|
||||
delay(978);
|
||||
ax12a.turn(ID, LEFT, 200);
|
||||
delay(100);
|
||||
ax12a.turn(ID, LEFT, 1224);
|
||||
delay(100);
|
||||
ax12a.turn(ID, LEFT, 0);
|
||||
}
|
||||
|
||||
void barilletDeuxCrans()
|
||||
{
|
||||
|
||||
ax12a.setEndless(ID, ON);
|
||||
ax12a.turn(ID, LEFT, 1220);
|
||||
ax12a.turn(ID, LEFT, 1224);
|
||||
delay(1955);
|
||||
ax12a.turn(ID, LEFT, 200);
|
||||
delay(100);
|
||||
ax12a.turn(ID, LEFT, 1224);
|
||||
delay(100);
|
||||
ax12a.turn(ID, LEFT, 0);
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
@ -96,11 +98,9 @@ void loop()
|
|||
break;
|
||||
case 'B': // Tourner barillet d'un cran
|
||||
barilletUnCran();
|
||||
delay(500);
|
||||
break;
|
||||
case 'H': // Tourner de deux crans
|
||||
barilletDeuxCrans();
|
||||
delay(500);
|
||||
break;
|
||||
case 'R': // Reset barillet
|
||||
// ax12a.setEndless(ID, OFF);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#define FPGA_PORTNAME "/dev/ttyUSB0"
|
||||
#define CF_BAUDRATE B115200
|
||||
// #define PRINTRAWDATA
|
||||
//
|
||||
|
||||
typedef void (*rxHandler)(void);
|
||||
|
||||
void registerRxHandlerCF(unsigned char code, rxHandler handler); // À utiliser après configureCF();
|
||||
|
|
|
@ -97,7 +97,7 @@ bool diagJustRun(void* arg)
|
|||
{
|
||||
void (*fonction)(void) = arg;
|
||||
fonction();
|
||||
usleep(1000*1000);
|
||||
usleep(300*1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -160,8 +160,8 @@ void runDiagnostics()
|
|||
i = 3;
|
||||
execDiagnostic("Mot+Cod R AR", diagCodeuse, &i);
|
||||
|
||||
execDiagnostic("Fermeture loquet", diagJustRun, &diagSetLoquetFerme);
|
||||
execDiagnostic("Ouverture loquet", diagJustRun, &diagSetLoquetOuvert);
|
||||
execDiagnostic("Fermeture loquet", diagJustRun, &diagSetLoquetFerme);
|
||||
execDiagnostic("Reset barillet", diagJustRun, &barilletReset);
|
||||
execDiagnostic("T+1 barillet", diagJustRun, &barilletSuivant);
|
||||
execDiagnostic("T+2 barillet", diagJustRun, &barilletSkip);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#define DIAGNOSTIC_TENSION_TEST 3
|
||||
#define DIAGNOSTIC_CODEUSES_DIFF_MIN 100
|
||||
#define DIAGNOSTIC_TEMPS_ROTATION 250
|
||||
#define DIAGNOSTIC_TEMPS_ROTATION 500
|
||||
|
||||
typedef bool (*diagnosticFunc)(void* arg);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define MOTOR_CONTROLLER_ALIMENTATION 24.0 // V (from elec)
|
||||
#define MOTOR_CONTROLLER_REFERENCE 5 // V (from wiring)
|
||||
#define MOTOR_SATURATION_MIN 0 // V (from random)
|
||||
#define MOTOR_SATURATION_MAX 12.0 // V (from testing)
|
||||
#define MOTOR_SATURATION_MAX 3.0 // V (from testing)
|
||||
#define PWM_MAX 3.3 // V (from FPGA datasheet)
|
||||
#define CODER_RESOLUTION 370.0 // cycles/motor rev
|
||||
#define CODER_DATA_FACTOR 4.0 // increments/motor cycles
|
||||
|
@ -38,8 +38,8 @@
|
|||
#define O_DIR_ECART_MIN (5.0 / 360.0 * 2.0 * M_PI) // rad
|
||||
#define O_DIR_ECART_MAX (25.0 / 360.0 * 2.0 * M_PI) // rad
|
||||
#define O_ECART_MAX (25.0 / 360.0 * 2.0 * M_PI) // rad
|
||||
#define O_GAIN 3.0
|
||||
#define P 7.0
|
||||
#define O_GAIN 5.0
|
||||
#define P 5.0
|
||||
#define I 0.0
|
||||
#define D 0.0
|
||||
|
||||
|
|
|
@ -21,6 +21,19 @@ void initLCD()
|
|||
pinMode(LCD_ON_PIN, OUTPUT);
|
||||
}
|
||||
|
||||
void eraseLCD()
|
||||
{
|
||||
lockLCD();
|
||||
sendLCD(0x01, LCD_MODE_CMD);
|
||||
sendLCD(0x02, LCD_MODE_CMD);
|
||||
|
||||
for (int i = 0; i < LCD_NB_TOTAL; i++) {
|
||||
virtual[i] = ' ';
|
||||
}
|
||||
unlockLCD();
|
||||
}
|
||||
|
||||
|
||||
void onLCD()
|
||||
{
|
||||
digitalWrite(LCD_ON_PIN, LOW);
|
||||
|
@ -32,7 +45,7 @@ void onLCD()
|
|||
sendLCD(0x06, LCD_MODE_CMD); // Cursor move direction
|
||||
sendLCD(0x0C, LCD_MODE_CMD); // Blink Off
|
||||
sendLCD(0x28, LCD_MODE_CMD); // Data length, number of lines, font size
|
||||
clearLCD();
|
||||
eraseLCD();
|
||||
|
||||
delay(50);
|
||||
}
|
||||
|
@ -57,14 +70,8 @@ void resetLCD()
|
|||
|
||||
void clearLCD()
|
||||
{
|
||||
lockLCD();
|
||||
sendLCD(0x01, LCD_MODE_CMD);
|
||||
sendLCD(0x02, LCD_MODE_CMD);
|
||||
|
||||
for (int i = 0; i < LCD_NB_TOTAL; i++) {
|
||||
virtual[i] = ' ';
|
||||
}
|
||||
unlockLCD();
|
||||
offLCD();
|
||||
onLCD();
|
||||
}
|
||||
|
||||
void gotoLCD(uint8_t line)
|
||||
|
|
14
simu/simu.m
14
simu/simu.m
|
@ -3,7 +3,7 @@ SIMULATION = 0;
|
|||
|
||||
% Paramètres de lecture
|
||||
DIRNAME = "/home/geoffrey/CdF/cdf2018-principal/log/";
|
||||
FILENAME = "000471.csv";
|
||||
FILENAME = "000655.csv";
|
||||
PATH = DIRNAME + FILENAME;
|
||||
|
||||
% Paramètres de simulation
|
||||
|
@ -33,7 +33,7 @@ motorNominalTension = 24.0; % V (from datasheet)
|
|||
motorControllerAlimentation = 24.0; % V (from elec)
|
||||
motorControllerReference = 5; % V (from wiring)
|
||||
motorSaturationMin = 0; % V (from random)
|
||||
motorSaturationMax = 12.0; % V (from testing)
|
||||
motorSaturationMax = 3.0; % V (from testing)
|
||||
pwmMax = 3.3; % V (from FPGA datasheet)
|
||||
coderResolution = 370.0; % cycles/motor rev
|
||||
coderDataFactor = 4.0; % increments/motor cycles
|
||||
|
@ -51,8 +51,8 @@ dDirEcartMax = 10.0; % mm
|
|||
oDirEcartMin = (5.0 / 360.0 * 2.0 * pi); % rad
|
||||
oDirEcartMax = (25.0 / 360.0 * 2.0 * pi); % rad
|
||||
oEcartMax = (25.0 / 360.0 * 2.0 * pi); % rad
|
||||
oGain = 3.0;
|
||||
P = 7.0;
|
||||
oGain = 5.0;
|
||||
P = 5.0;
|
||||
I = 0.0;
|
||||
D = 0.0;
|
||||
|
||||
|
@ -130,13 +130,15 @@ legend("Gauche", "Droite", "Err. gauche", "Err. droite");
|
|||
% Distance
|
||||
p = subplot(2, 2, 3);
|
||||
hold on;
|
||||
timeGraph(["dDirEcart", "dErr"]);
|
||||
%timeGraph(["dDirEcart", "dErr"]);
|
||||
timeGraph(["dDirEcart", "dErr", "secFront", "secBack"]);
|
||||
addLimitline(p, dDirEcartMin);
|
||||
addLimitline(p, dDirEcartMax);
|
||||
title("Distance");
|
||||
xlabel("Temps (s)");
|
||||
ylabel("Distance (mm)");
|
||||
legend("Ecart direction", "Err. retenue");
|
||||
%legend("Ecart direction", "Err. retenue");
|
||||
legend("Ecart direction", "Err. retenue", "Distance avant", "Distance arrière");
|
||||
|
||||
% Rotation
|
||||
p = subplot(2, 2, 4);
|
||||
|
|
Loading…
Reference in a new issue