ROS2 nav2_turorial on win10 ERROR!

asked 2023-08-03 04:48:32 -0500

ros_wolf gravatar image

updated 2023-08-03 04:49:29 -0500

Hi, guys.

I follow the office instruction to install ROS2 on win10, and it worked. So, I move on to use NAV2.

I follow the office instruction on NAV2, and download the souce code from this repo, and colon build was good, no errors.

Since I have no robot_localization and no gazebo_ros, so I commet some code. Here is what i have changed:

import launch
from launch.substitutions import Command, LaunchConfiguration
import launch_ros
import os

def generate_launch_description():
    pkg_share = launch_ros.substitutions.FindPackageShare(package='sam_bot_description').find('sam_bot_description')
    default_model_path = os.path.join(pkg_share, 'src/description/sam_bot_description.urdf')
    default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')
    # world_path=os.path.join(pkg_share, 'world/my_world.sdf')

    robot_state_publisher_node = launch_ros.actions.Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{'robot_description': Command(
            ['xacro ', LaunchConfiguration('model')])}]
    )
    # joint_state_publisher_node = launch_ros.actions.Node(
    #     package='joint_state_publisher',
    #     executable='joint_state_publisher',
    #     name='joint_state_publisher',
    #     condition=launch.conditions.UnlessCondition(LaunchConfiguration('gui'))
    # )
    rviz_node = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d', LaunchConfiguration('rvizconfig')],
    )
    # spawn_entity = launch_ros.actions.Node(
    #     package='gazebo_ros',
    #     executable='spawn_entity.py',
    #     arguments=['-entity', 'sam_bot', '-topic', 'robot_description'],
    #     output='screen'
    # )
    # robot_localization_node = launch_ros.actions.Node(
    #     package='robot_localization',
    #     executable='ekf_node',
    #     name='ekf_filter_node',
    #     output='screen',
    #     parameters=[os.path.join(pkg_share, 'config/ekf.yaml'),
    #                 {'use_sim_time': LaunchConfiguration('use_sim_time')}]
    # )

    return launch.LaunchDescription([
        # launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
        #                                      description='Flag to enable joint_state_publisher_gui'),
        launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path,
                                             description='Absolute path to robot urdf file'),
        launch.actions.DeclareLaunchArgument(name='rvizconfig', default_value=default_rviz_config_path,
                                             description='Absolute path to rviz config file'),
        # launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='True',
        #                                      description='Flag to enable use_sim_time'),
        # launch.actions.ExecuteProcess(cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_init.so',
        #                               '-s', 'libgazebo_ros_factory.so', world_path], output='screen'),
        # joint_state_publisher_node,
        robot_state_publisher_node,
        # spawn_entity,
        # robot_localization_node,
        rviz_node
    ])

And when i run

ros2 launch sam_bot_description display.launch.py

well, errors happen.

Finished <<< sam_bot_description [2.53s]

Summary: 1 package finished [2.84s]

D:\ros2_test_ws>call install\setup.bat

D:\ros2_test_ws>ros2 launch sam_bot_description display.launch.py
[INFO] [launch]: All log files can be found below C:\Users\Long\.ros\log\2023-08-03-17-38-27-021148-DESKTOP-T4BLJGU-19644
[INFO] [launch]: Default logging verbosity is set to INFO
[ERROR] [launch]: Caught exception in launch (see debug for traceback): file not found: [WinError 2]

Well, I truely don't know what file miss.

Before I launched , I do run call install\setup.bat first.

Dose anyone can help me out? Many thanks.

edit retag flag offensive close merge delete