当前位置:网站首页>Common modules of ros2 launch files
Common modules of ros2 launch files
2022-07-28 01:57: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
边栏推荐
- What devices does devicexplorer OPC server support? This article has listed
- Real time synchronization and conversion of massive data based on Flink CDC
- 物企大变局时代,SRM供应商采购系统助力企业打造物业采购数字化标杆
- GBase 8c 配置设置函数
- Stock problems 5 times
- The storage cost is reduced by 80%. How does the cost management of youzan data middle office do?
- ue4 unreal NDisplay插件 简易使用 三折幕 详细...
- ros2 launch文件常用模块
- 学习了循环碰到了编写计算n的阶乘的题目,由此引发了一系列问题,包括一些初学者常见的坑,以及如何简化代码
- Gbase 8C transaction ID and snapshot (V)
猜你喜欢
随机推荐
Brushes and brushes
写给去不图床用户的一封信
GBase 8c 备份控制函数(四)
Gbase 8C transaction ID and snapshot
2022软件测试技能 Robotframework + SeleniumLibrary + Jenkins web关键字驱动自动化实战教程
Linux系统彻底删除Mysql
什么是方法,什么是方法论:了解自我精进提升的底层逻辑
leetcode: 515. 在每个树行中找最大值
Gbase 8C configuration setting function
数商云供应链集采管理系统解决方案:集采系统管理模式,数字化管控企业物资
Load balancing SLB
Content bypass sharing
Niuke net question brushing training (III)
Gbase 8C annotation information function
在生产型企业中,MES系统有哪些重要应用
Custom events
Leetcode high frequency question 128. the longest continuous sequence, which is often tested in interviews with Internet companies
网易云仿写
Real time data warehouse: meituan's real-time data warehouse construction practice
以“数字化渠道”撬动家用电器消费蓝海,经销商在线系统让企业生意更进一步









