ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Meta-ros Kinetic runtime issue with roscore

kinetic

#1

Hey everyone,

I’m adding ros-meta to a Yocto/OpenEmbedded build of a Linux distribution for a custom Xilinx Zynq based camera board and it looks like I’m running into some runtime dependency issues when running roscore.

I’m using the experimental kinetic distribution of ros-meta at:

https://github.com/bulwahn/meta-ros/tree/kinetic-experimental

My bblayers.conf file looks as follows:

BBLAYERS ?= " \
  ${TOPDIR}/../poky/meta \
  ${TOPDIR}/../poky/meta-poky \
  ${TOPDIR}/../poky/meta-yocto-bsp \
  ${TOPDIR}/../meta-openembedded/meta-oe \
  ${TOPDIR}/../meta-openembedded/meta-python \
  ${TOPDIR}/../meta-openembedded/meta-multimedia \
  ${TOPDIR}/../meta-xilinx \
  ${TOPDIR}/../meta-ros \
  ${TOPDIR}/../meta-shadowbox \
  "

Added the following line to by core-image.bb file:

IMAGE_INSTALL += "roslaunch"

Used the following command to create my own image.

bitbake core-image

Build completed without any errors. Created an SD card including the kernel
and file system that includes ROS.

On the booted Xilinx Zynq based system running the Linux environment I just built, I’m configuring ROS Kinetic with the
following:

export ROS_ROOT=/opt/ros/kinetic
export ROS_DISTRO=kinetic
export ROS_PACKAGE_PATH=/opt/ros/kinetic/share
export PATH=$PATH:/opt/ros/kinetic/bin
export LD_LIBRARY_PATH=/opt/ros/kinetic/lib
export PYTHONPATH=/opt/ros/kinetic/lib/python2.7/site-packages
export ROS_MASTER_URI=http://localhost:11311
export CMAKE_PREFIX_PATH=/opt/ros/kinetic
touch /opt/ros/kinetic/.catkin

I have the following problems running roscore.

root@microzed-camera:~# roscore
Traceback (most recent call last):
  File "/opt/ros/kinetic/bin/roscore", line 36, in <module>
    from rosmaster.master_api import NUM_WORKERS
  File "/opt/ros/kinetic/lib/python2.7/site-packages/rosmaster/__init__.py", line 35, in <module>
    from .main import rosmaster_main
  File "/opt/ros/kinetic/lib/python2.7/site-packages/rosmaster/main.py", line 43, in <module>
    import rosmaster.master
  File "/opt/ros/kinetic/lib/python2.7/site-packages/rosmaster/master.py", line 47, in <module>
    import rosmaster.master_api
  File "/opt/ros/kinetic/lib/python2.7/site-packages/rosmaster/master_api.py", line 72, in <module>
    from rosmaster.util import xmlrpcapi
  File "/opt/ros/kinetic/lib/python2.7/site-packages/rosmaster/util.py", line 48, in <module>
    from defusedxml.xmlrpc import monkey_patch
ImportError: No module named defusedxml.xmlrpc
root@microzed-camera:~#

From what I can find on ROS Answers, it looks like defusedxml was as a fairly recent dependency added to ROS Kinetic. I assume this dependency probably didn’t make it into the meta-ros dependencies. Any suggestions on how I go about adding it to the Yocto/OpenEmbedded build of the system?

Thanks,

Mike


#2

Hey Mike,

Nice to hear that the “custom Xilinx Zynq based board” is still going :wink:

Defusedxml is a python package that was added to facilitate adding security to ROS, as it provides protection against a bunch of different XML attacks. This is part of the SROS effort to add some security and hardening to ROS.

Anyway to get roscore to run, have you tried adding python-defusedxml as a dependency here: https://github.com/bulwahn/meta-ros/blob/kinetic-experimental/recipes-ros/ros-comm/roslaunch_1.12.2.bb#L18

I have only done some looking around at OpenEmbeded stuff, and never got around to actually using it so I am not sure if this is the ‘right’ way to fix this, or if it would even work.

Out of curiosity what is the size of the image that comes out the build process? I would think it would quite small relative to a Ubuntu image.

Rohan


#3

Hey Rohan,

I resolved this issue by adding the following recipe for defusedxml to:

meta-ros/recipes-devtools/python/python-defusedxml_0.4.1.bb

The contents of the recipe is:

DESCRIPTION = "XML bomb protection for Python stdlib modules"
SECTION = "devel/python"
LICENSE = "PSFL"
LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=8;endline=8;md5=a560e172e996ab553d352ccff41c7d20"
SRCNAME = "defusedxml"

SRC_URI = "http://pypi.python.org/packages/source/d/defusedxml/defusedxml-${PV}.tar.gz"
SRC_URI[md5sum] = "230a5eff64f878b392478e30376d673a"
SRC_URI[sha256sum] = "cd551d5a518b745407635bb85116eb813818ecaf182e773c35b36239fc3f2478"

S = "${WORKDIR}/${SRCNAME}-${PV}"

inherit setuptools

Then adding a dependency to roslaunch_1.12.2.bb for this python module.

The following commit is a complete fix.

https://github.com/shadowboxtech/meta-ros/commit/280a89272c24e2a66b2a480f9d2552c81da1e4c9

The resulting image file for the entire Linux OS including roscore is about 47MB in size which is considerably smaller than an Ubuntu image. However, this is for the absolute minimum user tools and ROS install.

Mike


#4

Hi Mike,

I am interested in doing something similar using a Microzed, but honestly don’t know where to even start, can you point me to some good resources, so I might be able to do the same?

Thanks!


#5

Hi Qnetjoe,

I would propose that you start as follows:

  1. Get an understanding of yocto and bitbake following the Yocto Quick Start:
    http://www.yoctoproject.org/docs/2.2.1/yocto-project-qs/yocto-project-qs.html
    After stepping through that document, you should be able to build and start a small Linux image in the qemu emulator.

  2. Build and run an image with ROS for the qemu emulator following the instructions at:
    http://wiki.ros.org/hydro/Installation/OpenEmbedded

  3. Build and run a minimal image for the Microzed board, using the microzed configuration provided
    in the meta-xilinx layer at:
    http://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/tree/conf/machine/microzed-zynq7.conf?h=master
    http://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/tree/
    By the way, I found this by searching on https://layers.openembedded.org/,
    and it quickly linked me to:
    https://layers.openembedded.org/layerindex/branch/master/machines/?q=Microzed

  4. Combine what you learned in Step 2 and Step 3, and build an image
    with ROS for the Microzed board. When combining, you will probably need
    to choose the build configuration that is a compromise between the build
    configurations you used in step 2 and in step 3. This will then probably need
    certain adjustments in meta-ros.

Here some further advice:

  • Get a build machine with a lot of CPU power, RAM and a SSD disk to
    build images much quicker. You will not get away with some laptop
    and some Linux virtual machine. when bitbaking the images.

  • Report issues you encounter on the meta-ros github issue tracker. Please
    always provide at least the build configuration you use, and possibly even
    the bblayers.conf file, so that others can reproduce the reported issue.

I hope this helps.

Lukas