在我上一篇文章中,完成了添加ros_kinetic配置的buildroot编译。把固件刷到板子上去后,出现几个问题:
- QLauncher无法正常运行;
- source /opt/ros/kinetic/setup.bash失败
第一个问题:
/ # QLauncher
This application failed to start because it could not find or load the Qt platform plugin "eglfs"
in "".
Available platform plugins are: linuxfb, minimal, offscreen, wayland-egl, wayland.
Reinstalling the application may fix this problem.
Aborted
提示"eglfs"不存在,我在源码里查找,也没找到这个platform,其他的wayland倒是找着了,但是wayland运行时,提示:
/ # QLauncher -platform wayland
error: XDG_RUNTIME_DIR not set in the environment.
Failed to create display (No such file or directory)
这个暂时放在一边,先处理第二个问题。
source的时候提示:
/ # source /opt/ros/kinetic/setup.bash
/bin/sh: /opt/ros/kinetic/setup.bash: syntax error: bad substitution
/bin/sh: /opt/ros/kinetic/setup.bash: builtin: not found
/bin/sh: .: line 12: can't open '/setup.sh'
这些错误,应该是sh版本问题,看了一下,buildroot中sh使用的是busybox命令集,不支持${变量名}这样的使用方式,只支持“$变量名”的方式调用。而且也取不到BASH_SOURCE变量。busybox不支持builtin命令,尝试了一下,可以使用eval命令代替builtin命令,然后把_CATKIN_SETUP_DIR写死,最后成这样:
#!/usr/bin/env bash
# generated from catkin/cmake/templates/setup.bash.in
CATKIN_SHELL=bash
# source setup.sh from same directory as this file
#echo "test :" $_BASH_SOURCE[0]
_CATKIN_SETUP_DIR=/opt/ros/kinetic
eval cd $_CATKIN_SETUP_DIR > /dev/null && pwd
. "$_CATKIN_SETUP_DIR/setup.sh"
这样后,在根目录下source /opt/ros/kinetic/setup.bash正常,然后 roscore正常,另外开启终端,运行rostopic list,能看到系统的/rosout话题;使用top命令,也看到roscore进程在运行。
在此,解决ros问题,后续再写程序测试……