Skip to content

ROS2 launch not working #329

@fneufken

Description

@fneufken

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

Hi all,

I am a newcomer to ROS2 and did some work on Ubuntu devices but now I want to work on a Windows device. I installed everything correctly, made a simple node to test if everything works. I am planning to use a launch file to launch all nodes so I made one launching my simple node. However, this is were everything stops working. The process for the node is started but this is the only thing happening.
To create the launch file, I followed this tutorial: Create a Launch File.

The node:

import rclpy
from rclpy.node import Node

import time
from djitellopy import TelloSwarm

class TestNode(Node):
    def __init__(self):
        super().__init__('test_node_1')
        self.get_logger().info('TestNode has been initialized.')

        
def main(args=None):
    rclpy.init(args=args)
    node = TestNode()
    rclpy.spin(node)
    rclpy.shutdown()

if __name__ == '__main__':
     main()

The setup.py of the package of the node:

from setuptools import find_packages, setup

package_name = 'custom_nodes'

setup(
    name=package_name,
    version='0.0.0',
    packages=find_packages(exclude=['test']),
    data_files=[
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    description='TODO: Package description',
    license='TODO: License declaration',
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'test_node = custom_nodes.test_node:main',
        ],
    },
)

The launch file:


from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='custom_nodes',
            executable='test_node',
            name='test_node_1',
            output='screen',
        ),
    ])

I also added the exec_depend for the package of the nodes to the package.xml for the launch folder and added the install to the CMakeLists.txt.

Why does using ros2 launch not correctly launch the node?

If additional information is needed, please let me know.

Installed packages

See attached file

pixi_list.txt

Environment info

System
------------
       Pixi version: 0.50.0
           Platform: win-64
   Virtual packages: __win=10.0.26100=0
                   : __cuda=11.7=0
                   : __archspec=1=skylake
          Cache dir: C:\Users\flor_\AppData\Local\rattler\cache
       Auth storage: C:\Users\flor_\.rattler\credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: C:\Users\flor_\.pixi\bin
    Environment dir: C:\Users\flor_\.pixi\envs
       Manifest dir: C:\Users\flor_\.pixi\manifests\pixi-global.toml

Workspace
------------
               Name: ros2_project
            Version: 0.1.0
      Manifest file: C:\Users\flor_\OneDrive\Bureaublad\School\CompSci\Master\Thesis\Implementation\ros2_project\pixi.toml
       Last updated: 27-07-2025 20:27:52

Environments
------------
        Environment: default
           Features: default
           Channels: robostack-humble, conda-forge
   Dependency count: 20
       Dependencies: ros-humble-desktop, ros-humble-turtlesim, colcon-common-extensions, setuptools, ros-humble-diagnostic-updater, ros-humble-geographic-msgs, geographiclib, geographiclib-cpp, numpy, python, python-devtools, pybind11, pybind11-abi, ros-humble-robot-localization, ros-humble-desktop-full, ros-humble-ament-cmake-auto, compilers, pkg-config, cmake, ninja
  PyPI Dependencies: djitellopy, rosdep
   Target platforms: win-64
    Prefix location: C:\Users\flor_\OneDrive\Bureaublad\School\CompSci\Master\Thesis\Implementation\ros2_project\.pixi\envs\default
              Tasks: cmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions