how to run the world of gazebo and robot separately?
I use Ubuntu 20.04, ROS2 Foxy, Gazebo11
Hi, everyone.
I'm trying to run gazebo.launch.py and robot.launch.py
gazebo.launch.py
def generate_launch_description():
gazebo_ros_pkg = get_package_share_directory('gazebo_ros')
gazebo = IncludeLaunchDescription(PythonLaunchDescriptionSource(os.path.join(gazebo_ros_pkg, 'launch', 'gazebo.launch.py')))
return LaunchDescription([
gazebo,
])
robot.launch.py
def generate_launch_description():
use_sim_time = LaunchConfiguration('use_sim_time', default='true')
description_pkg = get_package_share_directory('robot_description')
xacro_file = PathJoinSubstitution([description_pkg, 'urdf', 'robot.urdf.xacro'])
robot_description = ParameterValue(Command(['xacro', ' ', xacro_file]), value_type=str)
robot_state_publisher_node = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
parameters=[{'robot_description' : robot_description},
{'use_sim_time' : use_sim_time},
{'publish_frequency' : 30.0}],
output='screen',
)
spawn_node = Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-topic', {"robot_description": robot_description}, "-entity", "robot", "-x", "0.0", "-y", "0.0", "-z", "0.0"],
output='screen',
)
I see endless loading and nothing else, but if I copy/paste the gazebo config into robot.launch.py everything loads fine. Help me, please.
instead of
can you try to add
Also in your robot.launch i am assuming there is a return launch description.