Hallo, ich bin neu hier und habe ein paar Fragen zum kompilieren meines Quellcodes. Auch nach längerem Nachforschen und googeln konnte ich bis dato leider keine Lösung finden, drum wende ich mich hiermit an euch:
Ich habe von der Standard-Asuro-CD alles installiert, wie es in der Anleitung steht und kann den beschriebenen Selftest ausführen. So weit, so gut - wenn ich allerdings eines der Beispielprogramme (z.b. "line_kollision") mit dem Befehl "make" kompilieren möchte, erscheint ein endlos langer Fehlertext:
> "D:\Studium\Automation_2\Asuro\Muster_Programme_AS URO\ASURO_src\FirstTry_Roland\Test-all.bat"
D:\Studium\Automation_2\Asuro\Muster_Programme_ASU RO\ASURO_src\FirstTry_Roland>make all
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=asuro.lst asuro.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > asuro.d; \
[ -s asuro.d ] || rm -f asuro.d
asuro.c:49:19: error: asuro.h: No such file or directory
set -e; avr-gcc -MM -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c \
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > test.d; \
[ -s test.d ] || rm -f test.d
test.c:11:19: error: asuro.h: No such file or directory
-------- begin --------
avr-gcc --version
avr-gcc (WinAVR 20090313) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
avr-gcc -c -mmcu=atmega8 -I. -g -Os -I../../lib/inc -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-ahlms=test.lst test.c -o test.o
test.c:11:19: error: asuro.h: No such file or directory
test.c: In function 'FollowLine':
test.c:29: error: 'FWD' undeclared (first use in this function)
test.c:29: error: (Each undeclared identifier is reported only once
test.c:29: error: for each function it appears in.)
test.c:31: warning: implicit declaration of function 'LineData'
test.c:32: error: 'LEFT' undeclared (first use in this function)
test.c:32: error: 'RIGHT' undeclared (first use in this function)
test.c:33: warning: implicit declaration of function 'FrontLED'
test.c:33: error: 'ON' undeclared (first use in this function)
test.c:34: warning: implicit declaration of function 'BackLED'
test.c:34: error: 'OFF' undeclared (first use in this function)
test.c:35: warning: implicit declaration of function 'StatusLED'
test.c:35: error: 'GREEN' undeclared (first use in this function)
test.c:67: warning: implicit declaration of function 'MotorDir'
test.c:88: error: 'RED' undeclared (first use in this function)
test.c:103: error: 'BREAK' undeclared (first use in this function)
test.c:106: warning: implicit declaration of function 'MotorSpeed'
test.c: In function 'MotorRwd':
test.c:114: error: 'RWD' undeclared (first use in this function)
test.c: In function 'MotorRwdL':
test.c:121: error: 'RWD' undeclared (first use in this function)
test.c:121: error: 'FWD' undeclared (first use in this function)
test.c: In function 'MotorRwdR':
test.c:128: error: 'FWD' undeclared (first use in this function)
test.c:128: error: 'RWD' undeclared (first use in this function)
test.c: In function 'main':
test.c:140: warning: implicit declaration of function 'Init'
test.c:141: error: 'ON' undeclared (first use in this function)
test.c:144: error: 'LEFT' undeclared (first use in this function)
test.c:144: error: 'RIGHT' undeclared (first use in this function)
test.c:146: error: 'FWD' undeclared (first use in this function)
test.c:147: error: 'GREEN' undeclared (first use in this function)
test.c:158: warning: implicit declaration of function 'PollSwitch'
test.c:170: error: 'OFF' undeclared (first use in this function)
test.c:172: error: 'RED' undeclared (first use in this function)
test.c:181: warning: implicit declaration of function 'Msleep'
make: *** [test.o] Error 1
> Process Exit Code: 2
> Time Taken: 00:00
Gehe ich recht in der Annahme, dass die Programmbibliothek nicht richtig zugewiesen ist? Habe jetzt schon vieles probiert aber ich bekomme leider immer die selbe Fehlermeldung...
Mein Ziel wäre es, folgenden "Standard-Quellcode" um einige Funktionen zu erweitern (Bei Kollision erst ein Stückgerade zurück und dann ausweichen; Linienverfolgung optimieren; Beschleunigungen etc.)
Code:
#include "asuro.h"
#include <stdlib.h>
#define SPEED 180
#define SPEEDMAX 255
#define SPEEDMIN 170
#define IMAX 16000
#define IMAXALARM 15000
// line stuff
unsigned char speed, j;
int speedLeft,speedRight;
unsigned int lineData[2];
int x, xalt, kp, kd, ki, yp, yd, yi, drest=0, y, y2, isum=0, ADOffset;
void FollowLine (void)
{
unsigned char leftDir = FWD, rightDir = FWD;
LineData(lineData);
x = (lineData[LEFT] - lineData[RIGHT]) - ADOffset;
FrontLED(ON);
BackLED(OFF,OFF);
StatusLED(GREEN);
yp = x*kp;
isum += x;
if (isum > IMAX) isum = IMAX;
if (isum < -IMAX) isum = -IMAX;
yi = isum / 625 * ki;
yd = (x - xalt) * kd;
yd += drest;
if (yd > 255)
{
drest = yd - 255;
}
else if (yd < -255)
{
drest = yd + 255;
}
else
{
drest = 0;
}
if (isum > IMAXALARM) BackLED(OFF,ON);
else if (isum < -IMAXALARM) BackLED(ON,OFF);
else BackLED(OFF,OFF);
y = yp + yi + yd; // PID
y2 = y / 2;
xalt = x;
speedLeft = speedRight = speed;
MotorDir(FWD,FWD);
if ( y > 0)
{
StatusLED(GREEN);
speedLeft = speed + y2;
if (speedLeft > SPEEDMAX)
{
speedLeft = SPEEDMAX;
y2 = speedLeft - speed;
}
y = y - y2;
speedRight = speed - y;
if (speedRight < SPEEDMIN)
{
speedRight = SPEEDMIN;
}
}
if ( y < 0)
{
StatusLED(RED);
speedRight = speed - y2;
if (speedRight > SPEEDMAX)
{
speedRight = SPEEDMAX;
y2 = speed - speedRight;
}
y = y - y2;
speedLeft = speed + y;
if (speedLeft < SPEEDMIN)
{
speedLeft = SPEEDMIN;
}
}
leftDir = rightDir = FWD;
if (speedLeft < SPEEDMIN + 5) leftDir = BREAK;
if (speedRight < SPEEDMIN + 5) rightDir = BREAK;
MotorDir(leftDir,rightDir);
MotorSpeed(abs(speedLeft),abs(speedRight));
}
// kollision functions
/* Motor backwards */
void MotorRwd(void)
{
MotorDir(RWD,RWD);
MotorSpeed(SPEEDMAX,SPEEDMAX);
}
/* Motor backwards left */
void MotorRwdL(void)
{
MotorDir(RWD,FWD);
MotorSpeed(SPEEDMAX,SPEEDMAX);
}
/* Motor backwards right */
void MotorRwdR(void)
{
MotorDir(FWD,RWD);
MotorSpeed(SPEEDMAX, SPEEDMAX);
}
/* Motor stop */
void MotorStop(void)
{
MotorSpeed(0,0);
}
int main(void)
{
Init();
FrontLED(ON);
for (j = 0; j < 255; j++) LineData(lineData);
LineData(lineData);
ADOffset = lineData[LEFT] - lineData[RIGHT];
MotorDir(FWD,FWD);
StatusLED(GREEN);
speed = SPEED;
speedLeft = speed;
speedRight = speed;
kp = 10; ki = 4; kd = 70;
unsigned char t1, t2;
while(1)
{
t1 = PollSwitch();
t2 = PollSwitch();
if (t1 == 0 && t2 == 0) /* no key */
{
FollowLine();
}
else if (t1 && t2 && t1 == t2)
{
MotorStop();
if (t1 & 0x07) /* keys left pressed */
{
MotorRwdL();
FrontLED(OFF);
BackLED(ON,OFF);
StatusLED(RED);
}
if (t1 & 0x38) /* keys right pressed */
{
MotorRwdR();
FrontLED(OFF);
BackLED(OFF,ON);
StatusLED(RED);
}
Msleep(266);
}
FollowLine();
}
return 0;
}
Für eine hilfreiche Antwort wäre ich sehr dankbar.
MfG Letscho
Lesezeichen