ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Ros2 Launch Descriptions for Turtlebot3 can't find libexec directory

asked 2022-09-23 08:59:54 -0600

uvauva gravatar image

updated 2022-09-23 12:26:26 -0600

ravijoshi gravatar image

I am a beginner when it comes to ROS 2. I was following this tutorial to create a way to automatically launch all the nodes from this tutorial. So I created a launch.py file. Below is the content of this file:

import launch
import launch_ros.actions

def generate_launch_description():
    return launch.LaunchDescription([
        # ros2 launch turtlebot3_bringup robot.launch.py use_sim_time:=False
        launch_ros.actions.Node(
            package='turtlebot3_bringup',
            executable='robot.launch.py',
            name='turtlebot_bringup',
            parameters=[{"use_sim_time": False}]
        ),
        #ros2 launch nav2_bringup navigation_launch.py use_sim_time := False
        launch_ros.actions.Node(
            package='nav2_bringup',
            executable='navigation_launch.py',
            name='turtlebot_nav2',
            parameters=[{"use_sim_time": False}]
        ),
        #ros2 launch slam_toolbox online_async_launch.py use_sim_time:=False
        launch_ros.actions.Node(
            package='slam_toolbox',
            executable='online_async_launch.py',
            name='turtlebot_slam',
            parameters=[{"use_sim_time": False}]
        ),
        #ros2 launch rosbridge_server rosbridge_websocket_launch.xml
        launch_ros.actions.Node(
            package='rosbridge_server',
            executable='rosbridge_websocket_launch.xml',
            name='turtlebot_rosbridge'
        ),
    ])

I build it successfully with colcon build but when I run it on my turtlebot3, I get the following message:

launch.substitutions.substitution_failure.SubstitutionFailure: package 'turtlebot3_bringup' found at '/home/ubuntu/turtlebot3_ws/install/turtlebot3_bringup', but libexec directory '/home/ubuntu/turtlebot3_ws/install/turtlebot3_bringup/lib/turtlebot3_bringup' does not exist

And the message is right - There is no /lib folder at all - just a /share folder. It is unclear to me what I can do about that though. If I run the bringup separately in the terminal it works - so I did install the bringup correctly:

ros2 launch turtlebot3_bringup robot.launch.py use_sim_time:=False

Can I specify the folder it needs to look for the package somewhere? So instead launch will try and run it from the share folder instead? Or is there something else that I am missing here? Maybe something in my package.xml?

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>py_launch_vrcontrols</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="joey@todo.todo">joey</maintainer>
  <license>TODO: License declaration</license>

  <test_depend>ament_copyright</test_depend>
  <test_depend>ament_flake8</test_depend>
  <test_depend>ament_pep257</test_depend>
  <test_depend>python3-pytest</test_depend>
  <depend>turtlebot3_bringup</depend>

  <export>
    <build_type>ament_python</build_type>
  </export>
</package>

Or maybe something in my setup.cfg?

[develop]
script-dir=$base/lib/py_launch_vrcontrols
[install]
install-scripts=$base/lib/py_launch_vrcontrols

I would appreciate the help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-09-24 06:20:06 -0600

ravijoshi gravatar image

In summary, you are trying to include the following commands in your launch file to automate the process:

  1. export TURTLEBOT3_MODEL=waffle
  2. ros2 launch nav2_bringup navigation_launch.py
  3. ros2 launch turtlebot3_bringup robot.launch.py
  4. ros2 launch slam_toolbox online_async_launch.py
  5. ros2 launch rosbridge_server rosbridge_websocket_launch.xml

Please use the following launch file:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""An example calling multiple launch files"""

from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch.actions import SetEnvironmentVariable


def generate_launch_description():
    # export TURTLEBOT3_MODEL=waffle
    turtlebot_model = SetEnvironmentVariable(name="TURTLEBOT3_MODEL", value=["waffle"])

    # ros2 launch nav2_bringup navigation_launch.py
    navigation_launch = IncludeLaunchDescription(
        launch_description_source=PythonLaunchDescriptionSource(
            PathJoinSubstitution(
                [
                    FindPackageShare("nav2_bringup"),
                    "launch",
                    "navigation_launch.py",
                ]
            )
        ),
    )

    # ros2 launch turtlebot3_bringup robot.launch.py
    robot_launch = IncludeLaunchDescription(
        launch_description_source=PythonLaunchDescriptionSource(
            PathJoinSubstitution(
                [
                    FindPackageShare("turtlebot3_bringup"),
                    "launch",
                    "robot.launch.py",
                ]
            )
        ),
    )

    # ros2 launch slam_toolbox online_async_launch.py
    online_launch = IncludeLaunchDescription(
        launch_description_source=PythonLaunchDescriptionSource(
            PathJoinSubstitution(
                [
                    FindPackageShare("slam_toolbox"),
                    "launch",
                    "online_async_launch.py",
                ]
            )
        ),
    )

    # ros2 launch rosbridge_server rosbridge_websocket_launch.xml 
    rosbridge_launch = IncludeLaunchDescription(
        launch_description_source=XMLLaunchDescriptionSource(
            PathJoinSubstitution(
                [
                    FindPackageShare("rosbridge_server"),
                    "launch",
                    "rosbridge_websocket_launch.xml",
                ]
            )
        ),
    )

    ld = LaunchDescription()
    ld.add_action(turtlebot_model)
    ld.add_action(navigation_launch)
    ld.add_action(robot_launch)
    ld.add_action(online_launch)
    ld.add_action(rosbridge_launch)
    return ld

Please read "Creating a launch file" for more information.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-09-23 08:59:54 -0600

Seen: 709 times

Last updated: Sep 24 '22