meta-ros icon indicating copy to clipboard operation
meta-ros copied to clipboard

ROS2 support in standard SDK

Open jiaxshi opened this issue 1 year ago • 1 comments

ROS2 support in standard SDK. Refer to #988

Generate SDK

bitbake xxx-image -c populate_sdk
For example:
bitbake ros-image-core -c populate_sdk

Build ROS package

Set up SDK env before below steps.

ROS env set up

export AMENT_PREFIX_PATH="${OECORE_NATIVE_SYSROOT}/usr:${OECORE_TARGET_SYSROOT}/usr"

export PYTHONPATH=${OECORE_NATIVE_SYSROOT}/usr/lib/python3.10/site-packages/:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages/

colcon build --cmake-args -DCMAKE_TOOLCHAIN_FILE=${OE_CMAKE_TOOLCHAIN_FILE} \
-DBUILD_TESTING=OFF \
-DCMAKE_MAKE_PROGRAM=/usr/bin/make \
-DPYTHON_SOABI=cpython-310-aarch64-linux-gnu

Build examples

git clone https://github.com/ros2/examples.git -b humble
cd examples
git clone https://github.com/ros2/example_interfaces.git -b humble

colcon build --cmake-args -DCMAKE_TOOLCHAIN_FILE=${OE_CMAKE_TOOLCHAIN_FILE} \
-DBUILD_TESTING=OFF \
-DCMAKE_MAKE_PROGRAM=/usr/bin/make \
-DPYTHON_SOABI=cpython-310-aarch64-linux-gnu
---
Finished <<< examples_rclcpp_wait_set [32.5s]

Summary: 23 packages finished [1min 12s]

Issues

A discussion is created for discussing ROS support in SDK #1204

Build warning: stderr: python setup.py install is deprecated

--- stderr: examples_rclpy_minimal_client
/local/mnt3/workspace/jiaxshi/projects/sdk/ws4/sysroots/x86_64-qcomsdk-linux/usr/lib/python3.10/site-packages/setuptools/command/instal
l.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

host path is included

setup script

vi install/setup.sh
 _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX=/local/mnt3/workspace/jiaxshi/projects/sdk/ws4/examples/install

###python shebang

vi install/examples_rclpy_executors/lib/examples_rclpy_executors/talker
 1 #!/local/mnt3/workspace/jiaxshi/projects/sdk/ws4/sysroots/x86_64-qcomsdk-linux/usr/bin/python3
  2 # EASY-INSTALL-ENTRY-SCRIPT: 'examples-rclpy-executors==0.15.1','console_scripts','talker'

jiaxshi avatar Aug 26 '24 08:08 jiaxshi

@jiaxshi What KAS configuration did you use so I match up with this PR?

sgstreet avatar Aug 27 '24 22:08 sgstreet

@jiaxshi What KAS configuration did you use so I match up with this PR?

I didn't use kas for this PR. The PR can be applied on latest kirkstone-next

jiaxshi avatar Sep 25 '24 03:09 jiaxshi

@jiaxshi Could you post the local.conf and bblayers.conf file you used?

sgstreet avatar Oct 15 '24 20:10 sgstreet

Hi Stephan, Just for reference: local.conf

# CONF_VERSION is increased each time build/conf/ changes incompatibly
CONF_VERSION = "2"

# Which files do we want to parse:
BBMASK = ""

# What kind of images do we want?
IMAGE_FSTYPES:append = " tar.xz"

# Don't generate the mirror tarball for SCM repos, the snapshot is enough
BB_GENERATE_MIRROR_TARBALLS = "0"

# Change to 1 to enable verbose logging during git fetch
BB_GIT_VERBOSE_FETCH = "0"

# Disable build time patch resolution. This would lauch a devshell
# and wait for manual intervention. We disable it.
PATCHRESOLVE = "noop"

#
# Parallelism Options
# These options control how much parallelism BitBake should use.
#

# Capture the count of cpu cores available from the host.
CPU_COUNT = "${@oe.utils.cpu_count(at_least=2)}"

# Number of parallel threads make can run based on cpu cores with a max cap at 20.
THREAD_COUNT = "${@oe.utils.cpu_count(at_least=2, at_most=20)}"

# Determines how many tasks bitbake should run in parallel.
BB_NUMBER_THREADS ?= "${CPU_COUNT}"

# Determines how many tasks bitbake should run in parallel during parsing.
BB_NUMBER_PARSE_THREADS ?= "${CPU_COUNT}"

# Specifies a maximum CPU pressure threshold for bitbake scheduler to start new tasks.
BB_PRESSURE_MAX_CPU = "900000"

# Specifies a maximum IO pressure threshold for bitbake scheduler to start new tasks.
BB_PRESSURE_MAX_IO = "900000"

# Specifies a maximum Memory pressure threshold for bitbake scheduler to start new tasks.
BB_PRESSURE_MAX_MEMORY = "900000"

# Determines how many processes make should run in parallel when running compile tasks.
PARALLEL_MAKE ?= "-j ${THREAD_COUNT} -l ${THREAD_COUNT}"

bblayer.conf

LCONF_VERSION = "7"
WORKSPACE := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)))}/../.."

BBPATH = "${TOPDIR}"

BBFILES = " \
"

# These layers hold recipe metadata not found in OE-core, but lack any machine or distro content
BASELAYERS ?= " \
  ${WORKSPACE}/layers/meta-openembedded/meta-filesystems \
  ${WORKSPACE}/layers/meta-openembedded/meta-gnome \
  ${WORKSPACE}/layers/meta-openembedded/meta-multimedia \
  ${WORKSPACE}/layers/meta-openembedded/meta-networking \
  ${WORKSPACE}/layers/meta-openembedded/meta-oe \
  ${WORKSPACE}/layers/meta-openembedded/meta-perl \
  ${WORKSPACE}/layers/meta-openembedded/meta-python \
  ${WORKSPACE}/layers/poky/meta \
  ${WORKSPACE}/layers/poky/meta-poky \
  ${WORKSPACE}/layers/meta-security \
  ${WORKSPACE}/layers/meta-selinux \
  ${WORKSPACE}/layers/meta-virtualization \
  ${WORKSPACE}/layers/meta-rust \
"

# These layers hold machine specific content, aka Board Support Packages
BSPLAYERS ?= " \
  ${WORKSPACE}/layers/meta-qcom-hwe \
  ${WORKSPACE}/layers/meta-qcom \
"

# Add your overlay layers location to EXTRALAYERS
# Make sure to have a conf/layers.conf in there
EXTRALAYERS ?= " \
"

BBLAYERS = " \
  ${WORKSPACE}/layers/meta-qcom-distro \
  ${EXTRALAYERS} \
  ${BASELAYERS} \
  ${BSPLAYERS} \
  /local/mnt/workspace/jiaxshi/projects/qcrobotics/layers/meta-ros/meta-ros-common \
  /local/mnt/workspace/jiaxshi/projects/qcrobotics/layers/meta-ros/meta-ros2 \
  /local/mnt/workspace/jiaxshi/projects/qcrobotics/layers/meta-ros/meta-ros2-humble \
  "

jiaxshi avatar Oct 16 '24 06:10 jiaxshi

Merged into master-next

robwoolley avatar Nov 19 '24 19:11 robwoolley