Arctic Hare mod by Jussi

How to send rpi command from pfod? I want restart pi button
Code:
  else if (pfodCmd=="rx")
  {
    MyRpi.sendCommandToPi("RestartPi");
    sendCommandMenu(true);
  }
 
I assume it's from Home Assistant.
If you want to only restart the PI and not the due.
send payload RESTARTONLYPI like HOME,STOP etc....
Into Piardu319.py:
Code:
        if(str(message.topic)=="Mower/COMMAND/" or str(message.topic)=="Mower/COMMAND"):
            if(str(responsetable[0]) == "RESTARTONLYPI"):
                subprocess.Popen('/home/pi/Documents/PiArdumower/Restart.py')
            if(str(responsetable[0]) == "HOME"):
                button_home_click()
            if(str(responsetable[0]) == "STOP"):
                button_stop_all_click()
            if(str(responsetable[0]) == "START"):

If you want clean solution on all restart Pi and DUE
HAS send to PI , PI send to DUE and Due initiate the restart like you describe

So into pyardu319.py
Code:
 if(str(message.topic)=="Mower/COMMAND/" or str(message.topic)=="Mower/COMMAND"):
            if(str(responsetable[0]) == "RESTARTALL"):
                send_pfo_message('rx','1','2','3','4','5','6',)
            if(str(responsetable[0]) == "HOME"):
                button_home_click()
            if(str(responsetable[0]) == "STOP"):
                button_stop_all_click()
            if(str(responsetable[0]) == "START"):
                buttonStartMow_click()
Use HAS payload RESTARTALL to send the pfod rx command .
And into pfod add like you describe:
Code:
 else if (pfodCmd=="rx")
  {
    robot->autoReboot();
    sendCommandMenu(true);
  }
The class MpyRpi is not present in Pfod, so you can use the autoreboot function in robot.cpp
 
Thanks, I made new function rebootPi to reboot just Pi. Sometimes it lose wlan connection and need to reboot
Code:
void Robot::rebootPi()
{
  if (RaspberryPIUse)
  {
    Console.println(F("Send a command to Pi for reboot"));
    MyRpi.sendCommandToPi("RestartPi");
  }
}

Timed rebooting via HA is good idea (y)

In theory, is it possible to use this software w/o EEPROM and RTC? If timer is in HA, there's no need for rtc but EEPROM?
 
Actualy the reboot is used at the end of charging state for clean up all the code.
It's Into setting station if i remember. Or battery ?

Sometimes it lose wlan connection and need to reboot
What i see but not sure
When Pi try to reconnect to WIFI it can freeze Piardu for 4 or5 secondes an due watchdog can trigger.
So the ttyacm0 change to ttyacm1 and all the piardu freeze ?
Here i need to work, maybe you have idea on how to reset only the connection on the fly ?


For RTC / EEPROM
When migrate from Arduino Mega to Due the issue occur.
See all this thread.
It's posiible to use Due memory to save setting but when you upload a new firmware into Due the memory is erase.
Now with Raspberry you can use the PI as backup so YES in theory it's possible to skip the RTC with new code.

In practical maybe it's not possible to use the PCB1.3 I2C bus without RTC :(

On test i see that i tell you wrong thing according mowpattern.
it start from 0 not 1
Code:
payload: "STARTTIMER;{% if is_state('input_select.mower_timer1_mowpattern', 'Random') %}0{% elif is_state('input_select.mower_timer1_mowpattern', 'Lane') %}1{% elif is_state('input_select.mower_timer1_mowpattern', 'Perimeter') %}2{% else %}FAILED{% endif %};{{states('input_select.mower_timer1_lanenr')}};{% if is_state('input_select.mower_timer1_rolldir', 'Left') %}0{% elif is_state('input_select.mower_timer1_rolldir', 'Right') %}1{% else %}FAILED{% endif %};{{states('input_number.mower_timer1_start_distance')|round(0)}};{{states('input_select.mower_timer1_areatogo')}};{{states('input_number.mower_timer1_lane_lenght')|round(0)}}"
 
I have udev rule so that due is always /dev/ttyACM_DUE
/etc/udev/rules/99-usb-serial.rules
Code:
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="003e", ATTRS{product}=="Arduino Due", SYMLINK+="ttyACM_DUE"
Code:
    if DueConnectedOnPi:
        try:
            mymower.dueSerialReceived = Due_Serial.readline()
            if str(mymower.dueSerialReceived) != "b''":
                mymower.dueSerialReceived = str(mymower.dueSerialReceived, 'utf8')
                if mymower.dueSerialReceived[:1] != '$':  #it is console message because the first digit is not $
                    if (len(mymower.dueSerialReceived)) > 2:
                        consoleInsertText(mymower.dueSerialReceived)
                else:  # here a nmea message
                    # print(mymower.dueSerialReceived)
                    message = pynmea2.parse(mymower.dueSerialReceived)
                    decode_message(message)
                    # try:
                    #     message = pynmea2.parse(mymower.dueSerialReceived)
                    #     decode_message(message)
                    # except :
                    # #    print('INCOMMING MESSAGE ERROR FROM DUE --> ' + str(mymower.dueSerialReceived))
                    #     consoleInsertText('INCOMMING MESSAGE ERROR FROM DUE' + '\n')
                    #     consoleInsertText(str(mymower.dueSerialReceived) + '\n')
        except:
            try:
                print('Due serial connection fail, trying to reset')
                Due_Serial.close()
                time.sleep(5)
                Due_Serial.open()
            except:
                print('Serial connection reset failed, shutdown 60s')
                time.sleep(60)
                fen1.destroy()
                time.sleep(1)
                print('Fen1 destroy')
                time.sleep(1)
                sys.exit('Impossible to continue')
 
Charging issues again.. Mower goes to station and charging starts, then watchdog reset. Mower start again with rtc and eeprom errors. Can't find anything wrong with contacts or charger :sleep: Everything else works fine now (y)
Code:
19:51:19 Network check OK. Sending error email...

19:51:18 All Console file are saved

19:51:18 RTC data error!

19:51:18 DS1307 comm error

19:51:18 Watchdog triggered reboot done.

19:51:18 Watchdog is enabled and set to 5 seconds

19:51:18 off

19:51:18   v to change console output (sensor counters, values, perimeter etc.)

19:51:18   d for menu

19:51:18 press...

19:51:18 Config: ArduMower

19:51:18 Ardumower 1.2-Azurit-ber

19:51:18 START

19:51:18 capture size=192

19:51:18 subSample=4

19:51:18 matchSignal size=24

19:51:18 New sigcode in use  : 1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,

19:51:18 Change to Area : 1

19:51:18 --------------------------------- IMU READY ------------------------------

19:51:18 AccelGyro Yaw: 0.00  Compass Yaw: 0.00  Diff between compass and accelGyro in Radian and Deg0.00 / 0.00

19:51:15 Wait 3 secondes to stabilize the Drift

19:51:15 DMP Initialization failed

19:51:12 Initializing DMP...

19:51:12 MPU6050 connection failed

19:51:10 .

19:51:10 comScale=2.00,2.00,2.00

19:51:10 COMPASS OFFSET X.Y.Z AND SCALE X.Y.Z   --> comOfs=0.00,0.00,0.00

19:51:10 ACCEL GYRO MPU6050 OFFSET ax: 376 ay: -1768 az: 1512 gx: 91 gy: 12 gz: -2

19:51:10 -------- IMU CALIBRATION  --------

19:51:09 IMU error: no calib data

19:51:08 COMPASS HMC5883L FAIL

19:51:08 COMPASS HMC5883L ID NEED TO BE 72 IF ALL IS OK ------>  ID=0

19:51:08 --------------------------------- IMU INITIALISATION -------------------

19:51:08 Robot Stats address Stop = 826

19:51:08 Robot Stats address Start = 800

19:51:01 No rain in last 60 minutes

19:50:55 STATION / CHARG

19:50:55 STATION / STAT

19:50:55 Charge Voltage detected

19:50:54 BACKTOSTATION / STCHK

19:50:53 Detect a voltage on charging contact check if it's the station

19:50:48 Set New perimeter tracking speed  120

19:50:48 Change speed for 50 centimeters

19:50:48 RFID change tracking speed

19:50:48 RFID Tag find ToDO is: SPEED

19:50:48 Find a tag : 96D52480
 
Zuletzt bearbeitet:
No rain in last 60 minutes
I never see this message can you check it.
If i have this kind of issue i try to first deactivate the Watchdog and check the message (DUE IS OVERLOAD etc.….....) to see when and why the DUE freeze.

In my case the mower work since this weekend without trouble and the HASSIO scheduler is working just perfectly (Not tested the day ON/OFF).
 
Hello
In moment I am back to 217. Without Mqtt.
Can I use the new config with Mqtt settings? Or do I have to replace with old config?
I am asking because in moment I often have a freeze of Piardu. Only Piardu freeze. Not the Raspberry.
Thanks and best
Bjoern
 
Hello
In moment I am back to 217. Without Mqtt.
Can I use the new config with Mqtt settings? Or do I have to replace with old config?
I am asking because in moment I often have a freeze of Piardu. Only Piardu freeze. Not the Raspberry.
Thanks and best
Bjoern
In the past i use Piardy217 with it's own Access point and never freeze
When i start to test the Mqtt i have sometimes trouble.
For me ,The Raspberry lost wifi communication sometimes and when trying to reconnect it freeze the piardu for 4 or 5 secondes and the USB serial certainly have trouble and freeze totaly the Piardu soft.

Can you try to use 5 or 10 second in the due watchdog to see if the piardu freeze ?
its' into robot.cpp line 2022

Code:
if (Enable_DueWatchdog) {
    Console.println ("Watchdog is enable and set to 2 secondes");
    watchdogEnable(5000);// Watchdog trigger after  2 sec if not reseted.
 
Not in due, that console is copy/pasted from piardu console,
Disabling watchdog only in mower.h?
Code:
#define Enable_DueWatchdog false
It's 5 sec now
 
Do you have made change into ardumower code ?
To be sure : deactivate totaly the watchdog you can also remove the function into robotcpp line 269.
The reboot after charging is Yes or No into arduremote /setting /station
Code:
//void watchdogSetup(void) {}
 
The normal console of charging with reboot at end:
Code:
02:09:48 Start to save all Console Data
02:09:48 PI Restart into 5 Seconds
02:09:48 MQTT Disconnected Code:0
02:09:47 Close Mqtt Connection
02:09:47 TIME TO RESTART
02:09:47 Due reset after 1 secondes, send a command to Pi for restart also

02:09:47 Time to Restart PI and Due

02:09:47 End of charging duration check the batfullCurrent to try to stop before

01:50:53 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 281

01:35:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 274

01:20:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 280

00:54:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 269

00:42:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 285

00:30:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 268

23:58:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 265

23:48:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 284

23:26:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 285

23:15:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 254

22:52:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 256

22:38:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 264

22:13:52 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 268

22:03:51 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 268

21:53:51 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 266

21:39:51 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 285

21:23:51 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 269

21:09:46 STATION / CHARG

21:09:46 ------ LOOP NOT OK DUE IS OVERLOAD -- Over 1 sec 528

21:09:46 STATION / STAT

21:09:46 Robot Stats address Stop = 826
 
Some minor 'addons', like second mow motor, reading weather station rain, mow motors both directions..
Now it charging well w/o station. I'll inspect that tomorrow again
 
I can't dublicate error in my workshop. Only differense is that mower is not track wire for real.
Setup is perimeter off, force mowing off and then go station mower wheels lifted off floor. Then pushing station towards mower, slow, fast, from angle ets.. works everytime :unsure: maybe I need some load to wheels or tracking??
 
Yesterday was raining so tested today w/o watchdog. Seems to work but battery is full so it doesn't go charge state when docking. I'll test that later
Did you remove 'motorForwTimeMax' setting?
Something weird happen today when mower was wire mowing. Perimeter transmitter turned off (led was blinking) and mower started to drive circle and turned zombie.. and that happen about 10 minutes after leaving station. I have 6 hours time limit in transmitter code

Edit: Is there some reason why STATE_PERI_FIND doesn't not have 'checkcurrent()' function?
 
Zuletzt bearbeitet:
Oben