forked from zbw/yiliao2026
改了一下ekf的源码,让odom不再完全相信轮式里程计;手贱删了个.git里的文件导致文件全部重新存,看不了diff了
This commit is contained in:
Binary file not shown.
@@ -1,47 +0,0 @@
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch.conditions import IfCondition, UnlessCondition
|
||||
import launch_ros.actions
|
||||
|
||||
def generate_launch_description():
|
||||
akmcar = LaunchConfiguration('akmcar', default='false')
|
||||
|
||||
robot_parameters = [
|
||||
{'usart_port_name': '/dev/ttyACM0',
|
||||
'serial_baud_rate': 115200,
|
||||
'robot_frame_id': 'base_link',
|
||||
'odom_frame_id': 'odom',
|
||||
'cmd_vel': 'cmd_vel',
|
||||
'product_number': 0}
|
||||
]
|
||||
|
||||
return LaunchDescription([
|
||||
DeclareLaunchArgument(
|
||||
'akmcar',
|
||||
default_value='false',
|
||||
description='Use simulation (Gazebo) clock if true'
|
||||
),
|
||||
|
||||
launch_ros.actions.Node(
|
||||
condition=IfCondition(akmcar),
|
||||
package='origincar_base',
|
||||
executable='origincar_base_node',
|
||||
parameters=robot_parameters + [{'akm_cmd_vel': 'ackermann_cmd'}],
|
||||
remappings=[('/cmd_vel', 'cmd_vel')],
|
||||
),
|
||||
|
||||
launch_ros.actions.Node(
|
||||
condition=IfCondition(akmcar),
|
||||
package='origincar_base',
|
||||
executable='cmd_vel_to_ackermann_drive.py',
|
||||
name='cmd_vel_to_ackermann_drive',
|
||||
),
|
||||
|
||||
launch_ros.actions.Node(
|
||||
condition=UnlessCondition(akmcar),
|
||||
package='origincar_base',
|
||||
executable='origincar_base_node',
|
||||
parameters=robot_parameters + [{'akm_cmd_vel': 'none'}],
|
||||
)
|
||||
])
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import launch
|
||||
import launch_ros
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch_ros.actions import Node
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
package_name = 'origincar_base'
|
||||
ld = launch.LaunchDescription()
|
||||
pkg_share = launch_ros.substitutions.FindPackageShare(package=package_name).find(package_name)
|
||||
robot_localization_file_path = os.path.join(pkg_share, 'config/ekf.yaml')
|
||||
use_sim_time = LaunchConfiguration('use_sim_time')
|
||||
|
||||
# Start robot localization using an Extended Kalman filter
|
||||
robot_localization_node = Node(
|
||||
package='robot_localization',
|
||||
executable='ekf_node',
|
||||
name='ekf_filter_node',
|
||||
output='screen',
|
||||
remappings=[("odometry/filtered", "odom_combined")],
|
||||
parameters=[
|
||||
robot_localization_file_path,
|
||||
{'use_sim_time': use_sim_time}
|
||||
])
|
||||
|
||||
ld.add_action(launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='false',
|
||||
description='Flag to disable use_sim_time'))
|
||||
ld.add_action(robot_localization_node)
|
||||
return ld
|
||||
@@ -1,99 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import launch
|
||||
from launch.actions import SetEnvironmentVariable
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import (DeclareLaunchArgument, GroupAction,
|
||||
IncludeLaunchDescription, SetEnvironmentVariable)
|
||||
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||||
from launch.substitutions import LaunchConfiguration, PythonExpression
|
||||
from launch_ros.actions import PushRosNamespace
|
||||
import launch_ros.actions
|
||||
from launch.conditions import UnlessCondition
|
||||
|
||||
def generate_launch_description():
|
||||
# Get the launch directory
|
||||
bringup_dir = get_package_share_directory('origincar_base')
|
||||
launch_dir = os.path.join(bringup_dir, 'launch')
|
||||
ekf_config = Path(get_package_share_directory('origincar_base'), 'config', 'ekf.yaml')
|
||||
imu_config = Path(get_package_share_directory('origincar_base'), 'config', 'imu.yaml')
|
||||
|
||||
|
||||
carto_slam = LaunchConfiguration('carto_slam', default='false')
|
||||
carto_slam_dec = DeclareLaunchArgument('carto_slam',default_value='false')
|
||||
|
||||
akmcar = LaunchConfiguration('akmcar', default='true')
|
||||
akmcar_dec = DeclareLaunchArgument('akmcar', default_value='true',
|
||||
description='阿克曼底盘模式 (true=阿克曼, false=差速)')
|
||||
|
||||
origincar_base = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'base_serial.launch.py')),
|
||||
launch_arguments={'akmcar': akmcar}.items(),
|
||||
)
|
||||
|
||||
choose_car = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(os.path.join(launch_dir, 'robot_mode_description.launch.py')),
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
base_to_gyro = launch_ros.actions.Node(
|
||||
package='tf2_ros',
|
||||
executable='static_transform_publisher',
|
||||
name='base_to_gyro',
|
||||
arguments=['0', '0', '0','0', '0','0','base_footprint','gyro_link'],
|
||||
)
|
||||
|
||||
link_to_laser = launch_ros.actions.Node(
|
||||
package='tf2_ros',
|
||||
executable='static_transform_publisher',
|
||||
name='link_to_laser',
|
||||
arguments=['0', '0', '0','0', '0','0','base_link','laser'],
|
||||
)
|
||||
|
||||
imu_filter_node = launch_ros.actions.Node(
|
||||
package='imu_filter_madgwick',
|
||||
executable='imu_filter_madgwick_node',
|
||||
parameters=[imu_config]
|
||||
)
|
||||
|
||||
robot_ekf = launch_ros.actions.Node(
|
||||
condition=UnlessCondition(carto_slam),
|
||||
package='robot_localization',
|
||||
executable='ekf_node',
|
||||
parameters=[ekf_config],
|
||||
remappings=[("odometry/filtered", "odom_combined")]
|
||||
)
|
||||
|
||||
# 从 URDF 生成 robot_description,供 joint_state_publisher 和 robot_state_publisher 共用
|
||||
from launch_ros.parameter_descriptions import ParameterValue
|
||||
from launch.substitutions import Command
|
||||
|
||||
robot_description = ParameterValue(
|
||||
Command(['xacro ', os.path.join(
|
||||
get_package_share_directory('origincar_description'),
|
||||
'urdf', 'origincar.urdf')]),
|
||||
value_type=str)
|
||||
|
||||
joint_state_publisher_node = launch_ros.actions.Node(
|
||||
package='joint_state_publisher',
|
||||
executable='joint_state_publisher',
|
||||
name='joint_state_publisher',
|
||||
parameters=[{'robot_description': robot_description}],
|
||||
)
|
||||
|
||||
ld = LaunchDescription()
|
||||
|
||||
ld.add_action(carto_slam_dec)
|
||||
ld.add_action(akmcar_dec)
|
||||
ld.add_action(origincar_base)
|
||||
ld.add_action(base_to_gyro)
|
||||
ld.add_action(joint_state_publisher_node)
|
||||
ld.add_action(choose_car)
|
||||
ld.add_action(imu_filter_node)
|
||||
ld.add_action(robot_ekf)
|
||||
|
||||
return ld
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import os
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
from launch import LaunchDescription
|
||||
from launch_ros.actions import Node
|
||||
from launch_ros.parameter_descriptions import ParameterValue
|
||||
from launch.substitutions import Command
|
||||
|
||||
|
||||
def generate_launch_description():
|
||||
urdf_path = os.path.join(
|
||||
get_package_share_directory('origincar_description'),
|
||||
'urdf', 'origincar.urdf')
|
||||
|
||||
robot_description = ParameterValue(
|
||||
Command(['xacro ', urdf_path]), value_type=str)
|
||||
|
||||
robot_state_publisher = Node(
|
||||
package='robot_state_publisher',
|
||||
executable='robot_state_publisher',
|
||||
name='robot_state_publisher',
|
||||
parameters=[{'robot_description': robot_description,
|
||||
'publish_frequency': 30.0}],
|
||||
)
|
||||
|
||||
ld = LaunchDescription()
|
||||
ld.add_action(robot_state_publisher)
|
||||
return ld
|
||||
Reference in New Issue
Block a user