# Headless Setup GoPiGo3 Over PiOS Legacy (2021-12-02 PiOS Legacy) # (adds VNC for Mac Screen Connect) As Of: 04 Dec 2021 **Check for Legacy PiOS:** - [u]https://www.raspberrypi.com/software/operating-systems/[/u] **Check for latest GoPiGo3 Software:** - Check last commit date at [u]https://github.com/DexterInd/GoPiGo3[/u] - Check last commit date at [u]https://github.com/DexterInd/DI_Sensors[/u] **Write Legacy PiOS 2021-12-02 version to SDcard with Raspberry Pi Imager** - start Raspberry Pi Imager - Choose OS->Raspberry Pi OS (Other)->Raspberry Pi OS (Legacy) **Preconfigure WiFi SSID/PW and enable SSH** - touch /boot/ssh.txt (or create the empty file) - write /boot/wifi_supplicant.conf (example USA WiFi) ``` country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="wifissid" psk="wifipassword" key_mgmt=WPA-PSK } ``` === disable ipv6 Browse the disk (boot) Rt Click on System Volume Information->Open Terminal Here cd .. cp /boot/cmdline.txt /boot/cmdline.txt.bak nano cmdline.txt add to end of line/file: ipv6.disable=1 save, exit editor **First Boot:(With amplified speaker or headphones connected)** - Announces bot IP - Will keep playing "To Install Screen Reader - press cntrl-alt-space" through audio jack (until you ssh in and rename the prompt in the next step) **First SSH:** - ssh pi@X.X.X.X (The IP spoken by bot at boot) - (If needed: ssh-keygen -R X.X.X.X , then try ssh again) - pw: raspberry - To stop incessant message: ``` $ sudo mv /usr/share/piwiz/srprompt.wav /usr/share/piwiz/srprompt.wav.bak ``` **Update OS** ``` $ sudo apt update ``` apt list --upgradable -a Listing... Done libnss3/oldstable 2:3.42.1-1+deb10u4 armhf [upgradable from: 2:3.42.1-1+deb10u3] libnss3/now 2:3.42.1-1+deb10u3 armhf [installed,upgradable to: 2:3.42.1-1+deb10u4] ``` $ sudo apt full-upgrade a readme will pop - press q (Now go out for lunch/dinner, takes a long while) $ sudo reboot ``` **[Optional] Install espeak-ng Text-To-Speech** ``` $ sudo apt install espeak-ng $ espeak-ng "Hello" ``` **=== Configure for locale, timezone (US-Eastern Timezone in my case), add VNC** $ sudo raspi-config - (You can exit menus by using Tab key, move to Finish, enter key) - System Options: Change Password - System Options: change hostname if desired (default is raspberrypi) - change Localisation:Locale - unselect en_GB with spacebar, - select en_US.UTF8 with spacebar - Tab to OK, Return - default local? down to en_US.UTF-8, return   - change Localisation:Timezone-> US->Eastern - change Localisation:WiFi Country->US (shortcut: press U) - InterfaceOptions:PiCamera enable - DisplayOptions:Resolution:1920x1080 - SystemOptions:BootOptions:Desktop GUI, requiring user to login, Return - InterfaceOptions: VNC enable - Tab to Finish, reboot now? yes **=== Configuring vncserver** ``` $ dpkg -l | grep vnc $ vncserver $ sudo nano /root/.vnc/config.d/vncserver-x11 ``` add to file these two lines, save and exit (ctrl-x): ``` Authentication=VncAuth Encryption=PreferOff ``` === Change VNC password ==== At a terminal: - sudo vncpasswd -service - new password - new password **Continuing:** ``` sudo systemctl restart vncserver-x11-serviced.service vncserver -kill :1 vncserver :1 -geometry 1920x1080 -depth 24 -Authentication VncAuth -Encryption PreferOff -SecurityTypes StandardUser ``` - Use "Mac splat-k" (Command-k) to bring up "Connect to Server" ``` vnc://ip.ip.ip.ip (no port), press enter enter vnc service password ``` **Pi will guide through setting up like a new user, just go with it** - set timezone, - connect to WiFi, - set a password (I used pi user password set earlier), - skip the OS update, - Done **===Install GoPiGo3 software** ``` $ curl -kL dexterindustries.com/update_gopigo3 | bash $ curl -kL dexterindustries.com/update_sensors | bash $ sudo shutdown -h now ``` **=== (Move Card to GoPiGo3 Robot if not already) ``` (Note green pwr LED will be solid after this indicating gpg3_power.service is running) (Note red/green "yellow" WiFi LED means connected to WiFi) ``` **Test GoPiGo3 Software Installation** ``` $ cd Dexter/GoPiGo3/Software/Python/Examples $ ./Read_Info.py ``` * Continue with test effectors and sensors ``` $ python3 Motor.py ``` * check gpg3_config.json for ticks **(only created after python3 execution of an example, ./Motor.py will run as python2.7)** ``` $ more ~/Dexter/gpg3_config.json * "Old GoPiGo3": {"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 6, "motor_gear_ratio": 120} * "New GoPiGo3": {"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 16, "motor_gear_ratio": 120} ``` $ ./Servo.py $ ./Grove_US2.py (with Grove Ultrasonic Ranger in AD1 or AD2) $ ./easy_Distance_Sensor.py (with IMU in AD1) $ python3 ~/Dexter/DI_sensors/Python/Examples/IMUSensor.py ``` **=== Run Desktop "GoPiGo3 Control Panel"** - asks what do you want to do? Click Execute - Try all the buttons **=== Run Desktop "GoPiGo3 Calibration" (will create ~/Dexter/gpg3_config.json if not present)** - Asks what to do: Execute - For my bot at this speed: 66.6mm and 104.5mm WOW!! worked best - This must because it is at 300DPS. - I usually run my bot at 150DPS so config closer to the physical 117mm - Save and Exit - Check that it saved: ``` $ more ~/Dexter/gpg3_config.json {"wheel-diameter": 66.6, "wheel-base-width": 104.0, "ticks": 16, "motor_gear_ratio": 120} ``` **=== Check File Space** - $ df -h **=== Check Memory** - $ free -h **=== Test Camera** In an ssh terminal or terminal on the desktop: ``` $ cd ~/Dexter/GoPiGo3/Projects/RemoteCameraRobot ``` - BTW - Read the README at: [u]https://github.com/DexterInd/GoPiGo3/tree/master/Projects/RemoteCameraRobot[/u] ``` $ sudo pip3 install -r requirements.txt $ python3 remote_robot.py ``` - Open a browser to http://:5000 (note: http **not** http[u]**s**[/u] ) - Hold down mouse button and drag it fwd to go forward, - try dragging right/left/back etc. - had to kill it from another term: - ps -ef | grep remote_robot.py - kill -9 xxxx **=== SHUTTING DOWN** ``` $ sudo shutdown -h now ``` - NOW WATCH FOR THE GREEN LIGHT TO START BLINKING - (may take a minute or two) - Turn power off, recharge battery # NOTE: python is linked to python 2.7.16 - wisdom says don't mess with that