ROS Melodic on Magni Silver - DIY

Hello Ubiquity Community!

My colleagues and I have a Magni Silver on the way. We would like to run ROS Melodic in Ubuntu 18.04 on the Raspberry Pi4. We have our own Navigation stack and will be connecting additional sensors to the Magni. I am aware there is no image (at least officially) for ROS Melodic, but I am hoping to get some advice here that can help us get up and running or at least heading in the right direction.

Is the main task creating a ROS package to interface with the motors like the Kinetic package ubiquity_motor? Any other major packages we should be aware of and look to migrate to Melodic?

We are actively working hard to get Noetic on top of Ubuntu 20.04 onto an image.

Melodic may be more forgiving, I’m not sure.

Thus we are ‘skipping over’ ROS Melodic. Somebody may chime in but I suspect it could also be a multi-problem but maybe not as bad as to 20.04 as that has been the case for going to Noetic. One of the largest issues has been conversion/compatibility for the serial port usage, need to run all python 3 when all our things were python 2.7 and then there have been issues with Raspicam. I’m sure I’m forgetting some … oh yes, the network config tools in 20.04 are another twist that broke some things but again, that was for 20.04

Going to Noetic I can say has been rather painful so we are not yet done but are very close. Sorry but we have no plans to support Melodic.

Agree with Mark said.

If you really have your heart set on it, and you have a functional Ubuntu 18.04 image (if you can find a good one), it should be pretty straight forward to get something working by compiling all of the Magni packages from source.

The main task would likely be in fixing minor OS issues and getting the camera to work. In our initial melodic testing, getting raspicam to work was the biggest dealbreaker. If you don’t need it, most other packages work on Melodic as far as I know, including ubiquity_motor, fiducials, and move_basic. Although we don’t test on melodic, so things might have broken.

But I again want to emphasize that it is unsupported, and this is about the extent of help we will provide. If you still want to do it, buckle in and good luck :slight_smile:

Rohan Agrawal

If you start with our working 16.04 image, you can try to remove ROS and catkin_ws entirely, do a dist upgrade to melodic. also do a systemctl disable of magni_base.

You should then be able to do a full desktop install of ros melodic, and catkin_ws. You then will need to build ALL the ubiquity packages in catkin. this includes magni_robot, raspicam_node, ubiquity_motor, move_basic and a few others, I’ll attach my noetic notes.

It took us over four month to get a ‘working’ Noetic image, but a lot of that was python2 vs python3, opencv 3 vs 4.

From ubiquity image 16.04

remove ros, disable magni-base.system, comment out last three lines of .bashrc

update upgrade to 18.04 and then 20.04 best to do this while not mounted in robot, connected directly with hdmi, keyboard/mouse – wired ethernet. I’ve had lots of difficulty with the pi 4 I am using losing wireless – this might be just a flakey Pi 4.

This also may involve removal of certain packages. After getting to 20.04 I needed to reinstall lubuntu-desktop and gdm3 (lightdm and sddm seemed to break after 20.04)

ubuntu-20.04.2-preinstalled-server-armhf+raspi.img.xz

starting from 20.04 image use u-boot to add bootdelay – 2 so can boot inserted into Magni
add gpu_mem=128 start_x=1 to config.txt to enable raspicam

some of these installs might be duplicates of already installed packages

22 sudo apt install mlocate
25 sudo apt install python-setuptools python3-setuptools
28 sudo apt install unzip
34 sudo apt install make

37 sudo apt install build-essential

ROS + catkin install via typical instructions, but note ros-noetic-desktop-full does not exist for the arm32 (armhf71) architecture

46 sudo sh -c ‘echo “deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main” > /etc/apt/sources.list.d/ros-latest.list’

sudo -E apt-key adv --keyserver ‘hkp://keyserver.ubuntu.com:80’ --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

sudo apt update
sudo apt install ros-noetic-desktop

sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool
(note python3-rosdep NOT python3-rosdep2 !!!

source ros environment

sudo apt install ros-noetic-usb-cam*
sudo apt install net-tools
sudo apt install network-manager
sudo apt install ros-noetic-rosbridge*
sudo apt install python-is-python3
sudo apt install ros-noetic-tf2*
160 sudo apt install ros-noetic-teleop-twist*

vision*, navigation* image

Optional, proabably not needed or already part of tf2*:
sudo apt-get install ros-noetic-velocity-controllers
sudo apt install ros-noetic-diff-drive-controller
sudo apt install ros-noetic-joint-state-controller

catkin

?sudo apt install chrony

???------optional---- suggest not using raspi-config on ubuntu------???
sudo dpkg -i /tmp/raspi-config_20200601_all.deb
10 sudo raspi-config install userland
??? may not need if already installed from 16.04 image ???

sudo snap install rpi-userland –edge

copy the userland/opt/vc from snap to opt/vc
(this installs the mmal libraries)

pigpiod is needed for pi_sonar

wget https://github.com/joan2937/pigpio/archive/master.zip
unzip master.zip
cd pigpio-master/
make
sudo make install

sudo rosdep init
rosdep update

catkin
mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

72 git clone http://github.com/ubiquityrobotics/ubiquity_motor
73 git clone http://github.com/ubiquityrobotics/magni_robot
74 git clone http://github.com/ubiquityrobotics/pi_sonar
75 git clone http://github.com/ubiquityrobotics/oled_display_node

80 git clone http://github.com/wjwwood/serial
git clone http://github.com/ubiquityrobotics/move_basic

edit pi_sonar.cpp add #include <boost/format.hpp>

edit launch base add () to prints ??? may have been done already

edit test_motor.py in ubiquity_motor replace 2 ‘,e’ to ‘as e’

catkin_make

tested

on my version raspistill works, magni_base, pi_sonar, oled_display all work, I could drive with logitech.

Not working - wifi - not sure if software/firmware or this Pi 4 unit. I’ll experiment with turning BT off, but this seems intermittent, and I am leaning to the wifi chip. Seems to be a problem with the Pi. The Pi 3 can’t seem to handle the load of lubuntu, so I’ve only tested on one Pi 4. Ideally, I’d like to duplicate with a brand spanking new Pi 4 - hint – hint. Lterature says Pi 4 wifi very sensitive to under voltage, but it seems worse when on the magni, and better when outside powered by a lower amperage (2 amp) supply.

To DO: pifi build install for 20.04 I tried building from Rohan’s github, but failed, may have to do with minuart-bt overlay

New magni_base in usersbin, new roscore in systemd

etc/ubiquity/env.sh and robot.yaml

Notes sample config.txt:

gpu_mem=128
start_x=1

[pi4]
kernel=uboot_rpi_4.bin
max_framebuffers=2

[pi2]
kernel=uboot_rpi_2.bin

[pi3]
kernel=uboot_rpi_3.bin

[all]
#arm_64bit=1
device_tree_address=0x03000000

The following settings are “defaults” expected to be overridden by the

included configuration. The only reason they are included is, again, to

support old firmwares which don’t understand the “include” command.

#hdmi_safe=1
enable_uart=1
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on
dtoverlay=miniuart-bt
core_freq=250
dtoverlay=ic2-rtc,mcp7940x

cmdline=cmdline.txt

include syscfg.txt
include usercfg.txt

disable_overscan=1
dtoverlay=vc4-fkms-v3d

sample cmdline.txt

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 root=LABEL=writable rootfstype=ext4 rootwait fixrtc

(in old style from upgrade files are in /boot, in 20.04 source install from /boot/firmware)

1 Like

Firstly, @mjstn2011 @anfederman @rohbotics thank you all for the message. I certainly have enough info now to get started.

As it is still python2, I am feeling optimistic. I’ll look to build the essential Magni packages in catkin and take it from there. Thanks a lot for your notes @anfederman !

Just to reiterate, I am aware there is no support for Melodic, so your inputs are really appreciated. For various reasons which I won’t go into here, we are continuing with Melodic in our project. If we do look to upgrade, it’ll be quite sometime in the future and more likely only for a full migration to ROS 2.

1 Like