apollo代码及资料,可见https://github.com/apolloauto
我们的算法在ros原生架构上出现cpu占用过高,topic通信延时过大的问题,后来查看到百度的apollo平台优化了ros整体架构,优点见资料,就进行了apollo ros platform的移植。
将release 2.0的压缩包解压,并source里面的setup.bash。由于setup.bash中只将环境变量添加了apollo的路径,而没有添加ros的原生路径,因此需要手动将ros原生的路径添加到环境变量中。在移植过程中出现的主要问题是环境变量的改变。遇到的问题如下:
1.ImportError: No module named google.protobuf.message
解决:
sudo apt-cache search protobuf
sudo apt-get install python-protobuf
2.OSError: /home/ubuntu/apollo/third_party/ros_x86_64/share/ros:/opt/ros/indigo/share/ros/../../lib/libshm_manager.so: cannot open shared object file: No such file or directory
解决:ROS_ROOT里面的路径添加多了
原来:export ROS_ROOT="/home/ubuntu/apollo/third_party/ros_x86_64/share/ros:/opt/ros/indigo/share/ros"
修改后:export ROS_ROOT="/home/ubuntu/apollo/third_party/ros_x86_64/share/ros"
3.ImportError: No module named cli.find_pkg
解决:PYTHONPATH路径配置成ros原生的,因为apollo路径中没有这个pkg
原来:
export
PYTHONPATH="/home/ubuntu/bak/devel/lib/python2.7/dist-packages:/home/ubuntu/apollo/third_party/ros_x86_64/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages"
修改后:export PYTHONPATH="/opt/ros/indigo/lib/python2.7/dist-packages"
apollo version-2.5,docker里面也出现这个问题
解决方案:将catkin_make 改成catkin_make_isolated,即可。
4.
-- +++ processing catkin package: 'kobuki_auto_docking'
-- ==> add_subdirectory(kobuki/kobuki_auto_docking)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /home/ubuntu/apollo/third_party/ros_x86_64/share/kdl_conversions/cmake/kdl_conversionsConfig.cmake:106 (message):
Project 'kdl_conversions' specifies '/home/tmp/ros/include' as an include
dir, which is not found. It does neither exist as an absolute directory
nor in '/home/tmp/ros//home/tmp/ros/include'. Ask the maintainer 'Tully
Foote
Call Stack (most recent call first):
/home/ubuntu/apollo/third_party/ros_x86_64/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
kobuki/kobuki_auto_docking/CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
解决:找不到路径 '/home/tmp/ros/include',因为在release中是编译好库和可执行文件,如果需要在这些环境上再编译其它节点,需要把编译环境配置成编译release的环境。
将apollo的release解压后的路径软连接到/home/tmp/ros/include
sudo ln -s /home/ubuntu/apollo/third_party/ros_x86_64 ros
5.
-- +++ processing catkin package: 'pointcloud_to_laserscan'
-- ==> add_subdirectory(pointcloud_to_laserscan)
-- Using these message generators: gencpp;genlisp;genpy
CMake Error at /home/ubuntu/apollo/third_party/ros_x86_64/share/pcl_ros/cmake/pcl_rosConfig.cmake:106 (message):
Project 'pcl_ros' specifies '/usr/local/include/pcl-1.7' as an include dir,
which is not found. It does neither exist as an absolute directory nor in
'/home/tmp/ros//usr/local/include/pcl-1.7'. Ask the maintainer 'Paul
Bovbel
Call Stack (most recent call first):
/home/ubuntu/apollo/third_party/ros_x86_64/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
pointcloud_to_laserscan/CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/code/build/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/code/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
因为软件的安装后头文件,库文件,可执行文件在/usr目录下,而不再/usr/local下面,将这些目录都链接过去
ubuntu@ubuntu-desktop-one:/usr/local$ ls -l
total 24
drwxr-xr-x 2 root root 4096 5月 1 2015 bin
drwxr-xr-x 2 root root 4096 2月 19 2015 etc
drwxr-xr-x 2 root root 4096 2月 19 2015 games
lrwxrwxrwx 1 root root 12 2月 28 11:51 include -> /usr/include
lrwxrwxrwx 1 root root 8 2月 28 11:51 lib -> /usr/lib
lrwxrwxrwx 1 root root 9 4月 1 2016 man -> share/man
drwxr-xr-x 2 root root 4096 2月 19 2015 sbin
drwxr-xr-x 7 root root 4096 2月 19 2015 share
drwxr-xr-x 2 root root 4096 2月 19 2015 src
ubuntu@ubuntu-desktop-one:/usr/local$
6.rostopic 看不到数据
需要重新source code/devel/setup.bash 使用apollo的库才能看到数据
将新增节点在apollo环境下编译完成,在source setup.bash。节点就可以在apollo下正常运行了。
进行了很多对比测试:cpu占用率,topic延迟,网络流量
结论:
1.测试节点的topic延迟,网络流量在apollo下表现要远远好于ros原生架构下。
2.导航系统节点在apollo上运行的topic延迟都和ros原生的一样,网络流量反而升高了好多。整体效果不升反降,需要进一步分析,待续~~
3.cpu占用率方面都没有提高,和原来一致或略差。