JulioPlaced / active_graph_slam

39 stars 11 forks source link

Index out of bounds #8

Open glhwork opened 9 months ago

glhwork commented 9 months ago

Thank you for sharing your algorithm! Now I am trying to run the code in simulation and there are some problems I met,

  1. No graph.g2o file under my $HOME directory originally, but after I launch the graph_dopt.launch for the first time and then STOP (Ctrl+C), a graph.g2o file is generated under my $HOME directory and I have no idea where the graph data is from.
  2. An error occurs at line 239 in scripts/functions.py (i.e., 'FIM = np.float_(x.split(' ')[7:12])') saying 'cannot convert from string to float'. I discover that the last member of the list x.split(' ')[7:12] is a newline character('\n'), then I modify it to [7:11] to bypass this problem.
  3. After problem 2, another error occurs at line 45 in scripts/weighted_pose_graph_class.py saying 'index out of bounds' while assigning values to matrix A. Then I verify that the length of list I is 5, not 6.

I'm blocked by these problems for a while. I'm not sure whether the data generated (graph.g2o) is correct according to my steps. Or perhaps, I made a wrong modification of the code? Many thanks if any suggestions!!

bairuofei commented 9 months ago

The graph.g2o comes from slam_karto_g2o node, and then the .g2o file is read by the node assigner for graph Laplacian computation. Everytime you run the slam_karto_g2o node, graph.g2o will be updated. You can reset the path where the .g2o file should be saved by following README. Hope this helps.

Crystal-Biru commented 5 months ago

Hello @glhwork ! I also encountered problem 2 and problem 3 you mentioned. For problem 3, since the length of list I is 5, how did you modify the code to change the way list I is assigned to matrix A?

glhwork commented 5 months ago

Hello @glhwork ! I also encountered problem 2 and problem 3 you mentioned. For problem 3, since the length of list I is 5, how did you modify the code to change the way list I is assigned to matrix A?

@Crystal-Biru Sorry, this problem still remains unsolved for me. I'm now working on other projects and will get back to this after a few months.

JulioPlaced commented 4 months ago

Hello! As @bairuofei explained, the .g2o file comes from the SLAM algorithm (open_karto). It saves this file in the desired path.

Then, the .g2o (which contains information about the pose-graph) is parsed to recover the poses and uncertainties associated using this wrapper.

To debug error number 2, the first step is to look at the .g2o file, as the error says it cannot recover the Fisher information matrix (see here). Lines of type "EDGE_SE2" in this file should have the following items:

EDGE_SE2 id1, id2, edge_type, x, y, z, cov_xx, cov_xy, cov_xz, cov_yy, cov_yz, cov_zz

This is written by g2o (see here and here). The covariance is encoded by the upper triangular part.

Please, paste the .g2o content to further debug this problem.

@glhwork, error number 3 is related to the workaround you made to bypass error number 2 -- you shrinked the Information matrix upper triangular part from 6 to 5 elements.

glhwork commented 4 months ago

@JulioPlaced I understand! You're right, problem-3 is caused by my modifications of the code.