Skip to content

Commit a47a1ee

Browse files
committed
same types for gen/sim/prog
1 parent 68c6f03 commit a47a1ee

14 files changed

Lines changed: 1682 additions & 1572 deletions

File tree

doc/gabarit/calibrage.pdf

0 Bytes
Binary file not shown.

src/generateur/drawbot.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
######################################################################
44
QT += widgets
55
TEMPLATE = app
6-
TARGET = drawbot
6+
TARGET = generateur
77
DEPENDPATH += .
88
INCLUDEPATH += .
99

src/generateur/mainwin.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
3131
}
3232
void MainWin::writeSettings()
3333
{
34-
QSettings settings("./mainwindow.ini", QSettings::IniFormat);
34+
QSettings settings("./prefs.ini", QSettings::IniFormat);
3535

3636
settings.clear();
3737
settings.beginGroup("MainWindow");
38-
settings.setValue("size", size());
39-
settings.setValue("pos", pos());
40-
settings.setValue("maximized", isMaximized());
38+
settings.setValue("pos", pos());
4139
settings.endGroup();
4240

4341
settings.beginGroup("Fichiers");
@@ -52,20 +50,10 @@ void MainWin::writeSettings()
5250

5351
void MainWin::readSettings()
5452
{
55-
QSettings settings("./mainwindow.ini", QSettings::IniFormat);
53+
QSettings settings("./prefs.ini", QSettings::IniFormat);
5654

5755
settings.beginGroup("MainWindow");
58-
if(settings.value("maximized").toBool())
59-
{
60-
resize(800,400);
61-
move(200, 200);
62-
showMaximized ();
63-
}
64-
else
65-
{
66-
resize(settings.value("size", QSize(800, 400)).toSize());
6756
move(settings.value("pos", QPoint(200, 200)).toPoint());
68-
}
6957
settings.endGroup();
7058

7159
settings.beginGroup("Fichiers");
@@ -191,14 +179,12 @@ void MainWin::setTitle(const QString &fileName)
191179
else
192180
shownName = QFileInfo(fileName).absoluteFilePath();
193181

194-
setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Tableau Blanc")));
195-
// qDebug() << "setTitle";
182+
setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("Générateur de points")));
196183
}
197184

198185
void MainWin::setStatus(const QString &msg){
199-
// statusBar()->showMessage(msg);
200186
infoStatus->setText(msg);
201187
}
202188

203189
void MainWin::about()
204-
{ QMessageBox::information(this, tr("A Propos"), tr("Tableau Blanc\nDessin à main levée\nAvec sérialisation")); }
190+
{ QMessageBox::information(this, tr("A Propos"), tr("Point List Generator\nDrawbot\nhttps://github.com/HE-Arc/drawbot")); }

src/generateur/sheet.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Sheet::Sheet(QWidget *parent) : QWidget(parent)
66
{
77
fileNew();
88
mag = 3; // 3px for 1mm on the robot
9-
setWindowTitle("Sans Titre[*] - Dessin pour drawbot Arc");
9+
setWindowTitle("Sans Titre[*] - Generateur de points");
1010
setFixedSize(297*mag,210*mag);
1111
}
1212

@@ -113,8 +113,8 @@ void Sheet::readFile()
113113
x = c[0].toDouble();
114114
y = c[1].toDouble();
115115

116-
x = x*mag + 148.5*mag;
117-
y = -y*mag + 210*mag;
116+
x = (x*mag/100 + 148.5*mag);
117+
y = (-y*mag/100 + 210*mag);
118118

119119
p = QPoint(x, y);
120120
qDebug() << p;
@@ -161,12 +161,12 @@ void Sheet::save()
161161
}
162162

163163
QTextStream sout(&fileDest);
164-
double x, y;
165-
sout << "double liste[] = {" << endl;
164+
int x, y;
165+
sout << " const int liste[] PROGMEM = {" << endl;
166166
foreach(QPoint p, liste) {
167167
// Chgt coordonnées widget -> feuille
168-
x = (p.x() - 148.5*mag)/mag;
169-
y = (210*mag - p.y())/mag;
168+
x = 100*(p.x() - 148.5*mag)/mag;
169+
y = 100*(210*mag - p.y())/mag;
170170
sout << QString::number(x) << ", " << QString::number(y) << ", " << endl;
171171
}
172172
sout << "};" << endl;

src/generateur/sheet.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class Sheet : public QWidget
1313
Q_OBJECT
1414
public:
1515
Sheet(QWidget *parent = 0);
16-
// ~Sheet();
17-
// QString getFileName();
18-
// QStringList getFileNames();
1916

2017
public slots:
2118
void fileNew();
@@ -43,7 +40,6 @@ class Sheet : public QWidget
4340
QStack<int> pileUndo;
4441
double zoom, mag;
4542
QString fileName;
46-
//MainWin* mw;
4743
void updateStatus();
4844

4945
signals:

src/programme/cinematique.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
bool isInside(double x, double y){
2+
bool isInside(float x, float y){
33
if( x<MIN_X+COR_X ){
44
Serial.print("OUT X");
55
Serial.print(x);
@@ -38,9 +38,9 @@ bool isInside(double x, double y){
3838
else return false;
3939
}
4040

41-
bool toAngle(double x, double y){
41+
bool toAngle(float x, float y){
4242
// Merci Julien Marchand et François Tièche !!!
43-
double r, t, alpha, beta, gamma, halfPerimeter, angleR1, angleR2;
43+
float r, t, alpha, beta, gamma, halfPerimeter, angleR1, angleR2;
4444
bool lefty = false; // pas utile avec la config mécanique choisie
4545

4646
old1 = angle1;
@@ -92,18 +92,18 @@ bool toAngle(double x, double y){
9292
void moveServos()
9393
{
9494
// Si grande distance ralentir mouvement
95-
/* double delta =3;
95+
/* float delta =3;
9696
int inc;
9797
9898
if (abs(angle1-old1)>delta) {
9999
if (angle1 > old1) {
100-
for (double i=old1; i<angle1; i+=1) {
100+
for (float i=old1; i<angle1; i+=1) {
101101
s1.write(i);
102102
delay(VITESSE);
103103
}
104104
}
105105
else {
106-
for (double i=angle1; i<old1; i-=1) {
106+
for (float i=angle1; i<old1; i-=1) {
107107
s1.write(i);
108108
delay(VITESSE);
109109
}
@@ -112,13 +112,13 @@ void moveServos()
112112
113113
if (abs(angle2-old2)>delta) {
114114
if (angle2 > old2) {
115-
for (double i=old2; i<angle2; i+=1) {
115+
for (float i=old2; i<angle2; i+=1) {
116116
s2.write(i);
117117
delay(VITESSE);
118118
}
119119
}
120120
else {
121-
for (double i=angle2; i<old2; i-=1) {
121+
for (float i=angle2; i<old2; i-=1) {
122122
s2.write(i);
123123
delay(VITESSE);
124124
}

src/programme/declarations.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <avr/pgmspace.h>
12
#include <Servo.h>
23
#include <EEPROM.h>
34
#include <math.h>
@@ -8,29 +9,29 @@ const int VITESSE=0; // Pause en ms après un mouvement
89
const int ANGLE_MIN=5; // si angle2 < ANGLE_MIN collision avant-bras avec bras
910
const int MIN_US=550, MAX_US=2350; // Commande servo en us (tester 700-2300)
1011
const int COR_X=5, COR_Y=12; // Corrections x,y
11-
double COR_S1=16.8, COR_S2=-3.4; // Correction angle servos en degrés
12-
const double SHIFT_S1_ANGLE=7.5;
13-
const double MIN_X=-130;
14-
const double MAX_X=130;
15-
const double MIN_Y=10;
16-
const double MAX_Y=205;
12+
float COR_S1=16.8, COR_S2=-3.4; // Correction angle servos en degrés
13+
const float SHIFT_S1_ANGLE=7.5;
14+
const float MIN_X=-130;
15+
const float MAX_X=130;
16+
const float MIN_Y=10;
17+
const float MAX_Y=205;
1718

1819
// VARIABLES
1920
Servo s1, s2; // s1: épaule (en A), s2: coude (en B)
20-
double lg1=149, lg2=130; // longueur des bras (mm) lg1 = AB (bras), lg2 = BC (avant-bras)
21-
double angle1, angle2; // position servos en degrés de s1 et s2
22-
double old1, old2; // position précédente des angles
23-
double pas = 0.5; // distance souhaitée en mm entre 2 points
24-
double par = M_PI/180; // angle en radians entre deux calculs de points (1°)
21+
float lg1=149, lg2=130; // longueur des bras (mm) lg1 = AB (bras), lg2 = BC (avant-bras)
22+
float angle1, angle2; // position servos en degrés de s1 et s2
23+
float old1, old2; // position précédente des angles
24+
float pas = 0.5; // distance souhaitée en mm entre 2 points
25+
float par = M_PI/180; // angle en radians entre deux calculs de points (1°)
2526
bool microsec = true; // Mode précis (0.1°) si true
2627
bool debug = true; // Affiche les déplacements dans le moniteur série
2728

28-
void log(char msg[], double t, double x, double y){
29+
void log(char msg[], float t, float x, float y){
2930
Serial.print(msg);Serial.print(" - t:");Serial.print(t);Serial.print(":(");Serial.print(x);
3031
Serial.print(","); Serial.print(y);Serial.println(")");
3132
}
3233

33-
void log(double x, double y){
34+
void log(float x, float y){
3435
Serial.print("angles: S1:");Serial.print(angle1);Serial.print(" S2:");Serial.println(angle2);
3536
Serial.print(" (x,y) : (");Serial.print(x);Serial.print(",");Serial.print(y);Serial.println(")\n");
3637
}
@@ -55,7 +56,6 @@ void lectureCorrectif(){
5556
Serial.print("EEPROM:Epaule=");Serial.print(epaule);Serial.print(", Coude=");Serial.print(coude);
5657
Serial.print(", Cor en us : (");Serial.print(cor_epaule);Serial.print(",");Serial.print(cor_coude);
5758
Serial.print("), Cor en degrés : (");Serial.print(COR_S1);Serial.print(",");Serial.print(COR_S2); Serial.print(")");
58-
Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");
59-
59+
// Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");Serial.println("ok");
6060
}
6161

0 commit comments

Comments
 (0)