Need to use ROS on pitop4

Im trying to make an AGV and am planning to use ROS for the path planning and navigation.But ROS needs Ubuntu 18.04 and on the Pi-Top4 raspbian is preinstalled.
Will installing ubuntu in it require some diff steps all together(im new to this world so i dont have much idea about this.)and will installing ubuntu change anything in the pi top display?

You’re in luck! I’ve been playing with ROS for a while now as part of integrating robotics with pi-top [4] - it’s completely awesome so I’m really glad to hear others are interested too!

The approach I took (which is definitely the right approach) is to use a Docker container based on Ubuntu. The advantage of this is that you can keep all of your ROS code completely isolated from pi-topOS and you can deploy it to any pi-top really easily without any dependency issues.

Here’s an example Dockerfile:

FROM ros:noetic-ros-core

USER root

# add pi-top [4] PMA libraries into the docker container
ADD /usr/lib/python3/dist-packages/ptpma /usr/lib/python3/dist-packages/ptpma
ADD /usr/lib/python3/dist-packages/ptcommon /usr/lib/python3/dist-packages/ptcommon

# create catkin workspace
ENV CATKIN_WS /home/catkin_ws
RUN mkdir -p $CATKIN_WS/src
WORKDIR $CATKIN_WS

# add .bashrc entries
RUN echo 'source /ros_entrypoint.sh' >> ~/.bashrc
RUN echo 'cd /home/catkin_ws' >> ~/.bashrc

Install Docker like this:

curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi

You can then reboot so you don’t have to use sudo with docker commands

Build the docker image like this:

docker build -t ros-noetic-pi-top:0.0.1 .

(be inside the directory where your Dockerfile is stored, you can change the tag to whatever you want)

Once it’s built, run it like this:

docker run -it --privileged -p 8022:22 -p 80:80 -p 8080:8080 -p 9090:9090 -p 11311:11311 ros-noetic-pi-top:0.0.1

I’ve included some port forwarding there, 8022 is for SSH access, 80 is for web server access, 8080 is for the ROS video web server, 9090 is for ROS web sockets, 11311 is for the ROS master - this is so you can interact with the docker image from pi-topOS or from browsers on your local network.

Here’s some stuff you might want to do once inside the docker container:

# fix GPG key issue with ROS Noetic
apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' \
  --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt-get clean && apt-get update

# update apt registry
apt-get --fix-broken install  # get this recommendation if trying to install packages
apt-get update

# install build tools like gcc (ROS needs it)
apt-get install -y build-essential

# install python3 tools
apt-get install -y python3-pip python3-opencv python3-yaml
apt-get install -y libv4l-dev

# random tools for development purposes
apt-get install -y nano git

The first stuff is really important as there’s a GPG issue with ROS Noetic due to a security issue they had.

If you need any more help let me know! :+1:

Thanks @duwudi
i have successfully installed the ROS Docker.Please can u send me some examples in ROS for navigation and SLAM.It would be great if u can share some git repos for the same.

Will i be able to visualize the output of the realsense cameras using this docker like in this video?

It would be great if we can connect via mail or google meet so i can show the issue im facing.
phillivan99@gmail.com
Thank You!!!

@phillivan the install instructions I gave you would have installed ROS noetic core on the Raspberry Pi within a docker container, which won’t include tools like rviz or any other GUI tools. If you want those GUI tools you have to install ROS Desktop or ROS Desktop Full, for that you have two options:

  1. Install ROS Desktop onto Ubuntu on a different machine (I use a virtual one on VMWare) that’s on the same network as your Raspberry Pi and connect to the ROS core server running in the docker that way, you can then access published topics etc and use all the GUI tools you want with them (rviz, image_view etc). Note: this is why I have port 11311 forwarding on the docker run command, this let’s other ROS systems access the ROS server in the docker container. You’ll need to add these to ~/.bashrc on your ubuntu machine to connect (don’t forget to run source ~/.bashrc afterwards):

    ROS_IP=192.168.1.158 (your ubuntu computer IP)
    ROS_HOSTNAME=192.168.1.158 (your ubuntu computer IP)
    ROS_MASTER_URI=http://192.168.1.120:11311/ (your Raspberry Pi IP)

  2. Install ROS Desktop within a docker container and use some of these methods to get the GUI windows you need appearing on the host Raspberry Pi system.

I prefer method 1 because I’d like to keep the development environment that the robot will eventually run on as clean and minimal as possible.

Even without doing the above, you can still view video feeds by using something like the web_video_server package as long as the image feeds are being published by another node (web video server is why I have port 8080 forwarding too)

In terms of open-source GitHub repos, I am working on one currently for our new Robotics Kit. It’s not ready to be public yet because it relies on some submodules that are still private, as soon as that is sorted I’ll let you know. Other than that, it’s hard for me to point you to code as I don’t know what platform you’re developing for, do you have a robot already?

Also with regards to talking more on ROS / Raspberry Pi / Docker containers, I’ll set up a Slack or Discord soon where we can chat with others who are interested too :+1: