2021-05-14, 09:05 PM
(This post was last modified: 2021-05-14, 09:18 PM by Sparhawk76.
Edit Reason: minor correction
)
Today, on a fresh SD card I installed a new copy of 2020-12-16-OpenPlotter-v2-Headless-img. After install I did the recommended update, then I went through the process of updating to the current git version of pypilot.
After calibrating the accelerometer, then setting the boat's alignment all seemed to be working as expected up until this point, so I added the serial connection for the motor controller in the openplotter-serial settings and added it to pypilot. At this point I noticed the pypilot server process cycling, the control clients would connect breifly, show updates for a split second, then hang for a few seconds then zero out, then again show updates for a split second ... repeating on and on.
In /var/log/syslog I see:
May 14 12:50:42 openplotter systemd[1]: Stopped pypilot.
May 14 12:50:42 openplotter systemd[1]: Started pypilot.
May 14 12:50:42 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:45 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:45 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:45 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:45 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:46 openplotter systemd[1]: pypilot.service: Main process exited, code=exited, status=1/FAILURE
May 14 12:50:46 openplotter systemd[1]: pypilot.service: Failed with result 'exit-code'.
May 14 12:50:46 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:47 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:48 openplotter systemd[1]: pypilot.service: Service RestartSec=2s expired, scheduling restart.
May 14 12:50:48 openplotter systemd[1]: pypilot.service: Scheduled restart job, restart counter is at 98.
May 14 12:50:48 openplotter systemd[1]: Stopped pypilot.
May 14 12:50:48 openplotter systemd[1]: Started pypilot.
May 14 12:50:48 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:51 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:51 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:51 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:51 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:52 openplotter systemd[1]: pypilot.service: Main process exited, code=exited, status=1/FAILURE
May 14 12:50:52 openplotter systemd[1]: pypilot.service: Failed with result 'exit-code'.
May 14 12:50:52 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:53 openplotter signalk-server[1865]: TcpProvider:connect ECONNREFUSED 127.0.0.1:20220
May 14 12:50:54 openplotter systemd[1]: pypilot.service: Service RestartSec=2s expired, scheduling restart.
May 14 12:50:54 openplotter systemd[1]: pypilot.service: Scheduled restart job, restart counter is at 99.
May 14 12:50:54 openplotter systemd[1]: Stopped pypilot.
May 14 12:50:54 openplotter systemd[1]: Started pypilot.
When I then stop the pypilot service, and run pypilot form the command line, it runs for a short while, then fails:
pi@openplotter:~ $ pypilot
imu process 6660
nmea process 6665
listening on port 20220 for nmea connections
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
made imu process realtime
Using settings file RTIMULib.ini
Settings file RTIMULib.ini loaded
Loaded Pilots: ['learning', 'basic', 'absolute', 'simple']
Detected MPU9250/MPU9255 at standard address
warning: failed to open special file /dev/watchdog0 for writing
cannot stroke the watchdog
gps process 6670
Using fusion algorithm Kalman STATE4
IMU Name: MPU-925x
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
pypilotServer process 6672
server setup has 5 pipes
server add socket ('127.0.0.1', 38462)
servo probe ('/dev/ttyAMA0', 38400) 3148.442749013
MPU-925x init complete
imu rate set to rate 20
read imu running too _slowly_ 0.051795058000152494 0.05
setting initial gyro bias [-1.051, -1.397, 1.083]
arduino servo found on ['/dev/ttyAMA0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice ['/dev/ttyAMA0', 38400]
EEPROM SIGNATURE ok
Traceback (most recent call last):
File "/usr/local/bin/pypilot", line 11, in <module>
load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot')()
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/autopilot.py", line 386, in main
ap.iteration()
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/autopilot.py", line 366, in iteration
self.servo.poll()
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/servo.py", line 670, in poll
self.clutch_pwm.set(self.driver.clutch_pwm)
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/arduino_servo/arduino_servo.py", line 102, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, ArduinoServo, name)
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/arduino_servo/arduino_servo.py", line 80, in _swig_getattr
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
AttributeError: 'ArduinoServo' object has no attribute 'clutch_pwm'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.7/multiprocessing/popen_fork.py", line 28, in poll
pid, sts = os.waitpid(self.pid, flag)
File "/usr/local/lib/python3.7/dist-packages/pypilot-0.24-py3.7-linux-armv7l.egg/pypilot/autopilot.py", line 169, in cleanup
raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
closing autopilot
terminate calibration process
If I then remove the motor controller device from openplotter-pypilot, I can then run pypilot from the command line and it will stay running. Or I can start the service and it will start once and not cycle as before. I've tried this with both an op device alias, as well as assigning the ttyAMA0 device directly from the pypilot settings, and it reacts the same way.