使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了
-
@yuan 在 使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了 中说:
IMU_TOPIC = ros_utils::readParamstd::string(*node, "imu_topic");
IMU_NAME = ros_utils::readParamstd::string(*node, "imu_name");
data_save_path = ros_utils::readParamstd::string(*node, "data_save_path");
max_time_min = ros_utils::readParam<int>(*node, "max_time_min");
max_cluster = ros_utils::readParam<int>(*node, "max_cluster");应该是这里报错,都没获取到参数
-
@yuan 在 使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了 中说:
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
what(): could not create subscription: rcl node's context is invalid, at ./src/rcl/node.c:428不过看这个错误是没有 rclcpp_init()
-
@yuan 用gdb,debug下,看看挂在了哪一行
-
此回复已被删除! -
此回复已被删除! -
@小鱼 ```
Starting program: /home/ysh/ros2_ws/install/imu_utils/lib/imu_utils/imu_an --ros-args --params-file /home/ysh/ros2_ws/src/param.yaml
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4dff640 (LWP 126145)]
[New Thread 0x7ffff45fe640 (LWP 126146)]
[New Thread 0x7ffff3dfd640 (LWP 126147)]
[New Thread 0x7ffff35fc640 (LWP 126148)]
[New Thread 0x7ffff2dfb640 (LWP 126149)]
[New Thread 0x7ffff25fa640 (LWP 126150)]
[New Thread 0x7ffff1df9640 (LWP 126151)]
[New Thread 0x7ffff15f8640 (LWP 126152)]
[New Thread 0x7ffff0df7640 (LWP 126153)]
[INFO] [1722937129.258907543] [n]: Waiting for IMU data...
[ERROR] [1722937129.259067701] [n]: Failed to load imu_topic
[ERROR] [1722937129.259904065] [n]: Failed to load imu_name
[ERROR] [1722937129.259961287] [n]: Failed to load data_save_path
[ERROR] [1722937129.260008229] [n]: Failed to load max_time_min
[ERROR] [1722937129.260054711] [n]: Failed to load max_cluster
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
what(): could not create subscription: rcl node's context is invalid, at ./src/rcl/node.c:428
[Thread 0x7ffff4dff640 (LWP 126145) exited]Thread 1 "imu_an" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737322031168) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: 没有那个文件或目录. -
@yuan 在 使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了 中说:
ros_utils::readParamstd::string
这个函数怎么写的
-
此回复已被删除! -
template< typename T > T readParam( rclcpp::Node& n, std::string name ) { T ans; if ( n.get_parameter( name, ans ) ) { RCLCPP_INFO_STREAM(n.get_logger(), "Loaded " << name << ": " << ans ); } else { RCLCPP_ERROR_STREAM(n.get_logger(), "Failed to load " << name ); rclcpp::shutdown(); } return ans; }
-
@yuan 在 使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了 中说:
rclcpp::shutdown();
这里这里,你给shutdown() 干啥!!!!!
删掉!!!!!
-
@小鱼 没有呀,现在是这个样子的
int main( int argc, char** argv ) { rclcpp::init( argc, argv); //rclcpp::Node n( "~" ); auto node = std::make_shared<rclcpp::Node>("n"); //rclcpp::Logger( ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug ); RCLCPP_INFO(node->get_logger(), "Waiting for IMU data..."); std::string IMU_TOPIC; std::string IMU_NAME; int max_cluster; IMU_TOPIC = ros_utils::readParam<std::string>(*node, "imu_topic"); IMU_NAME = ros_utils::readParam<std::string>(*node, "imu_name"); data_save_path = ros_utils::readParam<std::string>(*node, "data_save_path"); max_time_min = ros_utils::readParam<int>(*node, "max_time_min"); max_cluster = ros_utils::readParam<int>(*node, "max_cluster"); // rclcpp::Subscription sub_imu = n->create_subscription( IMU_TOPIC, // // 20000000, // imu_callback, // ros::TransportHints( ).tcpNoDelay( ) ); // rclcpp::Publisher pub = n.advertise< geometry_msgs::Vector3Stamped >( ALLAN_TOPIC, // 2000 ); auto sub_imu = node->create_subscription<sensor_msgs::msg::Imu>( IMU_TOPIC, 10, imu_callback); auto gyr_x = std::make_shared<imu::AllanGyr>("gyr x", max_cluster); auto gyr_y = std::make_shared<imu::AllanGyr>("gyr y", max_cluster); auto gyr_z = std::make_shared<imu::AllanGyr>("gyr z", max_cluster); auto acc_x = std::make_shared<imu::AllanAcc>("acc x", max_cluster); auto acc_y = std::make_shared<imu::AllanAcc>("acc y", max_cluster); auto acc_z = std::make_shared<imu::AllanAcc>("acc z", max_cluster); std::cout << "wait for imu data." << std::endl; rclcpp::WallRate loop( 100 ); // ros::spin( ); while ( !end ) { loop.sleep( ); rclcpp::spin_some(node); //rclcpp::spin(n); }
-
@yuan
你的意思是read文件里面吗 -
@小鱼
删掉重新编译还是一样的鱼哥ysh@ysh:~/ros2_ws$ ros2 run imu_utils imu_an [INFO] [1723018093.544028406] [n]: Waiting for IMU data... [ERROR] [1723018093.544215273] [n]: Failed to load imu_topic [ERROR] [1723018093.544802558] [n]: Failed to load imu_name [ERROR] [1723018093.544864169] [n]: Failed to load data_save_path [ERROR] [1723018093.544946202] [n]: Failed to load max_time_min [ERROR] [1723018093.544995910] [n]: Failed to load max_cluster terminate called after throwing an instance of 'rclcpp::exceptions::RCLError' what(): could not create subscription: rcl node's context is invalid, at ./src/rcl/node.c:428 [ros2run]: Aborted
-
@yuan 在 使用imu_utils标定,拥有了db3文件了,使用ros2 launch启动编译好的imu_an节点报错,启动不了 中说:
RCLCPP_ERROR_STREAM(n.get_logger(), "Failed to load " << name ); rclcpp::shutdown();
这里,兄弟,你获取失败为什么要shutdown,就算不执行了,你也要直接抛出异常推出
-
@小鱼 他源码是这样的,我把它删掉还是报错了呀
-
@yuan 删掉重新构建,你现在没办法给我证明你现在运行的是之前的程序,还是你删除之后的
-
@小鱼
您能远程帮我看下吗,孩子都要重装系统了,磕头感谢