Home » ROS2与walking机器人仿真教程 » ROS2与walking机器人仿真教程-启动仿真环境

ROS2与walking机器人仿真教程-启动仿真环境

ROS2与walking机器人仿真教程-启动仿真环境

说明:

  • 介绍walking机器人如何启动仿真环境

步骤:

  • 新终端,启动命令
  • 目前收集了多个仿真环境,默认采用mememan_world,其他包括office.sdf,phenix_world.sdf,simple.sdf
  • 默认启动如下
ros2 launch walking_gazebo world.launch.py 
或
ros2 launch walking_gazebo world.launch.py world_model:=mememan_world.sdf
  • 效果图:

请输入图片描述

  • 启动office.sdf
ros2 launch walking_gazebo world.launch.py world_model:=office.sdf
  • 效果图:

请输入图片描述

  • 启动phenix_world.sdf
ros2 launch walking_gazebo world.launch.py world_model:=phenix_world.sdf
  • 效果图:

请输入图片描述

  • 启动phenix_world.sdf
ros2 launch walking_gazebo world.launch.py world_model:=simple.sdf
  • 效果图:

请输入图片描述

  • 查看话题列表
$ ros2 topic list
/clock
/cmd_vel
/imu
/joint_states
/odom
/parameter_events
/performance_metrics
/rgb_camera/camera_info
/rgb_camera/image_raw
/rgb_camera/image_raw/compressed
/rgb_camera/image_raw/compressedDepth
/rgb_camera/image_raw/theora
/robot_description
/rosout
/scan
/tf
/tf_static
  • 查看雷达信息
$ ros2 topic echo /scan
--
header:
  stamp:
    sec: 58
    nanosec: 158000000
  frame_id: laser
angle_min: 0.0
angle_max: 6.28000020980835
angle_increment: 0.017541900277137756
time_increment: 0.0
scan_time: 0.0
range_min: 0.11999999731779099
range_max: 20.0
ranges:
- 3.736046314239502
- 3.6740000247955322
- 3.6429147720336914
- 3.5941758155822754
...................
- '...'
intensities:
- 0.0
- 0.0
- 0.0
- 0.0
...................
- '...'
---
  • 查看里程信息
$ ros2 topic echo /odom 
---
header:
  stamp:
    sec: 618
    nanosec: 64000000
  frame_id: odom
child_frame_id: base_footprint
pose:
  pose:
    position:
      x: 1.1471448623851346
      y: -0.1456954220088117
      z: -7.154365310180211e-07
    orientation:
      x: 1.593274608608113e-07
      y: -1.3692192946271564e-06
      z: -0.13045278909924055
      w: 0.9914545223127126
  covariance:
  - 1.0e-05
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1.0e-05
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.001
twist:
  twist:
    linear:
      x: -1.0751142433662118e-05
      y: 1.0208784293020737e-05
      z: 0.0
    angular:
      x: 0.0
      y: 0.0
      z: -0.00043032517609123443
  covariance:
  - 1.0e-05
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1.0e-05
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 1000000000000.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.001
---
  • 查看imu信息
$ ros2 topic echo /imu
---
header:
  stamp:
    sec: 667
    nanosec: 108000000
  frame_id: base_footprint
orientation:
  x: 1.464210082826734e-07
  y: -1.371145219477276e-06
  z: -0.1408404845980011
  w: 0.9900323014408666
orientation_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
angular_velocity:
  x: 1.982806233993939e-05
  y: -0.01375810055450966
  z: -0.0003004565760008374
angular_velocity_covariance:
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
- 0.0
- 0.0
- 0.0
- 4.0e-08
linear_acceleration:
  x: -0.4423912044154092
  y: -0.10037562452760843
  z: 9.265428900410678
linear_acceleration_covariance:
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
- 0.0
- 0.0
- 0.0
- 0.00028900000000000003
---
  • 查看速度话题
$ ros2 topic echo /cmd_vel
linear:
  x: 0.1
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0
---
linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0
---
  • 启动rviz2查看图像和深度数据等
rviz2 
  • 查看图像话题
  • 点Add 按钮,添加图像话题/rgb_camera/image_raw,选择fixed frame为base_link, 选择topic下的Reliability Policy为Best Effort
  • 效果图
    请输入图片描述
  • 查看深度图像话题

  • 点Add 按钮,添加图像话题/depth_camera/image_raw,选择fixed frame为base_link, 选择topic下的Reliability Policy为Best Effort

  • 效果图
    请输入图片描述

  • 查看点云

  • 点Add 按钮,添加点云话题/depth_camera/points,选择fixed frame为base_link

  • 效果图

请输入图片描述

  • 查看TF树
ros2 run tf2_tools view_frames
  • 保存TF树的PDF在当前目录下,名为frames.pdf,打开PDF
evince frames.pdf 
  • 效果图:

请输入图片描述

  • 这是有一个问题就是left_wheel/right_wheel仿真下关联到base_footprint下,而不是base_link,真机是关联到base_link

演示视频

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: walking机器人仿真教程