Install PiOS and GoPiGo3 Software (Instead of Raspbian For Robots)

Headless Setup GoPiGo3 Over PiOS

(adds VNC for Mac Screen Connect)

As Of: 14 Oct 2021

Check for latest PiOS:

Check for latest GoPiGo3 Software:

Write Latest PiOS to SDcard with Raspberry Pi Imager

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
}

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

Change password:
$ passwd (do not use sudo passwd, will mess up pw table, use sudo vipw, save, exit to fix)

Update OS

$ sudo apt update
$ 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"

===Install GoPiGo3 software

  $ curl -kL dexterindustries.com/update_gopigo3 | bash
  $ curl -kL dexterindustries.com/update_sensors | bash
  $ sudo reboot
  (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/Examples
  $ ./Read_Info.py
  • check gpg3_config.json for ticks
  $ 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}
  • Continue with test effectors and sensors
  $ ./Motors.py
  $ ./Servo.py
  $ ./Grove_US2.py  (with Grove Ultrasonic Ranger in AD1 for time being)
  $ ./easy_Distance_Sensor.py 
  $ python3 ~/Dexter/DI_sensors/Python/Examples/IMUSensor.py 
  (Put IMU in AD1, move Grove US ranger to AD2 and 
    change Grove_US.py GPG.GROVE_1 to GPG.GROVE_2 two places)

=== 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)

  • Network 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

  • Interfacing:PiCamera enable

  • DisplayOptions:Resolution:1920x1080

  • SystemOptions:BootOptions:Desktop GUI, requiring user to login, Return

  • Interfacing: VNC enable

  • Tab to Finish, reboot now? yes

=== Configuring vncserver

$ nano /home/pi/.vnc/config.d/vncserver-x11-virtual

add to file these two lines, save and exit (ctrl-x):

Authentication=VncAuth
Encryption=PreferOff

Continuing:

sudo cp .vnc/config.d/vncserver-x11-virtual /root/.vnc/config.d/vncserver-x11
sudo vncpasswd -service    (set the password you want for vnc logins)
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

=== Run Desktop "GoPiGo3 Control Panel"

  • asks what do you want to do? Click Execute
  • Try all the buttons

=== Run Desktop "GoPiGo3 Calibration"

  • Asks what to do: Execute
  • For my bot at this speed: 66.5mm 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.5, "wheel-base-width": 104.5, "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
$ sudo pip3 install -r requirements.txt
$ python3 remote_robot.py
  • Open a browser to http://<your bot’s IP>:5000 (note: http not https )
  • Hold down mouse button and drag it fwd to go forward,
  • try dragging right/left/back etc.

=== 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!

2 Likes

This should be:
(Note the "PURPLE" LED means connected to WiFi)

Should read:

Check for latest LEGACY PiOS

Write Latest Legacy PiOS to SDcard with Raspberry Pi Imager
(Do not use the latest PiOS which will be a "Bullseye" based OS - GoPiGo3 software installation will not succeed, as of April 2022)

1 Like

Also Legacy PiOS changed the audio to default to pulseaudio and HDMI. To get headphone out and espeak/espeak-ng to work:

=== First see if audio output works the way you want (auto) ===
Test audio out:
    aplay /usr/share/sounds/alsa/Front_Center.wav

If not:

$ sudo apt purge pulseaudio
$ sudo apt autoremove

$ nano /home/pi/.asoundrc

pcm.!default {
  type asym
  playback.pcm {
    type plug
    slave.pcm "output"
  }
  capture.pcm {
    type plug
    slave.pcm "mic"
  }
}

pcm.output {
	type hw
	card 1
}

ctl.!default {
	type hw
	card 1
}

pcm.mic {
  type plug
  slave {
    pcm "hw:2,0"
  }
}

ctrl-x, y to save it
 
$ reboot
  • Now audio will come out the headphones, and
  • If you plug in a USB audio interface you can use a microphone.

Retest with:

$ aplay /usr/share/sounds/alsa/Front_Center.wav
$ espeak "hello"
1 Like