Rockchip ROS Introduction
:::info 文档信息
文档标识:RK-SM-YF-377 · 发布版本:V1.0.2 · 发布日期:2020-08-06 · 页数:6 · 语言:英文
原始文档:Rockchip_Instruction_Linux_ROS_EN.pdf
:::
章节大纲
- Rockchip ROS Introduction(P1)
- Overview(P4)
- Build(P4)
- Add the New ROS Code(P4)
- Flashing(P5)
- Run(P6)
在线预览
若预览无法显示,请直接下载 PDF 后用本地阅读器打开。
1. Overview
Rockchip Linux SDK integrated ROS which provides a range of libraries and tools to help software developers create robotic applications.
ROS version which Rockchip integrated are Indigo and kinetic.
2. Build
There are two default configurations of ros_indigo.config and ros_kinetic.config under buildroot/configs/rockchip directory. Before building rootfs, add ros_xxx.config to the config corresponding to rootfs.
Take RK3308 Linux SDK as an example. Others are similar, modify buildroot/configs/rockchip_rk3308_release_defconfig:
diff --git a/configs/rockchip_rk3308_release_defconfig
b/configs/rockchip_rk3308_release_defconfig
index f905f16..a2afac1 100644
--- a/configs/rockchip_rk3308_release_defconfig
+++ b/configs/rockchip_rk3308_release_defconfig
@@ -135,3 +135,4 @@ BR2_TARGET_ROOTFS_SQUASHFS=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_MKE2IMG=y
BR2_PACKAGE_HOST_VBOOT_UTILS=y
+#include "ros_indigo.config"
And then run ./build.sh .
Or first select the rockchip_rk3308_release corresponding to source envsetup.sh, then run make .
The compilation for the first time will take a few hours. After the compilation is complete, buildroot/output/rockchip_rk3308_release/images/rootfs.squashfs which is the rootfs firmware will be generated.
3. Add the New ROS Code
There is a ros_sample provided: https://github.com/DZain/ROS_Sample.git
Put the project to external, and rename to beginner_tutorials.
Then add the following files and modifications in buildroot:
1. vi buildroot/package/rockchip/ros/beginner_tutorials/Config.in , add the following
contents:
config BR2_PACKAGE_BEGINNER_TUTORIALS
bool "beginner tutorials"
select BR2_PACKAGE_ROSCPP
select BR2_PACKAGE_ROSPY
select BR2_PACKAGE_STD_MSGS
select BR2_PACKAGE_GENMSG
help
beginner tutorials
The select option in the Config depends on the dependencies in the project.
2. vi buildroot/package/rockchip/ros/beginner_tutorials/beginner_tutorials.mk
BEGINNER_TUTORIALS_VERSION = 1.0.0
BEGINNER_TUTORIALS_SITE_METHOD = local
BEGINNER_TUTORIALS_SITE = $(TOPDIR)/../external/beginner_tutorials
BEGINNER_TUTORIALS_DEPENDENCIES = roscpp rospy std-msgs genmsg
${eval ${catkin-package}}
- Add beginner_tutorials to buildroot:
@@ -46,6 +46,7 @@ source diff --git a/package/rockchip/ros/Config.in
b/package/rockchip/ros/Config.in
index e26003aa9f..cb6f6c18e6 100644
--- a/package/rockchip/ros/Config.in
+++ b/package/rockchip/ros/Config.in
@@ -46,6 +46,7 @@ source "package/rockchip/ros/cmake_modules/Config.in"
source "package/rockchip/ros/rospack/Config.in"
source "package/rockchip/ros/orocos_kinematics_dynamics/Config.in"
source "package/rockchip/ros/image-common/Config.in"
+source "package/rockchip/ros/beginner_tutorials/Config.in"
source "package/rockchip/ros/bond-core/Config.in"
source "package/rockchip/ros/nodelet-core/Config.in"
- Build
Run the source envsetup.sh in the SDK root directory, select rockchip_rk3308_release (If you have already ran it, don't have to run again).
Configure make menuconfig , use '/' opening search menu, search BEGINNER_TUTORIALS (in step 1, defined in Config.in), and select.
Save the configuration.
Build with make.
(Or use make beginner_tutorials directly. Rebuild using make beginner_tutorials-dirclean &&
make beginner_tutorials )
4. Flashing
Please refer to the release documentations of Rockchip Linux SDK for instructions on how to flash firmware. It won't go into details here. Just download the Rootfs.img generated by ROS building to the corresponding rootfs partition.
5. Run
The steps to run ROS are as follows:
- Configure environment variables
source /opt/ros/indigo/setup.sh
- Run roscore
roscore &
- Run the code
Take the beginner_tutorials as an example:
rosrun beginner_tutorials talker
Running result:
[ INFO] [1501923947.458788791]: hello world 0
[ INFO] [1501923947.558904332]: hello world 1
[ INFO] [1501923947.658774958]: hello world 2
[ INFO] [1501923947.758644458]: hello world 3
[ INFO] [1501923947.858779666]: hello world 4
[ INFO] [1501923947.958779291]: hello world 5
(The beginner_tutorials code is a pair of programs, "talker" is used to send and "listener" is used to listen, open talker alone, number will accumulate continuously, and there is no phenomenon when opening listener alone, but when talker is opened at the same time, two programs number print simultaneously)