Raspberry Pi, ROS and Yocto Development Workflow

900 views
Skip to first unread message

Amos Buchanan

unread,
Sep 8, 2016, 2:17:16 PM9/8/16
to Mailing List of ROS Layer for OpenEmbedded Linux
Hello,

I'm relatively new to OpenEmbedded and Yocto, so I'm still wrapping my head around building recipes and using SDK's based on bitbake-created images.

I'm working with a combination of ROS and Yocto for the Raspberry Pi. I'm trying to put together a workflow for application development. I'm able to create ROS recipes that install and run on the RasPi directly using bitbake and writing an SD image, but it's a time-consuming process if I'm working on testing application code that is hardware dependent (ie -- requires sensor connections to run properly).

What I'd prefer is something more like what's described in this thread: https://github.com/bmwcarit/meta-ros/issues/380

These are the steps I followed
  • I created some .bbappend files in my own layer to add nativesdk support as per referenced thread for
    • python-catkin-pkg,
    • python-empy,
    • catkin,
    • catkin-runtime.
  • I created an SDK using the 'raspberrypi2' machine from 'meta-raspberrypi'
    • MACHINE="raspberrypi2" bitbake ngt-alpha3-sdk -c populate_sdk
  • I installed the SDK and ran the environment script.
  • I fixed the ROS environment variables to point to the SDK path versions of the software. (No ROS setup file is generated in the SDK, and I haven't looked into fixing that so this is manual
  • Create a catkin workspace and run 'catkin_init_workspace':
$ . ~/opt/phytec-yogurt/2.0.2/environment-setup-cortexa7hf-vfp-vfpv4-neon-phytec-linux-gnueabi 
$ mkdir src
$ cd src/
$ catkin_init_workspace
Traceback (most recent call last):
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/site.py", line 553, in <module>
    main()
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/site.py", line 535, in main
    known_paths = addusersitepackages(known_paths)
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/site.py", line 266, in addusersitepackages
    user_site = getusersitepackages()
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/site.py", line 241, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/site.py", line 230, in getuserbase
    from sysconfig import get_config_var
  File "/home/amos/opt/phytec-yogurt/2.0.2/sysroots/x86_64-yogurtsdk-linux/usr/lib/python2.7/sysconfig.py", line 10, in <module>
    'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
AttributeError: 'module' object has no attribute 'lib'


I feel like there's some python configuration somewhere I'm missing, or possibly a package. The same python script (sysconfig.py) on my base system (Ubuntu Trusty) doesn't refer to 'sys.lib'.


Has anyone had success in getting this to work? Is there a step somewhere I'm missing?


Thanks,


-Amos


Image Recipe:


inherit core-image extrausers catkin

USERNAME = "testuser"

EXTRA_USERS_PARAMS = "useradd -P '${USERNAME}' ${USERNAME};"

IMAGE_ROOTFS_SIZE ?= "8192"

IMAGE_INSTALL = " \
    packagegroup-machine-base \
    packagegroup-core-boot \
    packagegroup-hwtools \
    packagegroup-benchmark \
    packagegroup-userland \
"

IMAGE_INSTALL += "opkg rosbash roslaunch rosout rostopic ngt-control geometry-msgs"
IMAGE_INSTALL += "git gcc kernel-dev tcp-wrappers nfs-utils python-catkin-pkg python catkin"
IMAGE_INSTALL += "ngt-control-systemd-alpha3"
IMAGE_INSTALL_append_raspberrypi2 = " wiringpi"

IMAGE_FEATURES += "dev-pkgs tools-debug eclipse-debug tools-profile tools-testapps debug-tweaks"
IMAGE_FEATURES_beagleboneblack-1 += "tools-sdk"
IMAGE_FEATURES_phycore-am335x-1 += "tools-sdk"

TOOLCHAIN_HOST_TASK += " \
   nativesdk-cmake \
   nativesdk-catkin \
   nativesdk-catkin-dev \
   nativesdk-python-catkin-pkg \
   nativesdk-python-catkin-pkg-dev \
   nativesdk-catkin-runtime \
   nativesdk-catkin-runtime-dev \
"

export IMAGE_BASENAME = "ngt-alpha3-sdk"



Kristof Robot

unread,
Sep 9, 2016, 2:11:05 AM9/9/16
to Amos Buchanan, Mailing List of ROS Layer for OpenEmbedded Linux
Hi Amos,

Building on target is currently not supported - see
https://github.com/bmwcarit/meta-ros/issues/103.

A workflow I have used successfully in the past is described here:
https://github.com/KristofRobot/meta-frobo#feed-server

This allows you to bitbake any recipe on your build machine, and then
install the resulting package on your target running a simple opkg
command. Resulting workflow looks as follows:

(1) On your build machine: build package and rebuild index

bitbake [package]
bitbake package-index

(2) On your target: update repo and install package:
opkg update
opkg install [package]

or

opkg update
opkg upgrade

In my experience this works very well.

Note: if you go for this approach, it is recommended to use the PR
service to ensure that new packages automatically get new version
numbers; see https://wiki.yoctoproject.org/wiki/PR_Service - just add
'PRSERV_HOST = "localhost:0"' in your local.conf file.

Kristof

Lukas Bulwahn

unread,
Sep 9, 2016, 4:36:36 AM9/9/16
to Mailing List of ROS Layer for OpenEmbedded Linux, amos.b...@traxxautomation.com
Dear Amos,

besides the approach that Kristof proposed, there is some further by Dominique Hunziker on the SDK support. If you follow the issue #380, you will find the closed pull request #386 [1], which is a second iteration of the SDK support. Dominique has continued to create a third iteration already, which is in another fork of meta-ros [2]. Unfortunately, I did not have time yet to test this work and ultimately we have not made progress on merging this into the mainline repository. Any help testing, reporting issues or acknowledging that it works would be great to make progress on the topic.


I hope this helps a bit,

Lukas

Amos Buchanan

unread,
Sep 12, 2016, 12:30:50 PM9/12/16
to Mailing List of ROS Layer for OpenEmbedded Linux
Thanks for your responses. I setup the opkg server without a problem and will likely use that as a method for the short to medium term.

I took a look at the links from Lukas. I'd like to poke around more and see if I can test some of those things as well; it's certainly a nice to have.

Thanks,

-Amos
Reply all
Reply to author
Forward
0 new messages