bluerobotics / companion

Companion computer startup scripts and examples
https://www.ardusub.com/operators-manual/companion-web.html
GNU General Public License v3.0
48 stars 54 forks source link

update installation scripts #284

Closed jaxxzer closed 2 years ago

jaxxzer commented 4 years ago

Companion can be installed on a vanilla raspbian image like this:

wget https://raw.githubusercontent.com/jaxxzer/companion/setup-clean/scripts/install.sh
chmod +x install.sh
./install.sh

This is working on pi 3 and pi 4.

We've lost webterminal support. I recommend using chrome terminal extension to replace the functionality (make ssh easy on windows).

TODO fetch br master branch + tags and checkout stable

jaxxzer commented 4 years ago

create a log file

jaxxzer commented 4 years ago

~git page is not working~

patrickelectric commented 4 years ago

Failing in 3B+ latest Raspbian buster image

patrickelectric commented 4 years ago

I did run it here, but the webpage is not available:

There are screens on:
        830.mavlink2rest        (05/05/20 15:58:43)     (Detached)
        819.bridgemanager       (05/05/20 15:58:43)     (Detached)
        807.wldriver    (05/05/20 15:58:43)     (Detached)
        796.nmearx      (05/05/20 15:58:43)     (Detached)
        783.audio       (05/05/20 15:58:43)     (Detached)
        766.commrouter  (05/05/20 15:58:43)     (Detached)
        724.video       (05/05/20 15:58:42)     (Detached)
        711.mavproxy    (05/05/20 15:58:42)     (Detached)

I rebooted after finishing the commands in your previous comment. I'm not sure if we need to, but maybe it's better to change the pi password to companion.

jaxxzer commented 4 years ago

@patrickelectric can you check ~/.webui.log?

patrickelectric commented 4 years ago
2020-05-08T11:55:00+0100 <log> index.js:9 (Object.<anonymous>) ENVIRONMENT { SHELL: '/bin/bash',
  SUDO_GID: '0',
  TERMCAP:
   'SC|screen|VT 100/ANSI X3.64 virtual terminal:\\\n\t:DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\\n\t:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\\n\t:do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\\n\t:le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:\\\n\t:li#24:co#80:am:xn:xv:LP:sr=\\EM:al=\\E[L:AL=\\E[%dL:\\\n\t:cs=\\E[%i%d;%dr:dl=\\E[M:DL=\\E[%dM:dc=\\E[P:DC=\\E[%dP:\\\n\t:im=\\E[4h:ei=\\E[4l:mi:IC=\\E[%d@:ks=\\E[?1h\\E=:\\\n\t:ke=\\E[?1l\\E>:vi=\\E[?25l:ve=\\E[34h\\E[?25h:vs=\\E[34l:\\\n\t:ti=\\E[?1049h:te=\\E[?1049l:Km=\\E[M:k0=\\E[10~:k1=\\EOP:\\\n\t:k2=\\EOQ:k3=\\EOR:k4=\\EOS:k5=\\E[15~:k6=\\E[17~:k7=\\E[18~:\\\n\t:k8=\\E[19~:k9=\\E[20~:k;=\\E[21~:F1=\\E[23~:F2=\\E[24~:\\\n\t:kh=\\E[1~:@1=\\E[1~:kH=\\E[4~:@7=\\E[4~:kN=\\E[6~:kP=\\E[5~:\\\n\t:kI=\\E[2~:kD=\\E[3~:ku=\\EOA:kd=\\EOB:kr=\\EOC:kl=\\EOD:',
  SSH_AUTH_SOCK: '/tmp/ssh-q104Dn1JmBXE/agent.782',
  WINDOW: '0',
  SUDO_COMMAND:
   '/usr/bin/screen -dm -S webui /home/pi/companion/scripts/start_webui.sh',
  SSH_AGENT_PID: '787',
  SUDO_USER: 'root',
  PWD: '/home/pi/companion/br-webui',
  LOGNAME: 'pi',
  HOME: '/home/pi',
  LANG: 'en_GB.UTF-8',
  TERM: 'screen',
  USER: 'pi',
  SHLVL: '0',
  COMPANION_DIR: '/home/pi/companion',
  PATH:
   '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
  STY: '770.webui',
  SUDO_UID: '0',
  MAIL: '/var/mail/pi',
  OLDPWD: '/',
  _: '/usr/bin/node' }
2020-05-08T11:55:00+0100 <log> index.js:10 (Object.<anonymous>) COMPANION_DIR /home/pi/companion
2020-05-08T11:55:00+0100 <log> index.js:11 (Object.<anonymous>) HOME_DIR /home/pi
2020-05-08T11:55:00+0100 <log> index.js:79 (Object.<anonymous>) loading video format from file /home/pi/vidformat.param
2020-05-08T11:55:00+0100 <log> index.js:94 (Object.<anonymous>) loading camera profiles from file /home/pi/camera-profiles
2020-05-08T11:55:00+0100 <warn> index.js:54 (readConfigFile) error reading configuration file /home/pi/camera-profiles { Error: ENOENT: no such file or directory, open '/home/pi/camera-profiles'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at readConfigFile (/home/pi/companion/br-webui/index.js:51:22)
    at Object.<anonymous> (/home/pi/companion/br-webui/index.js:96:26)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/pi/camera-profiles' }
2020-05-08T11:55:00+0100 <warn> index.js:55 (readConfigFile) copying default configuration file /dev/null
2020-05-08T11:55:00+0100 <log> index.js:100 (Object.<anonymous>) camera profiles is empty
2020-05-08T11:55:00+0100 <log> index.js:111 (Object.<anonymous>) loading camera settings from file /home/pi/camera-settings
2020-05-08T11:55:00+0100 <warn> index.js:54 (readConfigFile) error reading configuration file /home/pi/camera-settings { Error: ENOENT: no such file or directory, open '/home/pi/camera-settings'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at readConfigFile (/home/pi/companion/br-webui/index.js:51:22)
    at Object.<anonymous> (/home/pi/companion/br-webui/index.js:112:27)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/pi/camera-settings' }
2020-05-08T11:55:00+0100 <warn> index.js:55 (readConfigFile) copying default configuration file /dev/null
2020-05-08T11:55:00+0100 <log> index.js:116 (Object.<anonymous>) camera settings is empty
2020-05-08T11:55:01+0100 <log> index.js:127 (Object.<anonymous>) found camera: 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Brightness int 50
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Contrast int 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Saturation int 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Red Balance int 1000
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Blue Balance int 1000
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Horizontal Flip bool 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Vertical Flip bool 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Power Line Frequency menu 1
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Sharpness int 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Color Effects menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Rotate int 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Color Effects, CbCr int 32896
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Video Bitrate Mode menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Video Bitrate int 10000000
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Repeat Sequence Header bool 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: H264 I-Frame Period int 60
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: H264 Level menu 11
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: H264 Profile menu 4
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Auto Exposure menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Exposure Time, Absolute int 1000
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Exposure, Dynamic Framerate bool 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Auto Exposure, Bias int_menu 12
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: White Balance, Auto & Preset menu 1
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Image Stabilization bool 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: ISO Sensitivity int_menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: ISO Sensitivity, Auto menu 1
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Exposure, Metering Mode menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Scene Mode menu 0
2020-05-08T11:55:01+0100 <log> index.js:133 () getting control: Compression Quality int 30
2020-05-08T11:55:15+0100 <log> index.js:341 (Server.<anonymous>) App running at http://:::2770
2020-05-08T11:55:15+0100 <log> index.js:488 (formatRemotes) formatRemotes [ 'origin' ]
2020-05-08T11:55:15+0100 <log> index.js:795 () ping -c1 fast.com :  nullPING fast.com (23.12.150.237) 56(84) bytes of data.
64 bytes from fast.com (23.12.150.237): icmp_seq=1 ttl=56 time=59.5 ms

--- fast.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 59.480/59.480/59.480/0.000 ms

2020-05-08T11:55:15+0100 <log> index.js:404 () Current HEAD: 562770ac
2020-05-08T11:55:15+0100 <log> index.js:344 () Companion version:  0.1.0

2020-05-08T11:55:15+0100 <log> index.js:348 () Git revision:  562770acc3c9e9b33bc30645551c06b166e006de

2020-05-08T11:55:15+0100 <log> index.js:404 () Current HEAD: 562770ac
2020-05-08T11:55:15+0100 <log> index.js:454 () connecting to remote origin https://github.com/jaxxzer/companion
chrisfraser commented 3 years ago

Hey guys, let me know if you need help testing. I will set up some pi's on the bench here.

patrickelectric commented 3 years ago

Hi @chrisfraser be free to run the commands in the PR body to test it :) You'll need a fresh install of the latest raspberry OS in your board to run it.

jaxxzer commented 3 years ago

double check permissions on config files under ~

Eliot-Insight commented 3 years ago

@jaxxzer does your install script assume the RPi system python command is set to python3 or something? I've got this up and running on a new RPi4, but am having issues connecting a ping360 device.

  1. I had an issue with companion/tools/scripts/ping_enumerator.py not liking the type hints from brping, so I changed the calling line in companion/.companion.rc to sudo python3 ...,
  2. I may have had to install bluerobotics-ping (can't remember if this was required - it may have only been installed for python2.7, but it might've been fine and I just ran the install for sanity - I've unfortunately closed that terminal now so can't confirm).
  3. It then took issue with the PingDevice class initialisation (3 args passed in instead of 1) which passed in the location and baud directly instead of using connect_serial, so I swapped that over.
  4. After that ping enumerator ran fine, and now bridgemanager is saying str has no method 'decode', at which point I figured this was a general configuration issue not a my setup issue.

I'll continue debugging this for my use tomorrow, but info on the intent would be useful so I don't make a heap of changes that could be easily fixed with a single line or two run/changed somewhere else.

Eliot-Insight commented 3 years ago

Turns out the str has no method 'decode' was the last bug to fix, so I've got it up and running now, and have submitted a PR to @jaxxzer's fork ~here~ which seems to work fine for me on an RPi4 with a fresh install of Raspberry Pi OS (camera, ping360, lights, camera tilt are all working fine, haven't yet checked thrusters but I imagine that's fine given mavlink messages are getting through for lights etc).

mulles commented 3 years ago

If you are interested I could look into implementing a CI which builds an image based on raspian (pi-gen) with the install scripts installed and deploys it to a given emulated raspberry pi version (f.i. 3B+). This is done by emulating the different raspberry pi's with Docker+QEMU, then running some test to check if the image works on the given hardware. Moreover, the same Docker+QEMU emulation can be used to develop images much faster, as on the physical raspberrypi itself as normal laptops have much more processing power. In case you use this process already to build images in house, it would be great to share or point to where to find, as it makes customizing released images much faster. By the way, I have refurbished a ROV with you software, but I am not involved with ROV's anymore. This would be a way for me to give back to your great project as it was nice being able to use it.

ES-Alexander commented 2 years ago

The issues @Eliot-Insight had were caused by a PyPI setup issue in ping-python, which meant that a version was being installed that was incompatible with companion. I've removed their PR link because it was a bandaid fix for the wrong issue, and incidentally caused the Ping Echosounder to not work.

I've avoided that actual bug by specifying the relevant library version, and rebased the rest of these changes onto companion 0.0.29 here. It's very likely that's the last update that will occur for this side of things before an upcoming major release that actually has official support for the more recent Raspberry Pi boards.

ES-Alexander commented 2 years ago

Use BlueOS :-)