小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
ros2 humble 启动cartographer时报错
-
以下是完整日志
ros2 launch cartographer_ros backpack_2d.launch.py
[INFO] [launch]: All log files can be found below /home/car/.ros/log/2024-11-13-11-42-38-270208-car-Default-string-9546
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [9547]
[INFO] [cartographer_node-2]: process started with pid [9549]
[INFO] [cartographer_occupancy_grid_node-3]: process started with pid [9551]
[robot_state_publisher-1] [INFO] [1731469358.389759210] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1731469358.389866857] [robot_state_publisher]: got segment horizontal_laser_link
[robot_state_publisher-1] [INFO] [1731469358.389880218] [robot_state_publisher]: got segment imu_link
[robot_state_publisher-1] [INFO] [1731469358.389887854] [robot_state_publisher]: got segment vertical_laser_link
[cartographer_node-2] [INFO] [1731469358.416490372] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer_ros/share/cartographer_ros/configuration_files/backpack_2d.lua' for 'backpack_2d.lua'.
[cartographer_node-2] [INFO] [1731469358.416747794] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'.
[cartographer_node-2] [INFO] [1731469358.416769722] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'.
[cartographer_node-2] [INFO] [1731469358.416812053] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'.
[cartographer_node-2] [INFO] [1731469358.416827168] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'.
[cartographer_node-2] [INFO] [1731469358.416993582] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder.lua' for 'trajectory_builder.lua'.
[cartographer_node-2] [INFO] [1731469358.417034883] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder.lua' for 'trajectory_builder.lua'.
[cartographer_node-2] [INFO] [1731469358.417085755] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder_2d.lua' for 'trajectory_builder_2d.lua'.
[cartographer_node-2] [INFO] [1731469358.417109857] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder_2d.lua' for 'trajectory_builder_2d.lua'.
[cartographer_node-2] [INFO] [1731469358.417256460] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder_3d.lua' for 'trajectory_builder_3d.lua'.
[cartographer_node-2] [INFO] [1731469358.417280135] [cartographer logger]: I1113 11:42:38.000000 9549 configuration_file_resolver.cc:41] Found '/home/car/robot/cartogra/install/cartographer/share/cartographer/configuration_files/trajectory_builder_3d.lua' for 'trajectory_builder_3d.lua'.
[cartographer_node-2] [INFO] [1731469358.430782354] [cartographer logger]: I1113 11:42:38.000000 9549 map_builder_bridge.cpp:136] Added trajectory with ID '0'.
[cartographer_node-2] F1113 11:42:38.435479 9549 sensor_bridge.cpp:33] Check failed: frame_id[0] != '/' ('/' vs. '/') The frame_id /imu_link should not start with a /. See 1.7 in http://wiki.ros.org/tf2/Migration.
[cartographer_node-2] [FATAL] [1731469358.435784782] [cartographer logger]: F1113 11:42:38.000000 9549 sensor_bridge.cpp:33] Check failed: frame_id[0] != '/' ('/' vs. '/') The frame_id /imu_link should not start with a /. See 1.7 in http://wiki.ros.org/tf2/Migration.
[cartographer_node-2] *** Check failure stack trace: ***
[cartographer_node-2] @ 0x7475f7034b03 google::LogMessage::Fail()
[cartographer_node-2] @ 0x7475f703c9d1 google::LogMessage::SendToLog()
[cartographer_node-2] @ 0x7475f70347c2 google::LogMessage::Flush()
[cartographer_node-2] @ 0x7475f703678f google::LogMessageFatal::~LogMessageFatal()
[cartographer_node-2] @ 0x59e4dcf94608 cartographer_ros::(anonymous namespace)::CheckNoLeadingSlash()
[cartographer_node-2] @ 0x59e4dcf9520e cartographer_ros::SensorBridge::ToImuData()
[cartographer_node-2] @ 0x59e4dcd407c3 cartographer_ros::Node::HandleImuMessage()
[cartographer_node-2] @ 0x59e4dcd41d6b ZZN16cartographer_ros12_GLOBAL__N_120SubscribeWithHandlerIN11sensor_msgs3msg4Imu_ISaIvEEEEESt10shared_ptrIN6rclcpp16SubscriptionBaseEEMNS_4NodeEFviRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNT_14ConstSharedPtrEEiSJ_S7_INS8_4NodeEEPSB_ENKUlS7_IKS6_EE_clESU
[cartographer_node-2] @ 0x59e4dcd5706c ZSt13__invoke_implIvRZN16cartographer_ros12_GLOBAL__N_120SubscribeWithHandlerIN11sensor_msgs3msg4Imu_ISaIvEEEEESt10shared_ptrIN6rclcpp16SubscriptionBaseEEMNS0_4NodeEFviRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNT_14ConstSharedPtrEEiSK_S8_INS9_4NodeEEPSC_EUlS8_IKS7_EE_JSV_EESL_St14__invoke_otherOT0_DpOT1
[cartographer_node-2] @ 0x59e4dcd55085 ZSt10__invoke_rIvRZN16cartographer_ros12_GLOBAL__N_120SubscribeWithHandlerIN11sensor_msgs3msg4Imu_ISaIvEEEEESt10shared_ptrIN6rclcpp16SubscriptionBaseEEMNS0_4NodeEFviRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNT_14ConstSharedPtrEEiSK_S8_INS9_4NodeEEPSC_EUlS8_IKS7_EE_JSV_EENSt9enable_ifIX16is_invocable_r_vISL_T0_DpT1_EESL_E4typeEOSZ_DpOS10
[cartographer_node-2] @ 0x59e4dcd523e5 ZNSt17_Function_handlerIFvSt10shared_ptrIKN11sensor_msgs3msg4Imu_ISaIvEEEEEZN16cartographer_ros12_GLOBAL__N_120SubscribeWithHandlerIS5_EES0_IN6rclcpp16SubscriptionBaseEEMNS9_4NodeEFviRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNT_14ConstSharedPtrEEiSN_S0_INSC_4NodeEEPSF_EUlS7_E_E9_M_invokeERKSt9_Any_dataOS7
[cartographer_node-2] @ 0x59e4dcf623b9 std::function<>::operator()()
[cartographer_node-2] @ 0x59e4dcf3dd09 ZZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEES4_E8dispatchESt10shared_ptrIS5_ERKNS_11MessageInfoEENKUlOT_E_clIRSt8functionIFvS7_IKS5_EEEEEDaSD
[cartographer_node-2] @ 0x59e4dcf705df ZSt13__invoke_implIvZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEES5_E8dispatchESt10shared_ptrIS6_ERKNS0_11MessageInfoEEUlOT_E_JRSt8functionIFvS8_IKS6_EEEEESD_St14__invoke_otherOT0_DpOT1
[cartographer_node-2] @ 0x59e4dcf62826 ZSt8__invokeIZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEES5_E8dispatchESt10shared_ptrIS6_ERKNS0_11MessageInfoEEUlOT_E_JRSt8functionIFvS8_IKS6_EEEEENSt15__invoke_resultISD_JDpT0_EE4typeESE_DpOSN
[cartographer_node-2] @ 0x59e4dcf3e6c9 ZNSt8__detail9__variant17__gen_vtable_implINS0_12_Multi_arrayIPFNS0_21__deduce_visit_resultIvEEOZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEESA_E8dispatchESt10shared_ptrISB_ERKNS5_11MessageInfoEEUlOT_E_RSt7variantIJSt8functionIFvRKSB_EESN_IFvSP_SH_EESN_IFvRKNS5_17SerializedMessageEEESN_IFvSW_SH_EESN_IFvSt10unique_ptrISB_St14default_deleteISB_EEEESN_IFvS14_SH_EESN_IFvS11_ISU_S12_ISU_EEEESN_IFvS1A_SH_EESN_IFvSD_ISO_EEESN_IFvS1F_SH_EESN_IFvSD_ISV_EEESN_IFvS1K_SH_EESN_IFvRKS1F_EESN_IFvS1Q_SH_EESN_IFvRKS1K_EESN_IFvS1W_SH_EESN_IFvSE_EESN_IFvSE_SH_EESN_IFvSD_ISU_EEESN_IFvS25_SH_EEEEEJEEESt16integer_sequenceImJLm8EEEE14__visit_invokeESL_S2B
[cartographer_node-2] @ 0x59e4dcf3ec3f ZSt10__do_visitINSt8__detail9__variant21__deduce_visit_resultIvEEZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEES9_E8dispatchESt10shared_ptrISA_ERKNS4_11MessageInfoEEUlOT_E_JRSt7variantIJSt8functionIFvRKSA_EESL_IFvSN_SG_EESL_IFvRKNS4_17SerializedMessageEEESL_IFvSU_SG_EESL_IFvSt10unique_ptrISA_St14default_deleteISA_EEEESL_IFvS12_SG_EESL_IFvSZ_ISS_S10_ISS_EEEESL_IFvS18_SG_EESL_IFvSC_ISM_EEESL_IFvS1D_SG_EESL_IFvSC_IST_EEESL_IFvS1I_SG_EESL_IFvRKS1D_EESL_IFvS1O_SG_EESL_IFvRKS1I_EESL_IFvS1U_SG_EESL_IFvSD_EESL_IFvSD_SG_EESL_IFvSC_ISS_EEESL_IFvS23_SG_EEEEEEDcOT0_DpOT1
[cartographer_node-2] @ 0x59e4dcf3eca6 ZSt5visitIZN6rclcpp23AnySubscriptionCallbackIN11sensor_msgs3msg4Imu_ISaIvEEES5_E8dispatchESt10shared_ptrIS6_ERKNS0_11MessageInfoEEUlOT_E_JRSt7variantIJSt8functionIFvRKS6_EESH_IFvSJ_SC_EESH_IFvRKNS0_17SerializedMessageEEESH_IFvSQ_SC_EESH_IFvSt10unique_ptrIS6_St14default_deleteIS6_EEEESH_IFvSY_SC_EESH_IFvSV_ISO_SW_ISO_EEEESH_IFvS14_SC_EESH_IFvS8_ISI_EEESH_IFvS19_SC_EESH_IFvS8_ISP_EEESH_IFvS1E_SC_EESH_IFvRKS19_EESH_IFvS1K_SC_EESH_IFvRKS1E_EESH_IFvS1Q_SC_EESH_IFvS9_EESH_IFvS9_SC_EESH_IFvS8_ISO_EEESH_IFvS1Z_SC_EEEEEENSt13invoke_resultISD_JDpNSt11conditionalIX21is_lvalue_reference_vIT0_EERNSt19variant_alternativeILm0ENSt16remove_referenceIDTcl4__ascl7declvalIS28_EEEEE4typeEE4typeEOS2F_E4typeEEE4typeESE_DpOS28
[cartographer_node-2] @ 0x59e4dcf2960e rclcpp::AnySubscriptionCallback<>::dispatch()
[cartographer_node-2] @ 0x59e4dcf1b347 rclcpp::Subscription<>::handle_message()
[cartographer_node-2] @ 0x7475f732a88c rclcpp::Executor::execute_subscription()
[cartographer_node-2] @ 0x7475f732b08f rclcpp::Executor::execute_any_executable()
[cartographer_node-2] @ 0x7475f7332980 rclcpp::executors::SingleThreadedExecutor::spin()
[cartographer_node-2] @ 0x7475f7332b95 rclcpp::spin()
[cartographer_node-2] @ 0x7475f7332c8f rclcpp::spin()
[cartographer_node-2] @ 0x59e4dcd31014 cartographer_ros::(anonymous namespace)::Run()
[cartographer_node-2] @ 0x59e4dcd3143e main
[cartographer_node-2] @ 0x7475f6029d90 (unknown)
[cartographer_node-2] @ 0x7475f6029e40 __libc_start_main
[cartographer_node-2] @ 0x59e4dcd30cf5 _start
[ERROR] [cartographer_node-2]: process has died [pid 9549, exit code -6, cmd '/home/car/robot/cartogra/install/cartographer_ros/lib/cartographer_ros/cartographer_node -configuration_directory /home/car/robot/cartogra/install/cartographer_ros/share/cartographer_ros/configuration_files -configuration_basename backpack_2d.lua --ros-args --params-file /tmp/launch_params_f90inaxe -r echoes:=horizontal_laser_2d']. -
从您提供的日志中可以看到,Cartographer 在启动时遇到了一个致命错误(FATAL),导致进程崩溃。错误消息指出:
Check failed: frame_id[0] != '/' ('/' vs. '/') The frame_id /imu_link should not start with a /. See 1.7 in http://wiki.ros.org/tf2/Migration.
这个错误表明在 Cartographer 的配置中,IMU 的
frame_id
被设置为了/imu_link
,而根据 ROS 2 的 tf2 库的要求,frame_id 不应该以斜杠(/
)开头。这是因为在 ROS 2 中,tf2 的 frame_id 应该是一个简单的标识符,而不包含任何前导斜杠。要解决这个问题,您需要检查并修改 Cartographer 的配置文件,确保所有引用的 frame_id 都符合 ROS 2 的要求。具体步骤如下:
-
定位配置文件:
打开您的 Cartographer 配置文件,通常是在cartographer_ros/share/cartographer_ros/configuration_files/
目录下,如backpack_2d.lua
。 -
修改 frame_id:
在配置文件中,找到所有引用imu_link
的地方,并将其从/imu_link
改为imu_link
(去掉前导斜杠)。 -
保存并重新运行:
保存修改后的配置文件,并重新尝试启动 Cartographer。
例如,如果您的配置文件中有一行类似于:
tracking_from_imu_frame = "/imu_link"
您应该将其修改为:
tracking_from_imu_frame = "imu_link"
确保所有相关的 frame_id 都进行了类似的修改。
修改后,再次尝试启动 Cartographer,看看问题是否得到解决。如果仍然遇到问题,可能需要检查其他配置或日志输出以获取更多信息。
以上为生成回答,仅供参考~
-
-
@小伊 options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map",
tracking_frame = "imu_link",
published_frame = "base_link",
odom_frame = "odom",
provide_odom_frame = false,
没有使用/ -
在您提供的配置选项中,我们看到了一些与机器人地图构建和轨迹跟踪相关的参数。这些参数通常用于配置SLAM(Simultaneous Localization and Mapping,即同时定位与地图构建)系统,比如Google Cartographer。下面是对这些参数的解释:
-
map_builder:
MAP_BUILDER
是一个指向地图构建器配置的引用。地图构建器负责根据传感器的输入数据(如激光雷达或深度相机数据)来构建环境的地图。 -
trajectory_builder:
TRAJECTORY_BUILDER
是一个指向轨迹构建器配置的引用。轨迹构建器负责根据传感器数据实时构建机器人的运动轨迹,并尝试将这些轨迹与已有的地图进行对齐。 -
map_frame:
"map"
是地图参考框架的名称。在SLAM系统中,所有地图相关的数据(如地图中的点、线等)都会以这个框架为参考。 -
tracking_frame:
"imu_link"
是跟踪框架的名称,通常用于表示机器人上IMU(惯性测量单元)的位置。IMU提供关于机器人运动(如加速度和角速度)的数据,这对于准确的轨迹估计非常重要。 -
published_frame:
"base_link"
是发布的框架名称,通常表示机器人的基座或主体。所有基于机器人当前位置和姿态的信息(如里程计数据、传感器数据等)都会以这个框架为参考进行发布。 -
odom_frame:
"odom"
是里程计参考框架的名称。在SLAM系统开始工作之前,通常会通过轮式编码器或其他传感器数据来估计机器人的运动,这些数据会在这个框架下发布。 -
provide_odom_frame:
false
表示SLAM系统不会提供或更新名为odom
的里程计框架。如果设置为true
,SLAM系统会根据构建的地图和轨迹来估计和发布里程计数据。由于这里设置为false
,意味着可能已经有其他系统(如轮式编码器)负责提供里程计数据,或者在这个配置中不需要里程计数据。
请注意,配置中的
"没有使用/"
部分可能是配置文件的注释或者是一个不完整的参数行。在实际应用中,确保配置文件的完整性和正确性对于系统的正常运行至关重要。
以上为生成回答,仅供参考~
-