ROS2测试仿真
电脑配置:R7-7840H 核显
结论:turtlebot3 运行失败。
turtlebot4 可以进入仿真环境,但是无法操作。
现在在用 ign gazebo 驱动简单的差分机器人
ign gazebo
采用ign gazebo 打开简单的差分机器人
安装
sudo apt-get install ros-${ROS_DISTRO}-ros-gz
sudo apt install ros-humble-gazebo-ros-pkgs
# 桥接器 用于 ros2与gazebo Transport 之间交换信息
sudo apt-get install ros-humble-ros-ign-bridge
# 接受键盘信息并转为 twist
sudo apt-get install ros-humble-teleop-twist-keyboard
运行
# 运行仿真
ign gazebo -v 4 -r visualize_lidar.sdf
# 查看话题
ign topic -l
# 为/model/vehicle_blue/cmd_vel 创建桥接器
ros2 run ros_gz_bridge parameter_bridge /model/vehicle_blue/cmd_vel@geometry_msgs/msg/Twist]ignition.msgs.Twist
# 键盘控制节点
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r /cmd_vel:=/model/vehicle_blue/cmd_vel
# lidar创建桥接器
ros2 run ros_gz_bridge parameter_bridge /lidar2@sensor_msgs/msg/LaserScan[ignition.msgs.LaserScan --ros-args -r /lidar2:=/laser_scan
turtlebot
安装
参考链接:https://turtlebot.github.io/turtlebot4-user-manual/software/turtlebot4_robot.html
git clone 慢
添加
https://ghfast.top/
git clone https://github.com/turtlebot/turtlebot4_robot.git -b humble
git clone https://ghfast.top/https://github.com/turtlebot/turtlebot4_robot.git -b humble
turtlebot3
gazebo 启动问题
export SVGA_VGPU10=0
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:/home/ly/.gazebo/models
# 设置TurtleBot3模型
export TURTLEBOT3_MODEL=burger
# 启动TurtleBot3 World环境
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
turtlebot4
gazebo 启动问题
export SVGA_VGPU10=0
# 仿真launch
ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py
# 键盘控制节点
ros2 run teleop_twist_keyboard teleop_twist_keyboard
虚拟机打不开共享文件夹
sudo mount -t fuse.vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other