In a previous post, I covered the current installation processes for both the alpha and beta releases of Kria Robotics Stack (KRS). Given there was a certain level of detail to the installation, I decided that the actual use of KRS should be separated out here into this project post.
I'll be going through this project using my beta installation of KRS using PetaLinux 2021.2.
Prep the EnvironmentOn the host PC (ROS workstation) change directories into the KRS workspace, source the Vitis and ROS toolsets, then add to path.
~$ cd ./krs_ws/
~/krs_ws$ source /tools/Xilinx/Vitis/2021.2/settings64.sh
~/krs_ws$ source /opt/ros/rolling/setup.bash
~/krs_ws$ export PATH="/usr/bin":$PATH
Build the KRS WorkspaceBuild the KRS workspace, which takes a couple of minutes.
~/krs_ws$ colcon build --merge-install
Once the KRS workspace has been built, source it as an overlay so its functions and packages are available for use.
~/krs_ws$ source ./install/setup.bash
Run on the Host PC (Workstation)To test out the new KRS workspace, run one of the example projects. In this case, I'm running the message publisher ROS node:
~/krs_ws$ ros2 run publisher_xilinx member_function_publisher
Use Ctrl+C to halt the execution of the node.
KRS workspaces can also be installed and ran on embedded targets such as the Kria. To create an embedded Linux image with ROS 2 and KRS built into it for the Kria, first select the Kria KV260 firmware in the KRS workspace on the workstation (host PC) then use the list command to verify that it is indeed selected:
~/krs_ws$ colcon acceleration select kv260
~/krs_ws$ colcon acceleration list
It should be the only thing in the list at this point.
Now build the publisher node package for the Kria KV260:
~/krs_ws$ colcon build --build-base=build-kv260 --install-base=install-kv260 --merge-install --mixin kv260 --packages-select publisher_xilinx
After the build is complete, the KV260 build and install directories appear in the KRS workspace:
Then generate a raw disk image for an SD card with a root filesystem from PetaLinux, a vanilla Linux 5.4.0 kernel, and the ROS 2 overlay workspace just created for the KV260:
~/krs_ws$ colcon acceleration linux vanilla --install-dir install-kv260
This results in an image file ready for use on an SD card here: ./krs_ws/acceleration/firmware/select/sd_card.img
Flash an SD card with the image using a tool such as balenaEtcher:
Boot the Kria KV260 with the SD card and log in with the username petalinux, set your own password as prompted.
A blank Jupyter notebook is available for any desired development and can be accessed in a browser with the URL specified in the Linux boot process.
This should be handy for things like HLS IP development for KRS with a similar workflow that I demonstrated in a previous post on the Kria KV260 and Pynq-Z1.
Source the ROS 2 tools and overlay then run the example message publisher package in the same manner as was done on the host PC (workstation).
xilinx-k26-som-2021_2:~$ cd /krs_ws
xilinx-k26-som-2021_2:/krs_ws$ source /usr/bin/ros_setup.bash
xilinx-k26-som-2021_2:/krs_ws$ source ./local_setup.bash
xilinx-k26-som-2021_2:/krs_ws$ ros2 run publisher_xilinx member_function_publisher
This workflow is for PetaLinux 2021.2, I noticed it differed very slightly from PetaLinux 2020.2.2 on the Kria KV260 so I thought it was worth a quick post.
Comments