Skip to content

Instantly share code, notes, and snippets.

@vmayoral
Created September 7, 2021 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmayoral/f44339b2eb575dddf4497ffbe8c9cd96 to your computer and use it in GitHub Desktop.
Save vmayoral/f44339b2eb575dddf4497ffbe8c9cd96 to your computer and use it in GitHub Desktop.
Is it possible to install ROS2 in petalinux? - Zynq UltraScale+ MPSoC

Hello @jg_spitfire,

Short answer, absolutely, yes. It's possible. I discussed the different possibilities for the ZCU102 in here. I'll be speaking about this particularly in about a week in Adapt 2021. Check out the following robotics talks we're giving:

  1. Expanding Kria SOMs Beyond Vision AI (with ABB Robotics)
  2. Bringing Adaptive Computing To Robotics
  3. ROS 2 Acceleration

You can register for adapt in here.

@jg_spitfire wrote:

Hi,

I have a KRIA KV260 EVK and I would like to install ROS2 in Linux, here are the requirements to install ROS2:

Tier 1 platforms:

   Ubuntu 20.04 (Focal): amd64 and arm64

   Mac macOS 10.14 (Mojave)

   Windows 10 (Visual Studio 2019)

Tier 3 platforms:

   Ubuntu 20.04 (Focal): arm32

   Debian Buster (10): amd64, arm64 and arm32

   OpenEmbedded Thud (2.6) / webOS OSE: arm32 and x86So I need Ubuntu 20.04 but this is the first time I am gonna use petalinux so I dont know whether I could install Ubuntu 20.04 using petalinux or is petalinux the Linux distribution itself?, or maybe I should install Ubuntu directly on the KRIA EVK?, I ask for petalinux because the UltraScale docs says that if you dont have experience with Linux you should use petalinux.

   the KRIA KV260 already has a prebuilt image (petalinux) to be burn in the sd card, but as I mentioned before, I dont know if I could install ROS2 there.thanks

That's right, those are the official platforms according to REP-2000. In this case, PetaLinux is not an official platform within the ROS 2 ecosystem just yet, but we're looking into it. That doesn't mean you can't build ROS 2 from source today for PetaLinux. You can from the ROS 2 recipes, the same you can do so in any other Linux-based distro.

I'd encourage to wait for the talks and re-engage after that.That said, if you need immediate action. Here're two avenues for you to consider:

Avenue 1 (recommended): the ROS 2 Hardware Acceleration Working Group (HAWG) work

Xilinx has been leading the ROS 2 Hardware Acceleration Working Group since the beginning of the year. Our goal is to simplify the use of adaptive SoCs (targeting KV260 as the reference hardware platform) for ROS users to build their computational graphs. Here're a few additional links to get you up to speed (through maybe you're already aware):

Have a look at the source code we've contributed so far. You can get started with ROS 2 using the architecture proposed in there as follows:

###################################################
# 0. install Vitis 2020.2
###################################################

###################################################
# 1. install some dependencies you might be missing
###################################################
sudo apt-get -y install curl build-essential libssl-dev git wget \
                          ocl-icd-* opencl-headers python3-vcstool \
                          python3-colcon-common-extensions python3-colcon-mixin \
                          kpartx u-boot-tools

###################################################
# 2. create a new ROS 2 workspace
###################################################
mkdir -p ~/ros2_ws/src; cd ~/ros2_ws

###################################################
# 3. Create file with ROS 2 packages
###################################################
cat << 'EOF' > ros2.repos
repositories:
  acceleration/acceleration_firmware:
    type: git
    url: https://github.com/ros-acceleration/acceleration_firmware
    version: main
  acceleration/acceleration_firmware_kv260:
    type: zip
    url: https://github.com/ros-acceleration/acceleration_firmware_kv260/releases/download/v0.6.0/acceleration_firmware_kv260.zip
  acceleration/colcon-acceleration:
    type: git
    url: https://github.com/ros-acceleration/colcon-acceleration
    version: main
  acceleration/ros2acceleration:
    type: git
    url: https://github.com/ros-acceleration/ros2acceleration
    version: main
  acceleration/ament_vitis:
    type: git
    url: https://github.com/ros-acceleration/ament_vitis
    version: main
EOF

###################################################
# 4. import repos
###################################################
vcs import src --recursive < ros2.repos  # about 5 mins

###################################################
# 5. build the workspace and deploy firmware for hardware acceleration
###################################################
source /tools/Xilinx/Vitis/2020.2/settings64.sh  # source Xilinx tools
source /opt/ros/foxy/setup.bash  # Sources system ROS 2 installation
export PATH="/usr/bin":$PATH  # FIXME: adjust path for CMake 3.5+
colcon build --merge-install  # about 2 mins

###################################################
# 6. source the overlay to enable all features
###################################################
source install/setup.bash

###################################################
# 7. fetch source code of an example, build workspace, 
#    and build raw disk image for SD
###################################################
git clone https://github.com/ros-acceleration/acceleration_examples src/acceleration_examples
# select kv260 firmware
colcon acceleration select kv260 
# build a silly publisher
colcon build --build-base=build-kv260 --install-base=install-kv260 --merge-install --mixin kv260 --packages-select ament_vitis vadd_publisher
# build a raw disk image with a vanilla kernel, and deploy ROS 2
# workspace we just built as an overlay
colcon acceleration linux vanilla --install-dir install-kv260

###################################################
# 8. deploy raw disk image into SD, and launch
#    ROS 2 in KV260
###################################################
# Flash the resulting image located in 
# ~/ros2_ws/acceleration/firmware/select/sd_card.img
# then, once the board boots (user: petalinux)
source /usr/bin/ros_setup.bash  # source the ROS 2 installation
. /ros2_ws/local_setup.bash     # source the ROS 2 overlay workspace we just 
                                # created. Note it has been copied to the SD 
                                # card image while being created.
ros2 run vadd_publisher vadd_publisher

Avenue 2: building yocto recipes yourself

As for any other Yocto-based project, you can pick the ROS 2 yocto recipes from the meta-ros. The journey might be a bit bumpy, so I encourage you to check Avenue 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment