爱折腾-创客智造实验室 - Ailibot2仿真机器人入门教程
type: channel
link: https://www.ncnynl.com/category/ailibot2-sim
description: 通过Ailibot2仿真机器人入门教程学习，了解gazebo，软ailibot件，系统，固件，建图，导航等多个方面（来自爱折腾）
items: Ailibot2仿真入门教程-环境配置
items: Ailibot2仿真入门教程-gazebo-设计简单的gazebo场景
items: Ailibot2仿真入门教程-gazebo-使用gazebo插件生成场景的截面地图
items: Ailibot2仿真入门教程-gazebo-加载gazebo场景
items: Ailibot2仿真入门教程-加载Ailibot2的URDF模型到gazebo
items: Ailibot2仿真入门教程-加载Ailibot2的SDF模型到gazebo
items: Ailibot2仿真入门教程-利用robot_localization融合里程和IMU数据
items: Ailibot2仿真入门教程-控制-键盘控制
items: Ailibot2仿真入门教程-建图-gmapping建图
items: Ailibot2仿真入门教程-建图-slam_toolbox建图

Ailibot2仿真入门教程-环境配置
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如何搭建Ailibot2的仿真环境 测试环境：Ubuntu 20.04 + ROS2 Galactic 操作步骤 系统安装：Ubuntu20.04安装教程 RCM是开源代码部署工具，非常便于部署代码， RCM工具介绍 RCM安装： $ curl https://www.ncnynl.com/rcm.sh | bash - ROS2安装：ROS2 galactic安装教程 $ rcm ros2 install_ros2_now 使用RCM工具安装ailibot2仿真包 $ rcm ros2_ailibot2 install_ros2_ailibot2_sim $ source ~/ros2_ailibot2_sim_ws/install/local_setup.bash

Ailibot2仿真入门教程-gazebo-设计简单的gazebo场景
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如何在gazebo上设计新的gazebo场景 测试环境：Ubuntu 20.04 + Gazebo11 操作步骤 启动gazebo $ gazebo 按下ctrl+b打开模型编辑界面 通过拖动侧边栏的Wall到白色编辑框，此处简单围了7x8m的空间作为测试 可根据需要添加相应的特征 点击右上角File->Save的按钮保存模型，同时退出模型编辑模式 当前回到主界面，点击上方十字按钮可以移动模型 同时可添加一些简单的障碍 最后点击右上角File->Save World As到ailibot2_gazebo/worlds文件夹下，且命名为test.world 参考资料 http://www.autolabor.com.cn/book/ROSTutorials/di-6-zhang-ji-qi-ren-xi-tong-fang-zhen/66-urdfji-cheng-gazebo/664-gazebofang-zhen-huan-jing-da-jian.html https://blog.csdn.net/qq_33742147/article/details/105437418

Ailibot2仿真入门教程-gazebo-使用gazebo插件生成场景的截面地图
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如果使用gazebo插件生成场景的截面地图 测试环境： Ubuntu 20.04 + Gazebo 11 + collision_map_creator_plugin插件 操作步骤 此处使用本站RCM工具部署代码 # 安装rcm curl https://www.ncnynl.com/rcm.sh | bash - # 安装gazebo插件,ros1和ros2通用 rcm ros1_gazebo install_ros1_map_creator_plugin 测试 使用插件包中自带的world场景测试 加载场景 $ export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:~/tools/collision_map_creator_plugin/build $ gazebo ~/tools/collision_map_creator_plugin/world/simple.world --verbose Gazebo multi-robot simulator, version 11.11.0 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org [Msg] Waiting for master. Gazebo multi-robot simulator, version 11.11.0 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org [Msg] Waiting for master. [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [Msg] Publicized address: 192.168.0.18 [Msg] Loading world file [/home/lalala/tools/collision_map_creator_plugin/world/./simple.world] Subscribing to: ~/collision_map/command [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [Msg] Publicized address: 192.168.0.18 [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once. 指定--verbose参数，显示启动的详细信息，了解加载插件 新开终端，请求建图 $ export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:~/tools/collision_map_creator_plugin/build $ cd ~/tools/collision_map_creator_plugin/build $ ./request_publisher "(-5,5)(5,5)(5,-5)(-5,-5)" 0.1 0.05 $(pwd)/map.png 255 ground_plane::link::collision Request: LL.x: -5 LL.y: -3 UR.x: 4 UR.y: 5 Height: 0.1 Resolution: 0.05 Filename: /home/lalala/tools/collision_map_creator_plugin/build/map.png Threshold: 255 GroundEntityName: ground_plane::link::collision MinHeight: 0 done1done2done3 参数说明 "(-5,5)(5,5)(5,-5)(-5,-5)" 表示要建图的范围（单位：米），通常等于Gazebo中的栅格数； 0.1 表示垂直投影的高度； 0.05 地图分辨率，即每个像素代表0.01m； $(pwd)/cloister.png 生成地图图片的位置和名称 office_desk::link::collision 被视为地面，以白色显示，其余位置以黑色（255-255=0）着色 查看输出的…

Ailibot2仿真入门教程-gazebo-加载gazebo场景
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如何在gazebo上加载Gazebo场景 测试环境：Ubuntu 20.04 + Gazebo11 操作步骤 上篇文章中，我们制作了一个简单的场景，现在加载Gazebo场景 进入到ailibot2_gazebo/launch文件夹下，新建test_world.launch.py import os from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription from launch.conditions import IfCondition, UnlessCondition from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import Command, LaunchConfiguration, PythonExpression from launch_ros.actions import Node from launch_ros.substitutions import FindPackageShare def generate_launch_description(): # Set the path to the Gazebo ROS package pkg_gazebo_ros = FindPackageShare(package='gazebo_ros').find('gazebo_ros') # Set the path to this package. pkg_share = FindPackageShare(package='ailibot2_gazebo').find('ailibot2_gazebo') # Set the path to the world file world_file_name = 'test.world' world_path = os.path.join(pkg_share, 'worlds', world_file_name) # Set the path to the SDF model files. gazebo_models_path = os.path.join(pkg_share, 'models') os.environ["GAZEBO_MODEL_PATH"] = gazebo_models_path ########### YOU DO NOT NEED TO CHANGE ANYTHING BELOW THIS LINE ############## # Launch configuration variables specific to simulation headless = LaunchConfiguration('headless') use_sim_time = LaunchConfiguration('use_sim_time') use_simulator = LaunchConfiguration('use_simulator') world = LaunchConfiguration('world') declare_simulator_cmd = DeclareLaunchArgument( name='headless', default_value='False', description='Whether to execute gzclient') declare_use_sim_time_cmd = DeclareLaunchArgument( name='use_sim_time', default_value='true', description='Use simulation (Gazebo) clock if true') declare_use_simulator_cmd = DeclareLaunchArgument( name='use_simulator', default_value='True', description='Whether to start the simulator') declare_world_cmd = DeclareLaunchArgument( name='world', default_value=world_path, description='Full path to the world model file to load') # Specif…

Ailibot2仿真入门教程-加载Ailibot2的URDF模型到gazebo
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如何加载ailibot2的URDF模型到gazebo 测试环境：Ubuntu 20.04 + Gazebo11 操作步骤 启动gazebo仿真，加载Ailibot2的urdf模型 $ ros2 launch ailibot2_bringup robot_sim.launch.py use_rviz:=true [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2023-09-07-18-08-51-720475-ailibotOS-VM-26766 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [gzserver-1]: process started with pid [26769] [INFO] [gzclient -2]: process started with pid [26772] [INFO] [spawn_entity.py-3]: process started with pid [26774] [INFO] [robot_state_publisher-4]: process started with pid [26777] [robot_state_publisher-4] Link base_link had 8 children [robot_state_publisher-4] Link camera_bottom_screw_frame had 1 children [robot_state_publisher-4] Link camera_link had 1 children [robot_state_publisher-4] Link camera_depth_frame had 4 children [robot_state_publisher-4] Link camera_color_frame had 1 children [robot_state_publisher-4] Link camera_color_optical_frame had 0 children [robot_state_publisher-4] Link camera_depth_optical_frame had 0 children [robot_state_publisher-4] Link camera_left_ir_frame had 1 children [robot_state_publisher-4] Link camera_left_ir_optical_frame had 0 children [robot_state_publisher-4] Link camera_right_ir_frame had 1 children [robot_state_publisher-4] Link camera_right_ir_optical_frame had 0 children [robot_state_publisher-4] Link caster_back_link had 0 children [robot_state_publisher-4] Link caster_front_link had 0 children [robot_state_publisher-4] Link imu_link had 0 children [robot_state_publisher-4] Link laser_link had 0 children [robot_state_publisher-4] Link sonar_front_link had 0 children [robot_state_publisher-4] Link wheel_left_link had 0 children [robot_state_publisher-4] Link wheel_right_link had 0 children [robot_state_publisher-4] [INFO] [1694081332.651374226] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-4] [INFO] [1694081332.651822593] [robot_state_publisher]: got segment base_link [robot_state_publisher-4] [INFO] …

Ailibot2仿真入门教程-加载Ailibot2的SDF模型到gazebo
type: item
date: 2023-08-25T09:09:00+00:00
description: 文章说明 本教程主要介绍如何加载Ailibot2的SDF模型到gazebo 操作步骤 启动gazebo仿真，加载Ailibot2的SDF模型 $ ros2 launch ailibot2_bringup robot_sim_with_sdf.launch.py use_rviz:=true [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2023-09-07-12-05-31-122302-ailibotOS-VM-8978 [INFO] [launch]: Default logging verbosity is set to INFO GAZEBO_MODEL_PATH: /usr/share/gazebo-11/models::/home/ubuntu/ros2_ailibot2_sim_ws/install/ailibot2_description/share/ailibot2_description/meshes [INFO] [robot_state_publisher-1]: process started with pid [8981] [INFO] [gzserver-2]: process started with pid [8983] [INFO] [gzclient -3]: process started with pid [8985] [INFO] [spawn_entity.py-4]: process started with pid [8988] [robot_state_publisher-1] Link base_link had 8 children [robot_state_publisher-1] Link camera_bottom_screw_frame had 1 children [robot_state_publisher-1] Link camera_link had 1 children [robot_state_publisher-1] Link camera_depth_frame had 4 children [robot_state_publisher-1] Link camera_color_frame had 1 children [robot_state_publisher-1] Link camera_color_optical_frame had 0 children [robot_state_publisher-1] Link camera_depth_optical_frame had 0 children [robot_state_publisher-1] Link camera_left_ir_frame had 1 children [robot_state_publisher-1] Link camera_left_ir_optical_frame had 0 children [robot_state_publisher-1] Link camera_right_ir_frame had 1 children [robot_state_publisher-1] Link camera_right_ir_optical_frame had 0 children [robot_state_publisher-1] Link caster_back_link had 0 children [robot_state_publisher-1] Link caster_front_link had 0 children [robot_state_publisher-1] Link imu_link had 0 children [robot_state_publisher-1] Link laser_link had 0 children [robot_state_publisher-1] Link sonar_front_link had 0 children [robot_state_publisher-1] Link wheel_left_link had 0 children [robot_state_publisher-1] Link wheel_right_link had 0 children [robot_state_publisher-1] [INFO] [1694059532.660441133] [robot_state_publisher]: got segment base_footprint [robot_state_publi…

Ailibot2仿真入门教程-利用robot_localization融合里程和IMU数据
type: item
date: 2023-08-25T09:10:00+00:00
description: 文章说明 本教程主要介绍如何加载ailibot2的URDF模型到gazebo 测试环境：Ubuntu 20.04 + Gazebo11 + ROS2 Galactic 操作步骤 $ ros2 launch ailibot2_bringup robot_sim_with_ekf.launch.py [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2023-09-07-18-36-21-627170-ailibotOS-VM-28302 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [gzserver-1]: process started with pid [28306] [INFO] [gzclient -2]: process started with pid [28308] [INFO] [spawn_entity.py-3]: process started with pid [28311] [INFO] [robot_state_publisher-4]: process started with pid [28314] [INFO] [ekf_node-5]: process started with pid [28316] [robot_state_publisher-4] Link base_link had 6 children [robot_state_publisher-4] Link caster_back_link had 0 children [robot_state_publisher-4] Link caster_front_link had 0 children [robot_state_publisher-4] Link imu_link had 0 children [robot_state_publisher-4] Link laser_link had 0 children [robot_state_publisher-4] Link wheel_left_link had 0 children [robot_state_publisher-4] Link wheel_right_link had 0 children [robot_state_publisher-4] [INFO] [1694082982.529842060] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-4] [INFO] [1694082982.529904860] [robot_state_publisher]: got segment base_link [robot_state_publisher-4] [INFO] [1694082982.529913754] [robot_state_publisher]: got segment caster_back_link [robot_state_publisher-4] [INFO] [1694082982.529919142] [robot_state_publisher]: got segment caster_front_link [robot_state_publisher-4] [INFO] [1694082982.529923927] [robot_state_publisher]: got segment imu_link [robot_state_publisher-4] [INFO] [1694082982.529928443] [robot_state_publisher]: got segment laser_link [robot_state_publisher-4] [INFO] [1694082982.529932945] [robot_state_publisher]: got segment wheel_left_link [robot_state_publisher-4] [INFO] [1694082982.529937518] [robot_state_publisher]: got segment wheel_right_link [spawn_entity.py-3] [INFO] [1694082982.860998491] [spawn_entity]: Spawn Entity started [spawn_entity.py-3] …

Ailibot2仿真入门教程-控制-键盘控制
type: item
date: 2023-08-25T09:12:00+00:00
description: 文章说明 本教程主要介绍如何在gazebo仿真中使用键盘控制Ailibot2 操作步骤 启动gazebo仿真，加载Ailibot2模型 $ ros2 launch ailibot2_bringup robot_sim.launch.py [INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2023-09-07-12-05-31-122302-ailibotOS-VM-8978 [INFO] [launch]: Default logging verbosity is set to INFO GAZEBO_MODEL_PATH: /usr/share/gazebo-11/models::/home/ubuntu/ros2_ailibot2_sim_ws/install/ailibot2_description/share/ailibot2_description/meshes [INFO] [robot_state_publisher-1]: process started with pid [8981] [INFO] [gzserver-2]: process started with pid [8983] [INFO] [gzclient -3]: process started with pid [8985] [INFO] [spawn_entity.py-4]: process started with pid [8988] [robot_state_publisher-1] Link base_link had 8 children [robot_state_publisher-1] Link camera_bottom_screw_frame had 1 children [robot_state_publisher-1] Link camera_link had 1 children [robot_state_publisher-1] Link camera_depth_frame had 4 children [robot_state_publisher-1] Link camera_color_frame had 1 children [robot_state_publisher-1] Link camera_color_optical_frame had 0 children [robot_state_publisher-1] Link camera_depth_optical_frame had 0 children [robot_state_publisher-1] Link camera_left_ir_frame had 1 children [robot_state_publisher-1] Link camera_left_ir_optical_frame had 0 children [robot_state_publisher-1] Link camera_right_ir_frame had 1 children [robot_state_publisher-1] Link camera_right_ir_optical_frame had 0 children [robot_state_publisher-1] Link caster_back_link had 0 children [robot_state_publisher-1] Link caster_front_link had 0 children [robot_state_publisher-1] Link imu_link had 0 children [robot_state_publisher-1] Link laser_link had 0 children [robot_state_publisher-1] Link sonar_front_link had 0 children [robot_state_publisher-1] Link wheel_left_link had 0 children [robot_state_publisher-1] Link wheel_right_link had 0 children [robot_state_publisher-1] [INFO] [1694059532.660441133] [robot_state_publisher]: got segment base_footprint [robot_state_publisher-1] [INFO] [1694059532.…

Ailibot2仿真入门教程-建图-gmapping建图
type: item
date: 2023-08-31T02:55:00+00:00
description: 文章说明 本教程主要介绍Ailibot2在gazebo仿真中进行gmapping算法建图的操作流程 如果没有安装gmapping，则通过下面方式安装 rcm ros2_algorithm install_ros2_gmapping_source 操作步骤 启动gazebo仿真，加载Ailibot2模型 $ ros2 launch ailibot2_bringup robot_sim.launch.py 启动gmapping算法建图节点 $ ros2 launch ailibot2_slam gmapping.launch.py use_rviz:=true 启动键盘控制节点，移动建图 $ ros2 launch ailibot2_teleop keyboard.launch.py 保存地图 # 根目录下新建一个map文件夹，如果根目录下有map文件夹，请忽略该步骤 $ mkdir ~/map # 启动保存地图节点 $ ros2 run nav2_map_server map_saver_cli -f ~/map/map --ros-args -p save_map_timeout:=10000.00 查看保存好的地图 $ eog ~/map/map.pgm 演示视频

Ailibot2仿真入门教程-建图-slam_toolbox建图
type: item
date: 2023-08-31T02:56:00+00:00
description: 文章说明 本教程主要介绍Ailibot2在gazebo仿真中进行slam_toolbox算法建图的操作流程 操作步骤 启动gazebo仿真，加载Ailibot2模型 $ ros2 launch ailibot2_bringup robot_sim.launch.py 启动slam_toolbox算法建图节点 $ ros2 launch ailibot2_slam slam_toolbox.launch.py use_rviz:=true 启动键盘控制节点，移动建图 $ ros2 launch ailibot2_teleop keyboard.launch.py 保存地图 # 根目录下新建一个map文件夹，如果根目录下有map文件夹，请忽略该步骤 $ mkdir ~/map # 启动保存地图节点 $ ros2 run nav2_map_server map_saver_cli -f ~/map/map --ros-args -p save_map_timeout:=10000.00 查看保存好的地图 $ eog ~/map/map.pgm 演示视频