Azurit und Arduino Due

Hi Reiner , Stephan.
I download the 1.07 and yes there is a problem.
With the console the test ODO work but my motors are 720 ticks and i need to put 1440 to have a complete rotation.
But in manual only the left Wheel turn at full speed.

Reiner:I try to copy and paste your part of code but to compile i need to remove the AVR(mega) part and after the result is the same in manual it's not working.

Again the code in the ZIP work into the DUE ,Why did you change the code, the version with Odo in Robot.cpp work very well, never forget a tick and you can easyly increase the accurate by use the second signal to count?

Hope it s help ?
 
Hi Boilevin,

in the 1.07 the odo interrupt occurs on rising and falling edge of the signal (at least on MEGA. On DUE I have to look :eek:hmy: ).
So you have to enter 1440 ticks for a full rotation.
Because of the DigitalRead() function is very slow, we try to speed up the odo isr.

Only the left wheel turn at full speed? What does the right wheel do?

By
Reiner
 
Hi Reiner.
Ok for rising and falling ;) .
Don't know for the speed but need to compare .

The test in manual don't work because the right and left Odo are swap.
With this change all is working.



Code:
if (setPins_A & 0b00000000000000000000000000000010)			// pin left has changed 
    
    {
      if (robot.motorRightPWMCurr >= 0)
        robot.odometryRight++;            // forward
      else
        robot.odometryRight--;            // backward

      oldOdoPins_A = actPins_A;
    }  
    if (setPins_B & 0b00000000000000001000000000000000)         	// pin right has changed
    {
      if (robot.motorLeftPWMCurr >= 0)          // forward
        robot.odometryLeft++;
      else
        robot.odometryLeft--; 
                        // backward
      oldOdoPins_B = actPins_B;
    }


At full speed (PWM=255) all the ticks are count.

For the ADC calibration.
Now the ADC is not erase when unplug the battery but only when download a new code in the Due (all Parameter are set to factory).
The Battery Voltage is not correct.
The MotorSense are not correct (
 
Hi Reiner.

Here the change to make the battery voltage and the motor sense work.
To have access at this change you need:

For Motor:
In PFOD in Info
Set the Developper mode to YES (These value are setting only one time it's why i put in Dev mode)
In PFOD in Setting Motor
Now you have access to the motorSenseLeftScale and right so you can easily adjust them to the correct value working with POWER MAX of your motor.
For me the Left and right Scale are totaly different (Left 4 and Right 24 to have 50W max for my motor when wheel brake a lot)

For Battery
It's the same but normaly the value is OK

Don't forget to put the Developper mode to NO after the change


The change are

in Mower.cpp

Code:
//bb change for due
  #ifdef __AVR__
  batFactor       = 0.495;
  batChgFactor    = 0.495; 
  #else
  batFactor       = 0.3267; //The due is 3.3V ref so batfactor is 0.495*3.3V/5V
  batChgFactor    = 0.3267; 
  #endif
  // end change


in pfod.cpp
More complex so i try to put the complete code in attachement
You can easily find the change by searching //bb

Hope i forget nothing

Question:
Why the BUZZER class in your code.
It's never call and the void Robot::beep(int numberOfBeeps, boolean shortbeep = false){
work well with the DUE.



pfod.zip



By
Attachment: https://forum.ardumower.de/data/media/kunena/attachments/3545/pfod.zip/
 
Zuletzt bearbeitet von einem Moderator:
Hi Boilevin,

thank you for the changes. I'll check it out later.

The Buzzer Class:
The problem with DUE is probably that it is not completely supported by the libraries. That's why Alexander has rewritten many functions specifically for the DUE. Maybe I forgot something by patching...

By
Reiner

***EDIT***
The Buzzer.tone ond Buzzer.noTone is used in due.cpp Function tone(...) and noTone(...) :)
 
Hi.
Yes sorry i check only in robot.cpp but it's Beep the tone is used in IMU.
In fact i think it's only to have different sound.
I test it .
By
 
Hi Reiner.

Of course I forget Something :dry: .
To setup correctly The powerMax of the motor it's more easier in Manuel mode B) ,
But in Azurit 1.07 the checkcurrent in not call in STATE_MANUAL.

Here the code to add in Robot.cpp


In void Robot::loop() {


Code:
case STATE_MANUAL:
       checkCurrent();
       checkBumpers();
       checkDrop();  
 break;


In void Robot::checkCurrent() {

Code:
//bb add test MotorCurrent in manual mode and stop immediatly If >Powermax
 if (stateCurr == STATE_MANUAL){
  if (motorLeftSense >= motorPowerMax) {
      motorLeftSenseCounter++;
      setMotorPWM( 0, 0, false );
      addErrorCounter(ERR_MOTOR_LEFT);
      setNextState(STATE_ERROR, 0);
      Console.println("Error: Motor Left current");
    }
   if (motorRightSense >= motorPowerMax) {
      motorRightSenseCounter++;
      setMotorPWM( 0, 0, false );
      addErrorCounter(ERR_MOTOR_RIGHT);
      setNextState(STATE_ERROR, 0);
      Console.println("Error: Motor Right current");
   }
 }

By.
 
Hi Benni,


ich stehe jetzt vor dem gleichen Problem...

Servo.h im Due funktioniert nicht.. kein Signal.

Du hast das jetzt ohne Servo.h gelöst.. wenn ich das richtig verstanden habe.

Kannst Du mir bitte mal sagen wie Du das gemacht hast.. bzw den Code hier sharen

Danke

Andreas
 
Oben