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.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updated pypilot to latest git and getting errors form pypilot_servo
#1
I updated to the latest pypilot. I get the following error. When I install pyjson via pip3, I get other errors when launching pypilot. What should I try next?

pi@openplotter:~/pypilot $ pypilot_servo
Traceback (most recent call last):
  File "/usr/local/bin/pypilot_servo", line 11, in <module>
    load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot_servo')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/pi/.local/lib/python3.7/site-packages/pypilot/servo.py", line 13, in <module>
    import pyjson
ModuleNotFoundError: No module named 'pyjson'
Reply
#2
After installing pyjson, I get this error

pi@openplotter:~/pypilot $ pypilot_servo
Traceback (most recent call last):
File "/usr/local/bin/pypilot_servo", line 11, in <module>
load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot_servo')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/pi/.local/lib/python3.7/site-packages/pypilot/servo.py", line 14, in <module>
from client import pypilotClient
ModuleNotFoundError: No module named 'client'
Reply
#3
(2021-05-13, 01:15 AM)cosborne Wrote: After installing pyjson, I get this error

pi@openplotter:~/pypilot $ pypilot_servo
Traceback (most recent call last):
 File "/usr/local/bin/pypilot_servo", line 11, in <module>
   load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot_servo')()
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 489, in load_entry_point
   return get_distribution(dist).load_entry_point(group, name)
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
   return ep.load()
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2411, in load
   return self.resolve()
 File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2417, in resolve
   module = __import__(self.module_name, fromlist=['__name__'], level=0)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/servo.py", line 14, in <module>
   from client import pypilotClient
ModuleNotFoundError: No module named 'client'

Is this just the console scripts?

I think the issue is installing as a local user as you have..   So "sudo python3 setup.py install" should work?

If you just "cd pypilot/pypilot"  then "python3 servo.py" is it working?
Reply
#4
I installed with sudo and no difference I can see. 

Code:
pi@openplotter:~/pypilot/pypilot $ python3 servo.py
pypilot Servo
nmea process 23016
listening on port 20220 for nmea connections
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
servo probe ('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400) 82919.086614797
gps process 23018
pypilotServer process 23019
server setup has 3 pipes
arduino servo found on ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400]
voltage: False current 11.57 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.38 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
EEPROM SIGNATURE ok
Traceback (most recent call last):
 File "servo.py", line 787, in <module>
   main()
 File "servo.py", line 774, in main
   servo.poll()
 File "servo.py", line 670, in poll
   self.clutch_pwm.set(self.driver.clutch_pwm)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/arduino_servo/arduino_servo.py", line 102, in <lambda>
   __getattr__ = lambda self, name: _swig_getattr(self, ArduinoServo, name)
 File "/home/pi/.local/lib/python3.7/site-packages/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'
Reply
#5
(2021-05-13, 05:23 PM)cosborne Wrote: I installed with sudo and no difference I can see. 

Code:
pi@openplotter:~/pypilot/pypilot $ python3 servo.py
pypilot Servo
nmea process 23016
listening on port 20220 for nmea connections
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
servo probe ('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400) 82919.086614797
gps process 23018
pypilotServer process 23019
server setup has 3 pipes
arduino servo found on ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400]
serialprobe success: /home/pi/.pypilot/servodevice ['/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AB0LREUM-if00-port0', 38400]
voltage: False current 11.57 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.38 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
voltage: False current 10.23 ctrl temp False motor temp False rudder pos False flags SYNC
EEPROM SIGNATURE ok
Traceback (most recent call last):
 File "servo.py", line 787, in <module>
   main()
 File "servo.py", line 774, in main
   servo.poll()
 File "servo.py", line 670, in poll
   self.clutch_pwm.set(self.driver.clutch_pwm)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/arduino_servo/arduino_servo.py", line 102, in <lambda>
   __getattr__ = lambda self, name: _swig_getattr(self, ArduinoServo, name)
 File "/home/pi/.local/lib/python3.7/site-packages/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'

I also just updated my pypilot on my openplotter install just now, and the pypilot process won't stay running.  When I stop the service and run pypilot from the command line, it throws a very similar error to what you are receiving, specifically the "AttributeError: 'ArduinoServo' object has no attribute 'clutch_pwm'" error.

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 151, in cleanup
pid = os.waitpid(-1, os.WNOHANG)
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
Reply
#6
I don't think I had a problem with running pypilot from cli until I reinstalled as sudo but I could be wrong. I definitely have an issue now.

Code:
pi@openplotter:~/pypilot/pypilot $ service pypilot stop
pi@openplotter:~/pypilot/pypilot $ pypilot
imu process 23486
nmea process 23491
listening on port 20220 for nmea connections
made imu process realtime
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
Using settings file RTIMULib.ini
Settings file not found. Using defaults and creating settings file
Detected MPU9250/MPU9255 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: MPU-925x
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
Loaded Pilots: ['absolute', 'basic', 'simple', 'learning']
warning: failed to open special file /dev/watchdog0 for writing
        cannot stroke the watchdog
gps process 23495
pypilotServer process 23498
server setup has 5 pipes
Process Process-6:
Traceback (most recent call last):
 File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
   self.run()
 File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
   self._target(*self._args, **self._kwargs)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/server.py", line 398, in run
   self.poll(dt)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/server.py", line 564, in poll
   connection.write('watch=' + pyjson.dumps(connection.cwatches) + '\n')
AttributeError: module 'pyjson' has no attribute 'dumps'
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
MPU-925x init complete
failed send ex 86016.668265574 86016.668315011 module 'pyjson' has no attribute 'dumps'
failed to encode data pipe! imu_pipe[1] module 'pyjson' has no attribute 'dumps'
Process Process-2:
Traceback (most recent call last):
 File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
   self.run()
 File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
   self._target(*self._args, **self._kwargs)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/boatimu.py", line 148, in process
   self.poll()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/boatimu.py", line 181, in poll
   msgs = self.client.receive()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/client.py", line 315, in receive
   self.poll(timeout)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/client.py", line 215, in poll
   self.connection.write('watch=' + pyjson.dumps(self.wwatches) + '\n')
AttributeError: module 'pyjson' has no attribute 'dumps'
Traceback (most recent call last):
 File "/usr/local/bin/pypilot", line 11, in <module>
   load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot')()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 386, in main
   ap.iteration()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 381, in iteration
   time.sleep(dt)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 169, in cleanup
   raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
closing autopilot
terminate calibration process
Reply
#7
(2021-05-13, 06:17 PM)cosborne Wrote: I don't think I had a problem with running pypilot from cli until I reinstalled as sudo but I could be wrong. I definitely have an issue now.

Code:
pi@openplotter:~/pypilot/pypilot $ service pypilot stop
pi@openplotter:~/pypilot/pypilot $ pypilot
imu process 23486
nmea process 23491
listening on port 20220 for nmea connections
made imu process realtime
loading servo calibration /home/pi/.pypilot/servocalibration
WARNING: using default servo calibration!!
Using settings file RTIMULib.ini
Settings file not found. Using defaults and creating settings file
Detected MPU9250/MPU9255 at standard address
Using fusion algorithm Kalman STATE4
IMU Name: MPU-925x
min/max compass calibration not in use
Using ellipsoid compass calibration
Using accel calibration
Loaded Pilots: ['absolute', 'basic', 'simple', 'learning']
warning: failed to open special file /dev/watchdog0 for writing
        cannot stroke the watchdog
gps process 23495
pypilotServer process 23498
server setup has 5 pipes
Process Process-6:
Traceback (most recent call last):
 File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
   self.run()
 File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
   self._target(*self._args, **self._kwargs)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/server.py", line 398, in run
   self.poll(dt)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/server.py", line 564, in poll
   connection.write('watch=' + pyjson.dumps(connection.cwatches) + '\n')
AttributeError: module 'pyjson' has no attribute 'dumps'
serialprobe removing gps device /dev/serial/by-id/usb-u-blox_AG_-_www.u-blox.com_u-blox_7_-_GPS_GNSS_Receiver-if00
MPU-925x init complete
failed send ex 86016.668265574 86016.668315011 module 'pyjson' has no attribute 'dumps'
failed to encode data pipe! imu_pipe[1] module 'pyjson' has no attribute 'dumps'
Process Process-2:
Traceback (most recent call last):
 File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
   self.run()
 File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
   self._target(*self._args, **self._kwargs)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/boatimu.py", line 148, in process
   self.poll()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/boatimu.py", line 181, in poll
   msgs = self.client.receive()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/client.py", line 315, in receive
   self.poll(timeout)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/client.py", line 215, in poll
   self.connection.write('watch=' + pyjson.dumps(self.wwatches) + '\n')
AttributeError: module 'pyjson' has no attribute 'dumps'
Traceback (most recent call last):
 File "/usr/local/bin/pypilot", line 11, in <module>
   load_entry_point('pypilot==0.24', 'console_scripts', 'pypilot')()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 386, in main
   ap.iteration()
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 381, in iteration
   time.sleep(dt)
 File "/home/pi/.local/lib/python3.7/site-packages/pypilot/autopilot.py", line 169, in cleanup
   raise KeyboardInterrupt # to get backtrace on all processes
KeyboardInterrupt
closing autopilot
terminate calibration process

After installing the pyjson module with pip, I am now getting this exact error. Also I backtracked your steps and am getting all the same errors as you with pypilot_servo, and running servo.py from the pypilot installation directory.  So looks like we are both chasing the exact same bug. If it makes any difference I am running openplotter headless, which came with pypilot version 0.16.

Edit: after a bit more digging I've noticed that with the pyjson module installed, pypilot fails immediately after running. If I uninstall pyjson using pip, the pypilot process will stay running for a short time, before failing with the original error I posted that I noticed was quite similar to cosborne's error running servo.py.
Reply
#8
For what it's worth, I had an openplotter SD card with a slightly dated 0.24 version on it, last commit 25-apr-2021. It also gave the 'No module named pyjson' message. Yet, it started pypilot with only minor moaning, and connected to a USB-connected arduino all right. So your problem is not something from the very recent commits. Updating it to the latest commit *) yields no difference.

I also installed a fresh openplotter image (2020-12-16-OpenPlotter-v2-Headless), installed pypilot through the openplotter setup installer, then updated from git, and it behaves the same: pypilot starts and connects to the arduino; yet the pypilot_servo console script fails like yours. So, the failing of pypilot_servo console script does not seem to be a problem for pypilot itself to function properly, and your problem seems to stem from a messed up installation.

*) A robust way to update pypilot on openplotter after so many trials and errors, is to deinstall from the openplotter setup installer, then reinstall the 0.16 version from that same installer, then finally update from git. This method I had to use, and might be the solution for you as well.
Reply
#9
I started with a fresh sd card using the 2020-12-16-OpenPlotter-v2-Headless image. I followed your instructions for the "robust update". I updated from git exactly as described in your workbook article (thanks for your contribution). I am experiencing the same issues. When trying to calibrate the compass, the screen is just black and doesn't allow any calibration in addition to the issues shown before.
Reply
#10
When starting up the new openplotter image, there's this software upgrade as part of the initialisation sequence, provided it has internet access through ethernet cable. I always run this. Did you as well?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)