Azurit und Arduino Due

ich hab dann noch eine Frage, sowie ich die servo.h mit einbinde schmeißt es mir beim erstellen folgenden Fehler:


Code:
Arduino: 1.6.9 (Windows 7), TD: 1.29, Board: "Arduino Due (Native USB Port)"

librariesServosamServo.cpp.o: In function `TC3_Handler':

C:Program FilesArduinolibrariesServosrcsam/Servo.cpp:52: multiple definition of `TC3_Handler'

sketchDueTimer.cpp.o:sketch/DueTimer.cpp:284: first defined here

librariesServosamServo.cpp.o: In function `TC4_Handler':

C:Program FilesArduinolibrariesServosrcsam/Servo.cpp:57: multiple definition of `TC4_Handler'

sketchDueTimer.cpp.o:sketch/DueTimer.cpp:288: first defined here

librariesServosamServo.cpp.o: In function `TC5_Handler':

C:Program FilesArduinolibrariesServosrcsam/Servo.cpp:62: multiple definition of `TC5_Handler'

sketchDueTimer.cpp.o:sketch/DueTimer.cpp:292: first defined here

librariesServosamServo.cpp.o: In function `TC2_Handler':

C:Program FilesArduinolibrariesServosrcsam/Servo.cpp:67: multiple definition of `TC2_Handler'

sketchDueTimer.cpp.o:sketch/DueTimer.cpp:280: first defined here

librariesServosamServo.cpp.o: In function `TC0_Handler':

C:Program FilesArduinolibrariesServosrcsam/Servo.cpp:72: multiple definition of `TC0_Handler'

sketchDueTimer.cpp.o:sketch/DueTimer.cpp:269: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Fehler beim Kompilieren für das Board Arduino Due (Native USB Port).



habe schon in der DueTimer.ccp gesehen, das da ein fix ist aber der scheint nicht zu funktionieren. Ich benötige die Servo.h zum ansteuern meines Mähwerks, für die Brushless Controller oder kann ich die auch ohne die servo.h ansteuern?
 
Hallo Benjamin,

probier mal folgendes aus: diese Zeile in der "DueTimer.h" wie folgt aktivieren:


Code:
#define USING_SERVO_LIB	true


Gruss,
Alexander
 
Hey Alex, es funktioniert leider doch nicht so Bingo...

also, ich habe wie vorher auch:

in der ardumower.ino:
#include


in der robot.h:
#include
Servo brushless;


in der mower.cpp
brushless.attach(pinMotorMowPWM);
brushless.write(45);

case ACT_MOTOR_MOW: setL298N(pinMotorMowDir, pinMotorMowPWM, value); break;

geändert in:

case ACT_MOTOR_MOW: {
int VAL = map (value, 0, 255, 45, 155);
brushless.write(VAL);}break;


aber er gibt mir kein Signal aus, in der Pfod app kann ich das Mähwerk einschalten, den Wert von 0-255 ändern und er zählt dann auch hoch bzw runter auf den eingestellten Wert aber er legt mir das Signal auf keinen Ausgang, hab es mit Oszy an Pin 2, 8 und 9 versucht... nichts

irgend ne Idee woran es liegen könnte?

Gruß
Benni
 
Hallo Benjamin,

versuch doch mal den PinMotorMowPWM direkt, also ohne die Servo lib anzusprechen.
Ich glaub da musst Du jetzt aber die Funktion PinMan.analogWrite benutzen...

***EDIT***
Was benutzt Du für eine Ansteuerung für Dein Mähwerk? Musst Du da die Drehzahl regeln?

VG
Reiner
 
Japp, brauche eine Regelung. Nutze 3x Brushless Controller mit Festplattenmotoren, funktioniert super aber ich regel die Drehzahl nach bedarf, ist dann schön leise ;) ohne Regelung drehen die Motoren bestimmt so bis 30.000 hoch, is dann zwar ein super sauberer schnitt, saugt aber akku und is bisschen laut :p
 
Du Reiner sag mal, Könnte man die Regelung nicht auch mit PinMotorMowPWM genauso hinbekommen als wenn ich die Servo.h Methode nutze? Klappt doch, wenn ich den Antrieb in der Pfod App einstelle auch, kann da auch zwischen 0 und 255 einstellen....


Gruß
Benni
 
Hallo Benjamin,

ich weiss nicht genau wie die Servos bzw. Brushless Controller angesteuert werden müssen.
Ich vermute mal beim Servo 0% PWM = linksanschlag/100% PWM = rechtsanschlag...
Dann müsste das auch mit einem normalen PWM Ausgang funktionieren.
Beim DUE läuft das aber ein bisschen anders mit dem PWM Ausgang glaube ich. Muss mich mal einlesen

VG
Reiner
 
Hi Benjamin,
auf meinem nackten DUE funktionieren die Pins 2, 8 und 9 mit der Standardfunktion "AnalogWrite" und mit der "PinMan.AnalogWrite" ganz normal.
Übrigens fiept mein DUE auch, aber nicht immer. Wenn er fiept is auch das PWM Signal nicht sauber. Sieht aus wie ein Sägezahn :huh:

***EDIT***
Ich habs jetzt auch mal mit der Servo.lib probiert. Funzt auch.

VG
Reiner
 
Hi Reiner,

ja mit PinMan.AnalogWrite funktioniert es auch, nutze das auch so ;)
das mit dem fiepen ist bei mir identisch, hab dann auch Sägezahn, habs mit Scopemeter mal angeschaut.... stört meine Brushlessregler aber nicht, das mit PinMan.AnalogWrite geht ganz gut, wäre nur cool, wenn man das irgendwie mappen könnte, das zb in der Pfod App unter MotorMowPwm im Schieberegler sagen wir 0% =160 und 100% =255, wenn das klappen könnte, wäre ich schon voll zufrieden


Ps.: Hab gestern mein Schaf das erste mal mit DUE auf die Weide Geschickt.... TOP! funtzt echt alles sauber und zuverlässig, wie beim Mega.... nur eben viel flüssiger und schneller, auch die manuelle Bedienung in der Pfod App ist jetzt absolut ohne Verzögerung....


Gruß
Benni
 
Hi Benjamin,

vielleicht funktioniert das:

folgende Zeilen in der pfod.cpp ändern/einfügen:

Code:
int mMSMP;

//sendSlider("o05", F("Speed max"), robot->motorMowSpeedMaxPwm, "", 1, 255);       
  sendSlider("o05", F("Speed max"), map(robot->motorMowSpeedMaxPwm, 160, 255, 0, 100), "", 0, 100);       


//else if (pfodCmd.startsWith("o05")) processSlider(pfodCmd, robot->motorMowSpeedMaxPwm, 1);
  else if (pfodCmd.startsWith("o05"))
  {
    processSlider(pfodCmd, mMSMP, 1);
    robot->motorMowSpeedMaxPwm= map(mMSMP, 0, 100, 160, 255);
  }


Ich hab heut mal mein IMU-Modul angeklemmt... damit fährt er keine gerade Strecke mehr, ab und zu Odometriefehler...
Vielleicht hab ich auch nicht genau genug kalibriert. Mal schau´n
Funktioniert das der Kompass bei Dir?

VG
Reiner
 
Hi Reiner
I Hope you speak english
I swap my mega by a DUE and make some test with the your Code Post 10129.
The main feature works But i have probleme,the ADC Calibration change and is false each time i disconnect the battery.

Have you already encounter this problem ?

Thanks.
By.
 
Hello Boilevin,

I have not tested the DUE itself yet.

So does the ADC calibration work as long as you have connected the battery?
And if you disconnect the battery then it takes back old ADC values?
If this is so, then the storage of the data may not work correctly...

Reiner
 
Hi Reiner.
You write this code without DUE (Congratulation).
It's exactly what you say the problem is in the calibration storage the calibration work well until you disconnect the battery.
The motor and perimeter data storage work well .
I rapidly test the auto mode it'swork.
The tracking it's work.
The battery voltage not exact (40V instead of near 26) normal need to change the setting.
The Buzzer not instaled so not tested (In fact for the buzzer if i understand i need to add a transistor to make it work and to avoid trouble i prefer to remove it from the board.

It's not a problem for me because now i try to use the Sunray version of the ADCman and perimeter reading so i need to rewrite a part of my code.

If needed i can again have a look and try to find the problem.
Thanks for your help.
 
Hi Boilevin,

the code for the DUE is from Alexander. I just hacked it in the 1.06 B)

There is an new file to communicate with the flash. Maybe I forgot something to patch...

CU
Reiner
 
Hello Boilevin,

this could solve the Problem with the ADC Calibration:

adcman.cpp

Code:
void ADCManager::saveCalib(){
//#ifdef __AVR__
  loadSaveCalib(false);
//#endif


:unsure:
 
Hi Reiner.
Thanks and I think too .

In fact it's not a problem for me because i use the ADCman from Sunray and don't need Calibration.
The result of my test in perimeter reading speed :
Azurit 1.06 and Mega 30ms to have correct value.
Your code and Due 20 ms
Azurit with Sunray ADCman and Due 10 ms.
Now i have a fast one coil tracking (Need to confirm but the first 10 min test are very good).
Try to put a video if the sun come back.

By.
 
Hello Boilevin,

In 1.07-dev there was an issue in odo isr for the due, too.
I tried to adapt it for the due pins, but I can not test it.
I'm not sure if I've picked the correct ports.

Maybe you can do this if you have a little bit time left. B)

mower.cpp

Code:
// odometry signal change interrupt
// mower motor speed sensor interrupt
// NOTE: when choosing a higher perimeter sample rate (38 kHz) and using odometry interrupts, 
// the Arduino Mega cannot handle all ADC interrupts anymore - the result will be a 'noisy'
// perimeter filter output (mag value) which disappears when disabling odometry interrupts.
// SOLUTION: allow odometry interrupt handler nesting (see odometry interrupt function)
// [URL]http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html[/URL] #ifdef __AVR__

  volatile byte oldOdoPins = 0;
  ISR(PCINT2_vect, ISR_NOBLOCK)
  {
    const byte actPins = PINK;                				// read register PINK
    const byte setPins = (oldOdoPins ^ actPins);
    if (setPins & 0b00010000)                 				// pin left has changed 
    {
      if (robot.motorLeftPWMCurr >= 0)						// forward
        robot.odometryLeft++;
      else
        robot.odometryLeft--;									// backward
    }
    if (setPins & 0b01000000)                  				// pin right has changed
    {
      if (robot.motorRightPWMCurr >= 0)
        robot.odometryRight++;								// forward
      else
        robot.odometryRight--;								// backward
    }  
    oldOdoPins = actPins;
  }

#else

  volatile long oldOdoPins_A = 0;
  volatile long oldOdoPins_B = 0;
  ISR(PCINT2_vect)
  {
    const long actPins_A = REG_PIOA_PDSR;       			// read PIO A
    const long actPins_B = REG_PIOB_PDSR;                               // read PIO B
    const long setPins_A = (oldOdoPins_A ^ actPins_A);
    const long setPins_B = (oldOdoPins_B ^ actPins_B);
    if (setPins_A & 0b00000000000000000000000000000010)			// pin left has changed 
    {
      if (robot.motorLeftPWMCurr >= 0)					// forward
        robot.odometryLeft++;
      else
        robot.odometryLeft--;	
        								// backward
      oldOdoPins_A = actPins_A;
    }
    
    if (setPins_B & 0b00000000000000001000000000000000)         	// pin right has changed
    {
      if (robot.motorRightPWMCurr >= 0)
        robot.odometryRight++;						// forward
      else
        robot.odometryRight--;						// backward

      oldOdoPins_B = actPins_B;
    }  
  }


By
Reiner
 
Hi Reiner.
No problem to make test with odo but in fact i never understand when you speak about 1.07-dev.
When i click on the link in the wiki i find only Azurit 1.06 so where is the code you want i test ??.
In the code you put as a Zip in post 10129 the ODO work well with my denna Platform.
Thanks.
 
Oben