@小鱼 嗯...可以。我用rqt手动加载模型时可以设置namespace。但是在urdf的<gazebo><plugin>标签下的<ros>里面怎么设置呢?我尝试直接输入fishbot是无效的。我暂时没查找到相关资料。
重要提示
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
1451024143 发布的最新帖子
-
RE: ros2多机器gazebo仿真时的键盘工具控制问题
-
关于ros2多机器人仿真的问题
在学习完小鱼的“动手学ros2”建模仿真篇后,我学会了如何运用launch将单个机器人添加Gazebo中和利用rqt添加多个机器人到gazebo。
那么,现在我想利用一个launch将多个机器人模型展示在gazebo中,又如何操作呢?我想主要是设置每个机器人初始坐标的问题,那这个怎么在launch实现呢?
以下是课程文档中添加单个机器人的launch代码:
import os
from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageSharedef generate_launch_description():
robot_name_in_model1 = 'fishbot_0'
robot_name_in_model2 = 'fishbot_1'
package_name = 'fishbot_description'
urdf_name = "fishbot_gazebo_1.urdf"ld = LaunchDescription() pkg_share = FindPackageShare(package=package_name).find(package_name) urdf_model_path = os.path.join(pkg_share,f'urdf/{urdf_name}') # Start Gazebo server start_gazebo_cmd = ExecuteProcess( cmd=['gazebo','--verbose','-s','libgazebo_ros_init.so','-s','libgazebo_ros_factory.so'], output='screen') # Launch the robot spawn_entity_cmd1 = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-entity',robot_name_in_model1,'-file',urdf_model_path ], output='screen' ) spawn_entity_cmd2 = Node( package='gazebo_ros', executable='spawn_entity.py', arguments=['-entity',robot_name_in_model2,'-file',urdf_model_path ], output='screen') # Start Robot State publisher start_robot_state_publisher_cmd = Node( package='robot_state_publisher', executable='robot_state_publisher', arguments=[urdf_model_path] ) # Launch RViz start_rviz_cmd = Node( package='rviz2', executable='rviz2', name='rviz2', output='screen', # arguments=['-d',default_rviz_config_path] ) """joint_state_pubilsher_node = Node( package='joint_state_publisher_gui', executable='joint_state_publisher_gui', name='joint_state_publisher_gui', arguments=[urdf_model_path] )""" ld.add_action(start_gazebo_cmd) ld.add_action(spawn_entity_cmd1) ld.add_action(spawn_entity_cmd2) ld.add_action(start_robot_state_publisher_cmd) ld.add_action(start_rviz_cmd) #ld.add_action(joint_state_pubilsher_node) return ld
如何设置机器人的初始位置,以及如何使用launch进行多机器人仿真?
我在古月居查阅到的资料是ros1(https://www.guyuehome.com/4889)的,真的看不懂。