-
Notifications
You must be signed in to change notification settings - Fork 61
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
Comments
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() But there is one point that the vehicle will not stop when it reaches the terminal. Is there no consideration here? |
What do you mean? |
That means the vehicle did not stop after reaching the destination. |
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. |
Uh oh!
There was an error while loading. Please reload this page.
Hello, how should this gazebo problem be solved. I failed to activate it:
ros2 launch launches click_launch.py
Just start gazebo is normal.
The text was updated successfully, but these errors were encountered: