GoPiGo3 on Ubuntu 20.04 Focal Fossa with ROS Noetic
Companion to BRJapon, “Hands On ROS For Robotics Programming”
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.
For this code, I had to edit the three python code files and change:
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:
@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:
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.
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!