BhallaLab / MouseBehaviour

Arduino and PointGrey camera based behaviour setup.
https://mousebehaviour.readthedocs.io/en/latest/
GNU General Public License v3.0
2 stars 5 forks source link

Upgrade to Ubuntu18.04 #65

Closed dilawar closed 4 years ago

dilawar commented 4 years ago

Updated the pipeline to work with 18.04. With latest 16.0.4.7, this pipeline broke (@hrishi16 over email, no official ticket). Anyway, its good to update to 18.04

@ananthamurthy @soumyaaymous

dilawar commented 4 years ago

To test this PR, you need to clone my fork.

$ git clone https://github.com/dilawar/MouseBehaviour -b ubuntu18.04 

And run the pipeline from this fresh checkout.

dilawar commented 4 years ago

Also include the output of lsb_release -a command, and, git log -n 1.

hrishi16 commented 4 years ago

Here are the last two comments: " hrishikesh@bhallalab-behavior1:~/Dilawar_MB/MouseBehaviour/_build$ lsb_release -a LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic

hrishikesh@bhallalab-behavior1:~/Dilawar_MB/MouseBehaviour/_build$ git log -n 1 commit de82262382394bb073ce887a938b69f57bc4a397 (HEAD -> ubuntu18.04, origin/ubuntu18.04) Merge: b151b32 801af89 Author: Dilawar Singh dilawar.s.rajput@gmail.com Date: Tue Aug 25 17:29:53 2020 +0530

Merge remote-tracking branch 'bhallalab/master' into ubuntu18.04

hrishikesh@bhallalab-behavior1:~/Dilawar_MB/MouseBehaviour/_build$ "

hrishi16 commented 4 years ago

From the fresh checkout: _build cmake error:

" -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Checking for module 'libserial' -- Found libserial, version 0.6.0rc3 -- Checking for module 'libtiff-4' -- Found libtiff-4, version 4.0.9 -- Found SPINNAKER_LIB-NOTFOUND CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: SPINNAKER_INCLUDE_PATHS used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera used as include directory in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera SPINNAKER_LIB linked by target "cam_server" in directory /home/hrishikesh/Dilawar_MB/MouseBehaviour/PointGreyCamera

-- Configuring incomplete, errors occurred! See also "/home/hrishikesh/Dilawar_MB/MouseBehaviour/_build/CMakeFiles/CMakeOutput.log". See also "/home/hrishikesh/Dilawar_MB/MouseBehaviour/_build/CMakeFiles/CMakeError.log".

hrishikesh@bhallalab-behavior1:~/Dilawar_MB/MouseBehaviour/_build$ make run make: *** No rule to make target 'run'. Stop. "

dilawar commented 4 years ago

I see.

  1. Go to folder spinnaker-2.0.0.147-amd64 (e.g., cd spinnaker-2.0.0.147-amd64)
  2. Install debian package: sudo dpkg -i lib*.deb (select all packages starting with lib).
  3. Wait till installation is over and then redo the build step.
  4. Also execute sudo ./configure_spinnaker.sh and sudo ./configure_usbfs.sh in the same folder.

I guess, sudo ./boostrap.sh has these steps.

We are getting there.

hrishi16 commented 4 years ago

" hrishikesh@bhallalab-behavior1:~/Dilawar_MB/MouseBehaviour/spinnaker-2.0.0.147-amd64$ sudo dpkg -i lib*.deb dpkg: error processing archive libspinnaker_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinnaker-c_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinnaker-c-dev_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinnaker-dev_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinvideo_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinvideo-c_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinvideo-c-dev_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) dpkg: error processing archive libspinvideo-dev_2.0.0.147_amd64.deb (--install): package architecture (amd64) does not match system (i386) Errors were encountered while processing: libspinnaker_2.0.0.147_amd64.deb libspinnaker-c_2.0.0.147_amd64.deb libspinnaker-c-dev_2.0.0.147_amd64.deb libspinnaker-dev_2.0.0.147_amd64.deb libspinvideo_2.0.0.147_amd64.deb libspinvideo-c_2.0.0.147_amd64.deb libspinvideo-c-dev_2.0.0.147_amd64.deb libspinvideo-dev_2.0.0.147_amd64.deb "

Also, i tried using $ sudo -E ./bootstrap.sh an $ sudo ./bootstrap: this is the error in the end: " . . Setting up python3-decorator (4.1.2-1) ... Setting up python3-scipy (0.19.1-2ubuntu1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... The directory '/home/hrishikesh/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/hrishikesh/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Could not open requirements file: [Errno 2] No such file or directory: '../requirements.txt'

"

Why is pip giving trouble now?

hrishi16 commented 4 years ago

The point 4) was executed and user added to group

dilawar commented 4 years ago

does not match system (i386)

This is bad. The installed ubuntu is 32 bit. It should be 64 bit (amd64 and not i386 or i686). Either resinstall or fix the architecture.

hrishi16 commented 4 years ago

oh okay, that can be solved. Will update once done

hrishi16 commented 4 years ago

This looks like a python version issue:

" hrishi@hrishi-Latitude-E5270:~/Dilawar_MB/MouseBehaviour/_build$ make run [ 60%] Built target cam_server [ 80%] Generating ../protocol_All1/protocolAll1.hex Arduino/main.ino: In function ‘void deliverShock(int)’: Arduino/main.ino:195:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while( (millis() - stamp) < duration) ^ /usr/share/arduino/hardware/tools/avr/bin/avr-objcopy: --change-section-lma .eeprom=0x0000000000000000 never used

AVR Memory Usage

Device: atmega328p

Program: 15270 bytes (46.6% Full) (.text + .data + .bootloader)

Data: 985 bytes (48.1% Full) (.data + .bss + .noinit)

[ 80%] Built target build_arduino_hex Traceback (most recent call last): File "./makefiles/bin/ard-reset-arduino", line 34, in ser = serial.Serial(args.port[0], 115200) File "/home/hrishi/.local/lib/python2.7/site-packages/serial/serialutil.py", line 240, in init self.open() File "/home/hrishi/.local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg)) serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0' makefiles/Arduino.mk:1453: recipe for target 'reset' failed make[4]: [reset] Error 1 CMakeFiles/upload.dir/build.make:57: recipe for target 'CMakeFiles/upload' failed make[3]: [CMakeFiles/upload] Error 2 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/upload.dir/all' failed make[2]: [CMakeFiles/upload.dir/all] Error 2 CMakeFiles/Makefile2:208: recipe for target 'CMakeFiles/run.dir/rule' failed make[1]: [CMakeFiles/run.dir/rule] Error 2 Makefile:216: recipe for target 'run' failed make: *** [run] Error 2 "

Already tried: $ sudo apt install python3-pip

$ pip install pyserial Successfully installed pyserial-3.4

$pip --version pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Any way to set python environment and dependencies automatically? I thought it was there..

dilawar commented 4 years ago
  1. Instead of saying 'pip install', say 'python3 -m pip install' to make sure right version of python is used. Currently, python2 and python3 are mixed. But this is not the issue here.

  2. Check if you are in 'dialout' group else you won't be able to access serial port. Paste the output of ls -a /dev/ttyACM0 (there will be group info there, you should belong to that group).

  3. Additionally, you also need to be in pgrimaging or flirimagimg group to access camera. There is a script in spinnaker folder which will set it up for you.

You can check your groups by using groups command and add yourself to a group using usermod command. Stack exchange sites have plenty of examples.