This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pypilot sync but no connection when engaged
#1
Hi,

I didn't find anyone with the same problem, so I've created a new thread.

I have uploaded the motor.ino sketch succesfully to an arduino nano (clone I think) and it is connected in openplotter on the Raspberry pi 3B+ through USB.
When opening autopilot either on opencpn or within openplotter itself, it is recognized with the 'sync' status and no error flags. 
I have disabled all sensors in motor.ino because I have all the sensors on the Raspberry. I have also grounded all unused analog pins.
I receive statistics from the arduino from both pypilot on opencpn, and openplotter.

The trouble is, when I click on AP, engaging the autopilot, the status changes from 'sync' to 'no connection' instantly.
Only after restarting signalK from the Pypilot tab in openplotter, the connection is back again. Resetting the arduino with the reset button doesn't help.

I am unsure how this happens, the Arduino connection seems to freeze when engaging the autopilot and only comes back after signalk is restarted.
I feel it has something to do with either:

- pinout from the arduino to the stepper motor? (It is on h-bridge mode, tried pins 2 and 3, and tried pins 9 and 10 to the h-bridge of the stepper motor)
- motor.ino code configuration?

Hope someone can help me troubleshoot, I've included my motor.ino and screenshots of the https://pypilot.org/wiki/doku.php?id=troubleshooting results in the attachments.
  Reply
#2
it sounds like pypilot itself is throwing an exception.

Could you make sure pypilot is not running eg: killall python
You could check the output log using journalctl, but easier to run pypilot from the command line:

cd pypilot/pypilot
python autopilot.py

Once it is running, try to engage and see what exception is thrown.
  Reply
#3
Thanks! Not sure if I did it right, but I attached some more screenshots of what I tested.

- Test1.png shows what happens when I engage the autopilot (made sure I killed all python before testing it)
- Regulare pypilot folder.png shows the contents of the pypilot folder in home/pi but I don't have the autopilot.py file in there
- Alternate pypilot folder.png shows the folder that contains autopilot.py (wasn't in "cd pypilot/pypilot" not sure if this is correct)

   

   

   
  Reply
#4
there are no pictures
  Reply
#5
(08-10-2019, 01:43 PM)seandepagnier Wrote: there are no pictures

Sorry, forgot to press 'add'  Confused Blush
  Reply
#6
any way to scroll up in the terminal from the first picture and post the full output?
  Reply
#7
Here is the output in text, screenshot could not contain all of it. Also I've added text (in bold) to the place in the code, it marks where connection was OK, and from where it is not:

Code:
python autopilot.py
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
connected to gpsd
warning: failed to open special file /dev/watchdog0 for writing
       cannot stroke the watchdog
Settings file not found. Using defaults and creating settings file
Failed to open settings file for saveUsing settings file RTIMULib.ini
Detected LSM9DS1 at standard/standard address
Failed to open settings file for saveUsing fusion algorithm Kalman STATE4
IMU Name: LSM9DS1
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
LSM9DS1 init complete
nmea poll times 0.149311065674 2.38418579102e-05 2.14576721191e-06 1.90734863281e-06 2.40802764893e-05
sensors is running too _slowly_ 0.14959692955
arduino servo found on [u'/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice [u'/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0', 38400]
nmea ready for connections
listening on port 20220 for nmea connections
EEPROM SIGNATURE ok */untill here AP is not engaged and connection is still sync/*
Traceback (most recent call last): */the minute I press AP engage it goes offline/*
File "autopilot.py", line 467, in <module>
  main()
File "autopilot.py", line 464, in main
  ap.run()
File "autopilot.py", line 259, in run
  self.iteration()
File "autopilot.py", line 432, in iteration
  self.servo.poll()
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 636, in poll
  self.send_command()
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 293, in send_command
  self.do_command(self.command.value)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 345, in do_command
  speed *= 12 / self.voltage.value
ZeroDivisionError: integer division or modulo by zero
got signal atexit cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
Process Process-1:
Traceback (most recent call last):
Process GpsProcess-5:
Process Process-3:
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
Process NmeaBridgeProcess-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  self.run()
  self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
  self.run()
  self.run()
  self._target(*self._args, **self._kwargs)
  self._target(*self._args, **self._kwargs)
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/nmea.py", line 594, in process
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/signalk/pipeserver.py", line 157, in pipe_server_process
  self._target(*self._args, **self._kwargs)
  self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/boatimu.py", line 134, in imu_process
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/gpsd.py", line 67, in gps_process
  self.read(pipe)
  time.sleep(.1)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/gpsd.py", line 40, in read
File "autopilot.py", line 159, in cleanup
  gpsdata = self.gpsd.next()
File "/usr/lib/python2.7/dist-packages/gps/gps.py", line 326, in next
  events = self.poller.poll(timeout)
File "autopilot.py", line 159, in cleanup
  time.sleep(t)
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  raise KeyboardInterrupt # to get backtrace on all processes
  if self.read() == -1:
File "/usr/lib/python2.7/dist-packages/gps/gps.py", line 312, in read
KeyboardInterrupt
  status = gpscommon.read(self)
File "/usr/lib/python2.7/dist-packages/gps/client.py", line 84, in read
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  frag = self.sock.recv(4096)
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
got signal 17 cleaning up
got signal 15 cleaning up
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
Process Process-2:
  func(*targs, **kargs)
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
  self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/calibration_fit.py", line 583, in CalibrationProcess
got signal 17 cleaning up
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 30, in _run_exitfuncs
  traceback.print_exc()
File "/usr/lib/python2.7/traceback.py", line 233, in print_exc
  print_exception(etype, value, tb, limit, file)
File "/usr/lib/python2.7/traceback.py", line 125, in print_exception
  print_tb(tb, limit, file)
File "/usr/lib/python2.7/traceback.py", line 69, in print_tb
  line = linecache.getline(filename, lineno, f.f_globals)
File "/usr/lib/python2.7/linecache.py", line 14, in getline
  lines = getlines(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 41, in getlines
  return updatecache(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 132, in updatecache
  lines = fp.readlines()
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  p = points.recv(1)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/signalk/pipeserver.py", line 36, in recv
  if self.pollin.poll(1000.0*timeout):
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  Reply
#8
(08-11-2019, 06:17 AM)jamos.tan@gmail.com Wrote: Here is the output in text, screenshot could not contain all of it. Also I've added text (in bold) to the place in the code, it marks where connection was OK, and from where it is not:

Code:
python autopilot.py
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
connected to gpsd
warning: failed to open special file /dev/watchdog0 for writing
       cannot stroke the watchdog
Settings file not found. Using defaults and creating settings file
Failed to open settings file for saveUsing settings file RTIMULib.ini
Detected LSM9DS1 at standard/standard address
Failed to open settings file for saveUsing fusion algorithm Kalman STATE4
IMU Name: LSM9DS1
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
LSM9DS1 init complete
nmea poll times 0.149311065674 2.38418579102e-05 2.14576721191e-06 1.90734863281e-06 2.40802764893e-05
sensors is running too _slowly_ 0.14959692955
arduino servo found on [u'/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice [u'/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0', 38400]
nmea ready for connections
listening on port 20220 for nmea connections
EEPROM SIGNATURE ok */untill here AP is not engaged and connection is still sync/*
Traceback (most recent call last): */the minute I press AP engage it goes offline/*
File "autopilot.py", line 467, in <module>
  main()
File "autopilot.py", line 464, in main
  ap.run()
File "autopilot.py", line 259, in run
  self.iteration()
File "autopilot.py", line 432, in iteration
  self.servo.poll()
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 636, in poll
  self.send_command()
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 293, in send_command
  self.do_command(self.command.value)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/servo.py", line 345, in do_command
  speed *= 12 / self.voltage.value
ZeroDivisionError: integer division or modulo by zero
got signal atexit cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
got signal 15 cleaning up
Process Process-1:
Traceback (most recent call last):
Process GpsProcess-5:
Process Process-3:
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
Traceback (most recent call last):
Process NmeaBridgeProcess-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  self.run()
  self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
  self.run()
  self.run()
  self._target(*self._args, **self._kwargs)
  self._target(*self._args, **self._kwargs)
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/nmea.py", line 594, in process
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/signalk/pipeserver.py", line 157, in pipe_server_process
  self._target(*self._args, **self._kwargs)
  self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/boatimu.py", line 134, in imu_process
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/gpsd.py", line 67, in gps_process
  self.read(pipe)
  time.sleep(.1)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/gpsd.py", line 40, in read
File "autopilot.py", line 159, in cleanup
  gpsdata = self.gpsd.next()
File "/usr/lib/python2.7/dist-packages/gps/gps.py", line 326, in next
  events = self.poller.poll(timeout)
File "autopilot.py", line 159, in cleanup
  time.sleep(t)
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  raise KeyboardInterrupt # to get backtrace on all processes
  if self.read() == -1:
File "/usr/lib/python2.7/dist-packages/gps/gps.py", line 312, in read
KeyboardInterrupt
  status = gpscommon.read(self)
File "/usr/lib/python2.7/dist-packages/gps/client.py", line 84, in read
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  frag = self.sock.recv(4096)
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
got signal 17 cleaning up
got signal 15 cleaning up
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
Process Process-2:
  func(*targs, **kargs)
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/util.py", line 325, in _exit_function
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
  self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
  self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/pypilot/calibration_fit.py", line 583, in CalibrationProcess
got signal 17 cleaning up
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 30, in _run_exitfuncs
  traceback.print_exc()
File "/usr/lib/python2.7/traceback.py", line 233, in print_exc
  print_exception(etype, value, tb, limit, file)
File "/usr/lib/python2.7/traceback.py", line 125, in print_exception
  print_tb(tb, limit, file)
File "/usr/lib/python2.7/traceback.py", line 69, in print_tb
  line = linecache.getline(filename, lineno, f.f_globals)
File "/usr/lib/python2.7/linecache.py", line 14, in getline
  lines = getlines(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 41, in getlines
  return updatecache(filename, module_globals)
File "/usr/lib/python2.7/linecache.py", line 132, in updatecache
  lines = fp.readlines()
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
  p = points.recv(1)
File "/usr/local/lib/python2.7/dist-packages/pypilot-0.9-py2.7-linux-armv7l.egg/signalk/pipeserver.py", line 36, in recv
  if self.pollin.poll(1000.0*timeout):
File "autopilot.py", line 159, in cleanup
  raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt


I see the problem now, I will fix it.

 It's because you have no voltage reading from the nano.   You could add two resistors, or wait and i'll fix this bug soon.
  Reply
#9
Can you disable servo.compensate_voltage in ~/.pypilot/pypilot.conf? It should avoid this exception
  Reply
#10
Yes! That helped, I stays synced.

I've tested it from home by logging into VNC, so not all devices are powered on and I got the DRIVER_TIMEOUT flag.
I'll test it again when everything is powered on and will report again.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)