赞
踩
非常高兴接到官方邀请,能够为orange pi kunpeng pro做一次简单的开箱测评, 这是一款极具性价比的开发板,下面是一些参数信息
功能 | 详细信息 |
---|---|
尺寸 | 107x68 毫米 |
内存 | 8/16GB LPDDR4X |
闪存 | 32MB SPI Flash |
SSD 支持 | M.2 2280 NVMe/SATA |
外接存储 | 32/64/128/256GB eMMC |
MicroSD 卡槽 | 是 |
接口 | 2个HDMI (4K60), 40针GPIO (UART/I2C/SPI/I2S/PWM), 2个USB 3.0, USB-C 3.0, microUSB (调试), 2个MIPI摄像头接口, MIPI屏幕接口, 3.5毫米耳机接口, Type-C 20V/65W电源接口, 电池接口 |
网络 | 千兆以太网, 双频 Wi-Fi 5, 蓝牙4.2 |
开箱俯视图:
对应接口功能图:
引脚图:
香橙派官方资料Orange Pi Kunpeng pro Orange Pi官网-香橙派(Orange Pi)开发板
因为截止24.5.28官方只提供了两个系统的镜像,一个是ubuntu22.04,还有一个是openEuler, 原卡自带openEuler, 那么这里我选择重新烧录ubuntu22.04的系统
step 1. 设置语言
终端输入指令:
sudo apt update
sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
step 2. 设置镜像源
用小鱼ros一键布置镜像源, 小鱼的一键布置ROS不太好用,这里选择手动布置ROS2
wget http://fishros.com/install -O fishros && . fishros
step 3. 从github下载相关文件
终端指令:
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpgecho "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
step 4. 将上述配置更新至系统
sudo apt-get update
sudo apt-get upgrade
step 1. 下载ROS系统
sudo apt install ros-humble-desktop
注1:humble表示版本名称,不同的Ubuntu系统需要下载对应的不同的版本名称,ubuntu22.04对应版本humble,其余版本可以登陆ROS官网自行查看;
注2:desktop表示桌面版本,即完整版本,自动安装我们常用的功能。
出现问题:
libicu-dev : Depends: libicu70 (= 70.1-2) but 70.1-2ubuntu1 is to be installed E: Unable to correct problems, you have held broken packages.
解决:sudo apt install libicu70=70.1-2
step 2. 调整配置
source /opt/ros/humble/setup.bash echo " source /opt/ros/humble/setup.bash" >> ~/.bashrc
通信测试
打开一个终端,指令:ros2 run demo_nodes_cpp talker
另开一个终端,指令:ros2 run demo_nodes_py listener
如果listenner可以正常显示talker发出的信号,即表示正常。
小海龟仿真测试
一个终端,指令:ros2 run turtlesim turtlesim_node启动海龟仿真器
另一个终端,指令:ros2 run turtlesim turtle_teleop_key启动键盘控制节点
如果可以通过键盘正常操控小海龟移动,即表示正常。
终端输入rviz2看是否成功
Cartographer是Google开源的一个可跨多个平台和传感器配置以2D和3D形式提供实时同时定位和建图(SLAM)的系统。
github地址:https://github.com/cartographer-project/cartographer
文档地址:https://google-cartographer.readthedocs.io/en/latest
- sudo apt install ros-humble-cartographer
- sudo apt install ros-humble-cartographer-ros
将下面的源码克隆到fishbot_ws的src目录下
git clone https://ghproxy.com/https://github.com/ros2/cartographer.git -b ros2
git clone https://ghproxy.com/https://github.com/ros2/cartographer_ros.git -b ros2
这里我们使用rosdepc进行依赖的安装,rosdepc指令找不到可以先运行下面的一键安装命令,选择一键配置rosdep即可。
rosdepc install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
colcon build --packages-up-to cartographer_ros
如果是源码编译请先source下工作空间后再使用下面指令查看是否安装成功;
ros2 pkg list | grep cartographer
能看到下面的结果即可
- cartographer_ros
- cartographer_ros_msgs
4.1 pose_graph.lua-后端参数配置项
该文件主要和地图构建
--Fast csm的最低分数,高于此分数才进行优化。
constraint_builder.min_score = 0.65
--全局定位最小分数,低于此分数则认为目前全局定位不准确
constraint_builder.global_localization_min_score = 0.7
4.2 文件:backpack_2d.lua
该部分参数主要是用于和ROS2进行通信和数据收发的配置,比如配置从哪个话题读取里程记数据,从哪个话题来获取深度信息(雷达)。
- include "map_builder.lua"
- include "trajectory_builder.lua"
-
- options = {
- map_builder = MAP_BUILDER,
- trajectory_builder = TRAJECTORY_BUILDER,
- -- 用来发布子地图的ROS坐标系ID,位姿的父坐标系,通常是map。
- map_frame = "map",
- -- SLAM算法跟随的坐标系ID
- tracking_frame = "base_link",
- -- 将发布map到published_frame之间的tf
- published_frame = "base_link",
- -- 位于“published_frame ”和“map_frame”之间,用来发布本地SLAM结果(非闭环),通常是“odom”
- odom_frame = "odom",
- -- 是否提供里程计
- provide_odom_frame = true,
- -- 只发布二维位姿态(不包含俯仰角)
- publish_frame_projected_to_2d = false,
- -- 是否使用里程计数据
- use_odometry = false,
- -- 是否使用GPS定位
- use_nav_sat = false,
- -- 是否使用路标
- use_landmarks = false,
- -- 订阅的laser scan topics的个数
- num_laser_scans = 0,
- -- 订阅多回波技术laser scan topics的个数
- num_multi_echo_laser_scans = 1,
- -- 分割雷达数据的个数
- num_subdivisions_per_laser_scan = 10,
- -- 订阅的点云topics的个数
- num_point_clouds = 0,
- -- 使用tf2查找变换的超时秒数
- lookup_transform_timeout_sec = 0.2,
- -- 发布submap的周期间隔
- submap_publish_period_sec = 0.3,
- -- 发布姿态的周期间隔
- pose_publish_period_sec = 5e-3,
- -- 轨迹发布周期间隔
- trajectory_publish_period_sec = 30e-3,
- -- 测距仪的采样率
- rangefinder_sampling_ratio = 1.,
- --里程记数据采样率
- odometry_sampling_ratio = 1.,
- -- 固定的frame位姿采样率
- fixed_frame_pose_sampling_ratio = 1.,
- -- IMU数据采样率
- imu_sampling_ratio = 1.,
- -- 路标采样率
- landmarks_sampling_ratio = 1.,
- }

在src目录下,使用创建功能包指令,创建功能包
cd src
ros2 pkg create fishbot_cartographer
接着创建配置文件夹、launch文件夹和rviz配置文件夹。
cd fishbot_cartographer
mkdir config
mkdir launch
mkdir rviz
功能包结构:
.
├── CMakeLists.txt
├── config
├── launch
├── src
├── package.xml
└── rviz
相较于默认的配置文件,主要修改以下内容(见注释)
- include "map_builder.lua"
- include "trajectory_builder.lua"
-
- options = {
- map_builder = MAP_BUILDER,
- trajectory_builder = TRAJECTORY_BUILDER,
- map_frame = "map",
- tracking_frame = "base_link",
- -- base_link改为odom,发布map到odom之间的位姿态
- published_frame = "odom",
- odom_frame = "odom",
- -- true改为false,不用提供里程计数据
- provide_odom_frame = false,
- -- false改为true,仅发布2D位资
- publish_frame_projected_to_2d = true,
- -- false改为true,使用里程计数据
- use_odometry = true,
- use_nav_sat = false,
- use_landmarks = false,
- -- 0改为1,使用一个雷达
- num_laser_scans = 1,
- -- 1改为0,不使用多波雷达
- num_multi_echo_laser_scans = 0,
- -- 10改为1,1/1=1等于不分割
- num_subdivisions_per_laser_scan = 1,
- num_point_clouds = 0,
- lookup_transform_timeout_sec = 0.2,
- submap_publish_period_sec = 0.3,
- pose_publish_period_sec = 5e-3,
- trajectory_publish_period_sec = 30e-3,
- rangefinder_sampling_ratio = 1.,
- odometry_sampling_ratio = 1.,
- fixed_frame_pose_sampling_ratio = 1.,
- imu_sampling_ratio = 1.,
- landmarks_sampling_ratio = 1.,
- }
-
-
- -- false改为true,启动2D SLAM
- MAP_BUILDER.use_trajectory_builder_2d = true
-
- -- 0改成0.10,比机器人半径小的都忽略
- TRAJECTORY_BUILDER_2D.min_range = 0.10
- -- 30改成3.5,限制在雷达最大扫描范围内,越小一般越精确些
- TRAJECTORY_BUILDER_2D.max_range = 3.5
- -- 5改成3,传感器数据超出有效范围最大值
- TRAJECTORY_BUILDER_2D.missing_data_ray_length = 3.
- -- true改成false,不使用IMU数据,大家可以开启,然后对比下效果
- TRAJECTORY_BUILDER_2D.use_imu_data = false
- -- false改成true,使用实时回环检测来进行前端的扫描匹配
- TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true
- -- 1.0改成0.1,提高对运动的敏感度
- TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.1)
-
- -- 0.55改成0.65,Fast csm的最低分数,高于此分数才进行优化。
- POSE_GRAPH.constraint_builder.min_score = 0.65
- --0.6改成0.7,全局定位最小分数,低于此分数则认为目前全局定位不准确
- POSE_GRAPH.constraint_builder.global_localization_min_score = 0.7
-
- -- 设置0可关闭全局SLAM
- -- POSE_GRAPH.optimize_every_n_nodes = 0
-
- return options

编写launch文件
/cartographer_node节点:
该节点从/scan和/odom话题接收数据进行计算,输出/submap_list数据.
该节点需要接收一个参数配置文件(第二部分写的那个)参数。
/occupancy_grid_node节点:
该节点接收/submap_list子图列表,然后将其拼接成map并发布
在路径src/fishbot_cartographer/launch/下新建cartographer.launch.py文件,接着我们将上面两个节点加入到这个launch文件中。
我们在第二部分写的配置文件就是给cartographer_node节点的,可以通过这个节点启动参数configuration_directory和configuration_basename进行传递。
-
- import os
- from launch import LaunchDescription
- from launch.substitutions import LaunchConfiguration
- from launch_ros.actions import Node
- from launch_ros.substitutions import FindPackageShare
-
-
- def generate_launch_description():
- # 定位到功能包的地址
- pkg_share = FindPackageShare(package='fishbot_cartographer').find('fishbot_cartographer')
-
- #=====================运行节点需要的配置=======================================================================
- # 是否使用仿真时间,我们用gazebo,这里设置成true
- use_sim_time = LaunchConfiguration('use_sim_time', default='true')
- # 地图的分辨率
- resolution = LaunchConfiguration('resolution', default='0.05')
- # 地图的发布周期
- publish_period_sec = LaunchConfiguration('publish_period_sec', default='1.0')
- # 配置文件夹路径
- configuration_directory = LaunchConfiguration('configuration_directory',default= os.path.join(pkg_share, 'config') )
- # 配置文件
- configuration_basename = LaunchConfiguration('configuration_basename', default='fishbot_2d.lua')
- rviz_config_dir = os.path.join(pkg_share, 'config')+"/cartographer.rviz"
- print(f"rviz config in {rviz_config_dir}")
-
-
- #=====================声明三个节点,cartographer/occupancy_grid_node/rviz_node=================================
- cartographer_node = Node(
- package='cartographer_ros',
- executable='cartographer_node',
- name='cartographer_node',
- output='screen',
- parameters=[{'use_sim_time': use_sim_time}],
- arguments=['-configuration_directory', configuration_directory,
- '-configuration_basename', configuration_basename])
-
- cartographer_occupancy_grid_node = Node(
- package='cartographer_ros',
- executable='cartographer_occupancy_grid_node',
- name='cartographer_occupancy_grid_node',
- output='screen',
- parameters=[{'use_sim_time': use_sim_time}],
- arguments=['-resolution', resolution, '-publish_period_sec', publish_period_sec])
-
- rviz_node = Node(
- package='rviz2',
- executable='rviz2',
- name='rviz2',
- arguments=['-d', rviz_config_dir],
- parameters=[{'use_sim_time': use_sim_time}],
- output='screen')
-
- #===============================================定义启动文件========================================================
- ld = LaunchDescription()
- ld.add_action(cartographer_node)
- ld.add_action(cartographer_occupancy_grid_node)
- ld.add_action(rviz_node)
-
- return ld

打开CmakeLists.txt,添加下面一条指令,将三个目录安装到install目录。
install(
DIRECTORY config launch rviz
DESTINATION share/${PROJECT_NAME}
)
colcon build --packages-select fishbot_cartographer
启动建图前,需要先启动gazebo仿真环境,因为我们的建图程序依赖于Gazebo提供雷达和里程计等数据。
source install/setup.bash
ros2 launch fishbot_description gazebo.launch.py
source install/setup.bash
ros2 launch fishbot_cartographer cartographer.launch.py
打开遥控节点:
ros2 run teleop_twist_keyboard teleop_twist_keyboar
保存地图
sudo apt install ros-humble-nav2-map-server
ros2 run nav2_map_server map_saver_cli --help
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。