rsasaki0109 / li_slam_ros2

ROS 2 package of tightly-coupled lidar inertial ndt/gicp slam
BSD 2-Clause "Simplified" License
316 stars 42 forks source link

IndeterminateLinearSystemError #38

Open SammySuliman opened 3 weeks ago

SammySuliman commented 3 weeks ago

Hello,

I am getting the following error as soon as I run the scanmatcher package:

[ERROR] [imu_preintegration-3]: process has died [pid 6088, exit code -6, cmd '/home/singularity1/ros2_ws/install/scanmatcher/lib/scanmatcher/imu_preintegration --ros-args --params-file /home/singularity1/ros2_ws/install/scanmatcher/share/scanmatcher/param/lio.yaml -r /odometry:=/odom'].

This error only occurs when I launch the following node to publish spoof data to the topic /odom. If I don't launch this node I do not get this error:

import rclpy
from rclpy.node import Node
from nav_msgs.msg import Odometry
from std_msgs.msg import Header
from sensor_msgs.msg import Imu
from geometry_msgs.msg import Quaternion, Vector3, Point
from geometry_msgs.msg import Pose, Twist, PoseWithCovariance, TwistWithCovariance
import random

class OdometryPublisher(Node):

    def __init__(self):
        super().__init__('odometry_publisher')
        self.odom_pub = self.create_publisher(Odometry, '/odom', 10)
        timer_period = 0.5  # seconds
        self.timer = self.create_timer(timer_period, self.timer_callback)
        self.x = 0.0
        self.y = 0.0
        self.z = 0.0

    def timer_callback(self):
        odom_msg = Odometry()
        odom_msg.header.frame_id = "velodyne"
        self.z += 0.01
        quaternion = Quaternion()
        linear = Vector3()
        angular = Vector3()
        linear.x = 0.0
        linear.y = 0.0
        linear.z = 0.0
        angular.x = 0.0
        angular.y = 0.0
        angular.z = 0.0
        quaternion.x = 0.0
        quaternion.y = 0.0
        quaternion.z = 0.0
        quaternion.w = 1.0
        pose = Pose()
        pose_w_covar = PoseWithCovariance()
        twist = Twist()
        twist_w_covar = TwistWithCovariance()
        point = Point()
        point.x = self.x
        point.y = self.y
        point.z = self.z
        print('Point', point)
        pose.position = point
        pose.orientation = quaternion
        pose_w_covar.pose = pose
        covar = (0.0,0.0,0.0,0.0,0.0,0.0,
                 0.0,0.0,0.0,0.0,0.0,0.0,
                 0.0,0.0,0.0,0.0,0.0,0.0,
                 0.0,0.0,0.0,0.0,0.0,0.0,
                 0.0,0.0,0.0,0.0,0.0,0.0,
                 0.0,0.0,0.0,0.0,0.0,0.0)
        pose_w_covar.covariance = covar
        odom_msg.pose = pose_w_covar
        twist.linear = linear
        twist.angular = angular
        twist_w_covar.twist = twist
        twist_w_covar.covariance = covar
        odom_msg.twist = twist_w_covar
        self.odom_pub.publish(odom_msg)
        self.get_logger().info('Publishing: "%s"' % odom_msg.header)

def main(args=None):
    rclpy.init(args=args)

    odom_publisher = OdometryPublisher()

    rclpy.spin(odom_publisher)

    # Destroy the node explicitly
    # (optional - otherwise it will be done automatically
    # when the garbage collector destroys the node object)
    odom_publisher.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()

I have already read the issues here https://github.com/rsasaki0109/li_slam_ros2/issues/34 but I don't understand how this user solved his problem. I also saw this issue here https://github.com/TixiaoShan/LIO-SAM/issues/165 and implemented the fix on lines 308, 381, 442 of imu_preintegration.cpp but it did not work.

I have not altered the yaml file. I am using a BN008X IMU sensor, I am not sure how to know whether my extrinsic params need to be adjusted. However, I am not getting errors when I publish to the topic /imu_raw with another node , only when I publish to /odom, so I do not think this is the issue. Can anyone help me?