Gazebo+ros在同一用户上启动多个环境和Gazebo仿真加速

前提:安装完ros,有ros相关包。

# 终端 1(启动roscore)
export ROS_MASTER_URI=http://localhost:11311
roscore -p 11311  
# 终端 2(启动gazebo环境)
export ROS_MASTER_URI=http://localhost:11311
export GAZEBO_MASTER_URI=http://localhost:11345
roslaunch turtlebot3_gazebo turtlebot3_stage_1_mult.launch gzserver_args:="-p 11345"
#终端 3(启动算法)
export ROS_MASTER_URI=http://localhost:11311
export GAZEBO_MASTER_URI=http://localhost:11345
python3 xxx(你自己的算法,可以是roslaunch)

Gazebo仿真加速,找到对应world文件,修改下面代码

<real_time_update_rate>1000</real_time_update_rate>
<max_step_size>0.003</max_step_size>  #1000 * 0.003 大概是3倍速
<real_time_factor>0</real_time_factor>
posted @ 2025-04-18 22:56  ronglingze  阅读(65)  评论(0)    收藏  举报