当前位置:网站首页>ros2 launch文件常用模块
ros2 launch文件常用模块
2022-07-28 00:05:00 【bisheng95】
import os
from launch import LaunchDescription
from launch.actions import ExecuteProcess
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
robot_name_in_model = 'fishbot'
package_name = 'fishbot_description'
urdf_name = "fishbot_gazebo.urdf"
ld = LaunchDescription()
pkg_share = FindPackageShare(package=package_name).find(package_name)
urdf_model_path = os.path.join(pkg_share, f'urdf/{urdf_name}')
#Option1: Start Gazebo server
start_gazebo_cmd = ExecuteProcess(
cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'],
output='screen')
#Option2: Start Gazebo launch file
# start_gazebo_launch = ExecuteProcess(
# cmd=['ros2', 'launch', 'gazebo_ros', 'gazebo.launch.py'],
# output='screen')
# Launch the robot
spawn_entity_cmd = Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-entity', robot_name_in_model, '-file', urdf_model_path ], output='screen')
ld.add_action(start_gazebo_cmd)
# ld.add_action(start_gazebo_launch)
ld.add_action(spawn_entity_cmd)
return ld
边栏推荐
- Software test interview question: how to prepare test data? How to prevent data pollution?
- Leetcode: 515. Find the maximum value in each tree row
- 数字经济才是未来经济发展的核心
- EEG多元模式分析预测慈善捐赠行为
- Summary: Prometheus storage
- 普通设备能不能接入TSN时间敏感网络?
- C#学习笔记----C#连接MySQL数据库
- 企业运维实践-使用Aliyun容器镜像服务对海外gcr、quay仓库镜像进行镜像拉取构建
- GBase 8c 数据库对象尺寸函数(一)
- MPLS 隧道实验
猜你喜欢
随机推荐
Oracle Rac 集群文件目录迁移
阿门的故事
牛客多校第三场A,C+权值线段树
A Tiger's Tale
周报、月报有多折磨人?万能报表模板建议收藏!(附模板)
Leetcode 2347. the best poker hand
Stock problems 5 times
HCIP第十三天笔记
Can ordinary equipment access TSN time sensitive network?
面试官:你确定Redis是单线程的进程吗?
Niuke multi School Game 3 A, c+ weight segment tree
【样式集合1】tab 栏
GBase 8c 注释信息函数
unreal ue4.27 switchboard 移植出引擎流程
Dpdk plug-in of VPP
处理数据 给数据换名字
硬件SPI与软件模拟SPI速率对比
2.2综合应用题-顺序表
阿虎的故事
Interview question 01.08. Zero matrix









