Skip to content

Commit

Permalink
feat(meta-user): add AMD Kria ROS2 Perception example
Browse files Browse the repository at this point in the history
  • Loading branch information
nikAizuddin committed Aug 12, 2023
1 parent fce613f commit be2a5f3
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@
[submodule "project/yocto/layers/meta-qt5"]
path = project/yocto/layers/meta-qt5
url = https://github.com/meta-qt5/meta-qt5.git
[submodule "project/yocto/layers/meta-user/recipes-apps/kria-ros-perception/files/kria_ros_perception"]
path = project/yocto/layers/meta-user/recipes-apps/kria-ros-perception/files/kria_ros_perception
url = https://github.com/Xilinx/kria_ros_perception.git
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ A minimal ROS2 with Yocto workspace for learning purpose.

## Prerequisites

* [extra2000/yocto-toolkit v4.x image](https://github.com/extra2000/yocto-toolkit)
* [extra2000/yocto-toolkit v5.x image](https://github.com/extra2000/yocto-toolkit)
* [extra2000/ros2-gazebo11-classic v1.x image](https://github.com/extra2000/ros2-gazebo11-classic)
* Available disk space: at least 350GB
* SDCard with at least 4GB.
* Digilent Analog Discovery 2 for accessing serial console through UART pins.
Expand Down
47 changes: 47 additions & 0 deletions docs/yocto/common/testing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Testing


## Simple ROS2 Helloworld Testing

Source ROS2 environment:
```
source /etc/profile.d/ros/setup.bash
Expand All @@ -20,6 +23,50 @@ ros2 run ros2_helloworld_python helloworld
To exit the program, either `CTRL` + `C` or send `0x0A03` (Number) to serial console.


## ROS2 Perception Node

SSH into the target device and run simulation:
```
source /etc/profile.d/ros/setup.bash
DISPLAY=:0 GAZEBO_RESOURCE_PATH="/usr/share/gazebo-11:/usr/share/OGRE/Media/ShadowVolume" ros2 launch perception_2nodes simulation.launch.py headless:='True'
```

Open another terminal. Then, run Rectify and Resize example on the target device:
```
source /etc/profile.d/ros/setup.bash
DISPLAY=:0 GAZEBO_RESOURCE_PATH="/usr/share/gazebo-11:/usr/share/OGRE/Media/ShadowVolume" ros2 launch perception_2nodes trace_rectify_resize.launch.py
```

On host, allow X11 forwarding from local non-network connections:
```
xhost +local:
```

Then execute the following command:
```
podman run -it --rm \
-e DISPLAY=$DISPLAY \
--device=/dev/dri \
--network=host \
--userns="keep-id:uid=1000,gid=1000" \
--security-opt label=disable \
--name=ros2-workstation \
localhost/extra2000/ros2-gazebo11-classic:latest \
bash
source /opt/ros/humble/setup.bash
rqt
```

Open another terminal and execute the following command:
```
podman exec -it ros2-workstation bash
source /opt/ros/humble/setup.bash
GAZEBO_MASTER_URI=http://TARGET_MACHINE:11345 gzclient --verbose
```

*NOTE: Replace the `TARGET_MACHINE` according to your target device IP address or FQDN.*


## Known Issues

Python examples are broken at the moment due to Yocto Langdale uses `Python3 Setuptools v65.0.2`. See [entry_points install path is now 'bin' instead of 'lib' for setup.py installs](https://github.com/colcon/colcon-core/issues/518) issue. The examples only work with Yocto Honister which uses `Python3 Setuptools v57.4.0`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
inherit ros_distro_humble
inherit ros_superflore_generated

SUMMARY = "ROS2 Perception Nodes"
DESCRIPTION = "${SUMMARY}"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://../../LICENSE;md5=aaa7729bf8823a5d00dc80db2da0f9db"

S = "${WORKDIR}/kria_ros_perception/src/perception_2nodes"

SRC_URI = "\
file://kria_ros_perception/ \
"

ROS_BUILD_TYPE = "ament_python"

ROS_BUILDTOOL_DEPENDS = ""

ROS_BUILD_DEPENDS = " \
image-proc \
python3-numpy \
python3-numpy-native \
"

ROS_EXEC_DEPENDS = "\
rclpy \
std-msgs \
python3-numpy \
gazebo-ros-pkgs \
image-pipeline \
ros2trace \
tracetools \
tracetools-launch \
tracetools-trace \
lttng-modules \
lttng-tools \
lttng-ust \
"

ROS_EXPORT_DEPENDS = ""

# Currently informational only -- see http://www.ros.org/reps/rep-0149.html#dependency-tags.
ROS_TEST_DEPENDS = " \
ament-copyright \
ament-flake8 \
ament-pep257 \
python3-pytest \
python3-numpy \
"

ROS_BUILDTOOL_EXPORT_DEPENDS = ""

DEPENDS = "${ROS_BUILD_DEPENDS} ${ROS_BUILDTOOL_DEPENDS}"
DEPENDS += "${ROS_EXPORT_DEPENDS} ${ROS_BUILDTOOL_EXPORT_DEPENDS}"
RDEPENDS:${PN} += "${ROS_EXEC_DEPENDS}"

inherit ros_${ROS_BUILD_TYPE}

FILES:${PN}:append = " \
/usr/share/perception_2nodes \
/usr/share/perception_2nodes/package.xml \
/usr/share/perception_2nodes/launch \
/usr/share/perception_2nodes/models \
/usr/share/perception_2nodes/worlds \
/usr/share/perception_2nodes/launch/simulation.launch.py \
/usr/share/perception_2nodes/launch/trace_rectify_resize.launch.py \
/usr/share/perception_2nodes/launch/trace_rectify_resize_fpga_streamlined.launch.py \
/usr/share/perception_2nodes/models/camera-plugin \
/usr/share/perception_2nodes/models/camera-plugin/model.config \
/usr/share/perception_2nodes/models/camera-plugin/model_distorted.sdf \
/usr/share/perception_2nodes/models/camera-plugin/model_undistorted.sdf \
/usr/share/perception_2nodes/worlds/camera.world \
/usr/share/perception_2nodes/worlds/camera_dynamic.world \
/usr/share/perception_2nodes/worlds/camera_dynamic_hd.world \
/usr/share/perception_2nodes/worlds/camera_dynamic_undistorted.world \
/usr/share/perception_2nodes/worlds/camera_simple.world \
"
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ ROS_SYSROOT_BUILD_DEPENDENCIES = " \
USER_APPS = " \
ros2-helloworld-cpp \
ros2-helloworld-python \
perception-2nodes \
"

NETWORKING = " \
Expand Down

0 comments on commit be2a5f3

Please sign in to comment.