当前位置:网站首页>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
边栏推荐
- Blizzard Diablo 4 ps5 / PS4 beta added to Playstation database
- Gbase 8C general file access function
- 数据安全与隐私计算峰会-可证明安全:学习
- If you are still using WiFi, you will be out: li-fi is better!!!
- GBase 8c 注释信息函数
- VPP之DPDK插件
- Flink's real-time data analysis practice in iFLYTEK AI marketing business
- GBase 8c 事务ID和快照(五)
- 26. Abstraction and template ideas
- 抓包精灵NetCapture APP抓包教程《齐全》
猜你喜欢

【面试:并发篇28:volatile】有序性

基于 Flink CDC 实现海量数据的实时同步和转换

Niuke net question brushing training (III)

Graph theory analysis of white matter brain function network: neural markers for classification and prediction of depression

If you are still using WiFi, you will be out: li-fi is better!!!

Redis 5 种基本数据结构

"Do you" want to be a test / development programmer? We strive to sprout

Collection / container

面试官:你确定Redis是单线程的进程吗?

leetcode: 515. 在每个树行中找最大值
随机推荐
GBase 8c 快照同步函数
LeetCode第 83 场双周赛
Oracle RAC cluster file directory migration
网易云仿写
Redis 5 种基本数据结构
GBase 8c 备份控制函数(二)
学习了循环碰到了编写计算n的阶乘的题目,由此引发了一系列问题,包括一些初学者常见的坑,以及如何简化代码
HCIP第十二天笔记
IIC read / write eefprom
物企大变局时代,SRM供应商采购系统助力企业打造物业采购数字化标杆
26.抽象化和模板思想
Content bypass sharing
N32L43x Flash读\写\擦除操作总结
嵌入式经典通信协议
阿门的故事
BGP联邦实验
Gbase 8C transaction ID and snapshot (V)
Zhi Huijun, Huawei's "genius youth", has made a new work, building a "customized" smart keyboard from scratch
GBase 8c 事务ID和快照(一)
Gbase 8C transaction ID and snapshot