GoPiGo3 on Ubuntu 20.04 Focal Fossa with ROS Noetic
Companion to BRJapon, “Hands On ROS For Robotics Programming”
BACKGROUND:
Released in mid 2018, ROS Melodic was a long term support version of ROS (original ROS not ROS 2), and Ubuntu Mate 18.04 officially supported the Raspberry Pi (2B/3B/3B+).
In 2020 BR Japon published the book “Hands On ROS For Robotics Programming” using the GoPiGo3, ROS Melodic over Ubuntu Mate (Desktop) 18.04, and released an SD card image to go with the book.
As of June 2023, ROS Melodic is archived and no longer supported. Ubuntu Mate 18.04 is archived, and no longer supported. Also as of mid 2021, there are two versions of the GoPiGo3 with different number of wheel encoder ticks making old software stop short of requested distance and angles.
The book states to download the original Ubuntu Mate 18.04 image from https://ubuntu-mate.org/ but this not possible and probably hasn’t been possible for since Ubuntu 18.04 reached EOL in May, 2023. We did find a copy in the ubuntu-mate archives but it is hard to find, and only works with early (2018) vintage Raspi 3 B+ boards and older.
The image from SourceForge is never mentioned in the book and in fact is the author’s end state after completion of the exercises in the book.
The issue of not booting on a Pi4 board - the board most easily obtained in late 2023, is a major hurdle.
ROS Noetic is the latest ROS distribution available and the last ROS distribution that will be released - all future releases will be ROS 2.
It is hoped that this effort and SD card image will enable users to use the Hands On ROS book, with a Pi4 powered GoPiGo3, albeit with differences from the book that will require patience and flexibility.
Thanks, I fear we are a long way from that point, and looking longer every forward progress I make.
A really big issue is that “python” was commonly used everywhere in 2020 and in the operating systems. The next version of operating systems began the “python3” era.
I expected the Hands On ROS code would need some changes due to the ROS version change. I forgot about the Python gods mucking with reality.
In fact, while I can make the changes in the code, and get it to work, I am not sure anyone can survive reading the book with a “This is what that means I have to do in my environment” mindset.
The first hurdle - I chose the Server version of Ubuntu so there is no desktop. The book talks about using “terminator” which is a graphical terminal window divider:
but since there is no desktop the user must launch “tmux” and rather than mouse clicking, must use “cntrl-b ” keyboard shortcuts to divide the shells, and to move the cursor between panes.
For this code, I had to edit the three python code files and change:
#!/usr/bin/env python
to
#!/usr/bin/env python3
and then it works.
I should have started with Ubuntu 20.04 Desktop for Raspberry Pi.
I like server operating systems because they require the least processor load, leaving headroom for actually doing robot stuff. BUT, I am still comfortable/actually prefer editing in a console window rather than the far superior graphical environment of VSCode or even “terminator with a mouse” of the Hands On ROS book. I really can’t expect “new to Linux, new to ROS, new to Python” folk to take the “path of most resistance”
Whoa - UPDATE: sudo apt install ubuntu-desktop, (reboot with monitor attached), and it works as described:
Well, that’s a tall order now that I remember going through the book the first time, BUT
Skipped Chapter 4 Rviz and Chapter 5 Gazebo just like I did the first time - these are simulated GoPiGo3 chapters that teach lots and lots about ROS, but I’m always in a hurry to use the real robot please
Jumping into Chapter 6, the book brings down the very early ros-gopigo node, which needed the python → python3 environment specification change:
I opened three terminals on my Mac, ssh pi@10.0.0.xx in each, cd to ~/catkin_ws and let’s see what runs?
had to run the build twice - first so it builds the gopigo3_node.msg package, then second time it built without complaining about the msg package being missing.
For the big test: rosrun gopigo_node gopigo3_driver.py …drum roll please… it started with no errors:
Since I had to get past a bunch of failed scripts that may have enabled my successful steps, I now have to try with a clean OS to get a working “Master Image Installation” script.
Added tigervnc to base OS - partial success. Going to live with limitation - fix is beyond me. Cannot reconnect remote desktop if logout before exiting remote desktop application
GoPiGo3 software install script works
GoPiGo3 Python tests succeed
ROS Noetic software install script works
Install script works for Hands-On-ROS-For-Robotics-Programming code
(Chap3 code and Chap6 example code updated for Noetic)
and Noetic gopigo3_node
Chap 3 works
(Chap6 “updated for Noetic” code is for reference after student completes exercises)
Noetic gopigo3_node successfully runs with teleop_twist_keyboard node
TODO:
Investigate why GoPiGo3 python programs do not work after running ROS GoPiGo3 node
but ROS GoPiGo3 node can be exited and started again no problem.
Document base OS creation steps (cannot be scripted)
Document Testing master image
Create a bootable image that can be installed and configured with the Raspberry Pi Imager
Document steps to image the SD card (setting user/pw, locale, wifi, ssh), and later vncserver password
@este Have you reached pg 178 in the book (the gopigo3_node distance_sensor example?
I would like to know if the behavior I am seeing after running the gopigo3_driver from that package is my system related.
Is it possible for you to run the following sequence of tests with your GoPiGo3 ROS Melodic?
- cold boot
- Open three terminals or shells T1, T2, T3
- cd catkin_ws (in each)
- source /opt/ros/melodic/setup.bash (in each)
- source devel/setup.bash (in each)
- T1: python /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py
Confirm GoPiGo3 turns, then ctrl-c
- T1: roscore
- T2: rosrun gopigo3_node gopigo3_driver.py
- T3: rosrun teleop_twist_keyboard teleop_twist_keyboard.py
press x-key repeatedly until speed is around 0.1
press i-key, confirm GoPiGo3 drives slowly forward
press k-key or spacebar, confirm GoPiGo3 stops
press ctrl-c to exit teleop_twist
- T2: press ctrl-c to exit gopigo3_driver
- T1: press ctrl-c to exit roscore
Now for the point of all this:
- T1: recall the python servo test command (up arrow) or copy/paste again:
python /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py
Confirm GoPiGo3 turns, then ctrl-c
On my system, the program is running quite happily, but the motors are not turning (not happily).
I’ve confirmed restarting the pigpiod does make the motors happy again.
I’ve confirmed running the gopigo3_driver node repeatedly makes the motors work happily (only in ROS)
This is not part of handsonros as far as I could tell, but I found and cloned it into /catkin_ws/src then did catkin_make as required when adding nodes.
The before use of python /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py works
All of the ros items work. Not a fan of the weird keyboard mappings though.
The repeat of python /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py however, does not work, same as what you describe. My, that’s annoying…
BTW, I have had problems with the VNC connection: Copy in Windows and Paste into Mate terminal via tightVNC does not typically work. Using Xfce Terminal seems better but the problem was finally traced back to my VNC client. tightVNC has the copy/paste problem, tigerVNC does not have the copy/paste problem. Both have a problem with character distortion and screen artifacts. Switched again to RealVNC and that seems the best (no character distortion or screen artifacts - still copy/paste issue but only with Mate terminal but not with Xfce or Terminator). God what a confusing mess getting these non-robotic parts to work properly.
Thanks for duplicating this issue. It is not a problem in using the GoPiGo3 with the book, just something I discovered in my “not following the book” approach.
IIRC it was installed with apt in chap 3 not cloned to the workspace. The chapter introduced topics and using rqt. One of the issues I have with ROS is remembering how to run things after a bit not using them. I make tons of “run_xyz.sh” and “echo_xyzzy.sh” and… scripts in the workspace.
In my ROS2 Humble image, I created a custom teleop_gopigo3_keyboard that didn’t print out the holonomic keys and the up/down keys that don’t apply to our little GoPiGo3 bots.
Since you cloned it, you can change it to your favorite keys. I also managed to get a wireless Nintendo game pad (like $10 again IIRC) node working, but teleop works fine for doing the book.
This “Antiquated ROS for Pi4 Revival” effort is complete, giving highly adaptable folks a way to use a Pi4 powered GoPiGo3 robot with the BR Japon book, “Hands On ROS For Robotics Programming”, 2020
I really shouldn’t be so biased toward ROS 2, in 2022 slightly more people downloaded ROS Noetic than ROS 2 Humble, and EOL for Noetic isn’t until May 2025.
Thanks. It was 10 days of way too much focus, and I slept 9 hours the next night. That hasn’t happened in years.
Thank you so SO MUCH@cyclicalobsessive for doing this. The handsonros book is really quite good and it was such a shame that it hit a brick wall so soon after publication. You have given it new life and I believe many will benefit. Thank you also for posting this on https://discourse.ros.org/ where it will get the visibility it so deserves. Well done!