让gazebo classic版本的小车,通过发布ros2话题动起来

让gazebo classic版本的小车,通过发布ros2话题动起来


编程环境:Ubuntu20.04+ROS2 Foxy

在Gazebo11的官方教程中,Installing gazebo_ros_pkgs (ROS 2)介绍了怎样通过ros2发布cmd_vel话题来控制差速小车,在安装好需要的工具包后,教程中给出了一条命令,用来唤起Gazebo界面。

gazebo --verbose /opt/ros/foxy/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world

实际上并不能唤起界面,输出提示:

[INFO] [1711608501.395137352] [gazebo_ros_node]: ROS was initialized without arguments.

正确的命令应该是

gazebo --verbose /opt/ros/foxy/share/gazebo_plugins/worlds/gazebo_ros_diff_drive_demo.world  -s libgazebo_ros_init.so

你应该会看到下面的输出

[INFO] [1711606843.044762953] [demo.diff_drive]: Wheel pair 1 separation set to [1.250000m]
[INFO] [1711606843.044924607] [demo.diff_drive]: Wheel pair 1 diameter set to [0.600000m]
[INFO] [1711606843.045360212] [demo.diff_drive]: Subscribed to [/demo/cmd_demo]
[INFO] [1711606843.045766619] [demo.diff_drive]: Advertise odometry on [/demo/odom_demo]
[INFO] [1711606843.046170216] [demo.diff_drive]: Publishing odom transforms between [odom_demo] and [chassis]
[INFO] [1711606843.046183276] [demo.diff_drive]: Publishing wheel transforms between [chassis], [left_wheel_joint] and [right_wheel_joint]

这时你将会看到gazebo的界面,并且使用ros2 topic list也应该可以看到相应的话题

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值