Skip to content

gazebo problem #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chan-yuu opened this issue May 13, 2025 · 4 comments
Open

gazebo problem #9

chan-yuu opened this issue May 13, 2025 · 4 comments

Comments

@chan-yuu
Copy link

chan-yuu commented May 13, 2025

[rviz2-5] [INFO] [1747117997.581670703] [rviz2]: Trying to create a map of size 500 x 500 using 1 swatches
[ros2-3] Set parameter successful
[INFO] [ros2-3]: process has finished cleanly [pid 193999]
[gzclient   -2] gzclient: /usr/include/boost/smart_ptr/shared_ptr.hpp:734:typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = gazebo::rendering::Camera; typename boost::detail::sp_member_access<T>::type = gazebo::rendering::Camera*]: hypothesis ‘px != 0’ failed。
[gzclient   -2] Aborted (core dumped)
[ERROR] [gzclient   -2]: process has died [pid 193996, exit code 134, cmd 'gzclient   '].

Hello, how should this gazebo problem be solved. I failed to activate it:
ros2 launch launches click_launch.py
Just start gazebo is normal.

@chan-yuu
Copy link
Author

chan-yuu commented May 13, 2025

I modified the launch file a little bit.

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument, ExecuteProcess

def generate_launch_description():
    navpkg = 'autocar_nav'
    gzpkg = 'autocar_gazebo'
    descpkg = 'autocar_description'
    mappkg = 'autocar_map'

    # 世界文件、URDF 和 RViz 配置文件路径
    world = os.path.join(get_package_share_directory(gzpkg), 'worlds', 'autocar.world')
    urdf = os.path.join(get_package_share_directory(descpkg), 'urdf', 'autocar.xacro')
    rviz = os.path.join(get_package_share_directory(descpkg), 'rviz', 'view.rviz')
    
    # 导航参数文件路径
    navconfig = os.path.join(get_package_share_directory(navpkg), 'config', 'navigation_params.yaml')

    # 仿真时间参数
    use_sim_time = LaunchConfiguration('use_sim_time', default='True')

    return LaunchDescription([
        # 直接启动 Gazebo,加载世界文件和 ROS 插件
        ExecuteProcess(
            cmd=[
                'gazebo',
                '--verbose',
                world,
                '-s', 'libgazebo_ros_init.so',
                '-s', 'libgazebo_ros_factory.so',
                '-s', 'libgazebo_ros_force_system.so'
            ],
            output='screen'
        ),

        # 设置 Gazebo 的 use_sim_time 参数
        ExecuteProcess(
            cmd=['ros2', 'param', 'set', '/gazebo', 'use_sim_time', use_sim_time],
            output='screen'
        ),

        # 声明 use_sim_time 参数
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use simulation (Gazebo) clock if true'
        ),

        # 机器人状态发布节点
        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            name='robot_state_publisher',
            output='screen',
            parameters=[{'use_sim_time': use_sim_time}],
            arguments=[urdf]
        ),

        # RViz 可视化节点
        Node(
            package='rviz2',
            executable='rviz2',
            name='rviz2',
            arguments=['-d', rviz],
            output='screen'
        ),

        # 定位节点
        Node(
            package=navpkg,
            name='localisation',
            executable='localisation.py',
            parameters=[navconfig]
        ),

        # BOF 节点
        Node(
            package=mappkg,
            name='bof',
            executable='bof'
        ),

        # 点击规划节点
        Node(
            package=navpkg,
            name='click_planner',
            executable='clickplanner.py',
            parameters=[navconfig]
        ),

        # 路径跟踪节点
        Node(
            package=navpkg,
            name='path_tracker',
            executable='tracker.py',
            parameters=[navconfig]
        )
    ])

def main():
    generate_launch_description()

if __name__ == '__main__':
    main()

Image

But there is one point that the vehicle will not stop when it reaches the terminal. Is there no consideration here?

@winstxnhdw
Copy link
Owner

But there is one point that the vehicle will not stop when it reaches the terminal.

What do you mean?

@chan-yuu
Copy link
Author

That means the vehicle did not stop after reaching the destination.

@winstxnhdw
Copy link
Owner

winstxnhdw commented May 14, 2025

Yes, it's not meant to stop. You'll have to write your own tracker to do that. The tracker here is meant to be continuous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants