生成了slam 里程计的真值和里程计的值,并保存顶点和边为 g2o文件
随机生成slam 真值和里程计值的 g2o 文
件
#gen_test_data.py
import numpy as np
import matplotlib.pyplot as plt
from utility import *
import math
# generate a small test dataset to test the code
# dataset:
# 0: (0,0,0)
# 1: (1,0, 90)
# 2: (1, 1, 180)
# 3: (0, 1, 270)
# 4: (0, 0, 0)
# 4: 0
def cal_pose_odom(x_i, delta_x):
R = np.array([ [math.cos(x_i[2]), -math.sin(x_i[2]), 0],
[math.sin(x_i[2]), math.cos(x_i[2]), 0],
[0,0,1] ])
x_j = np.array(x_i).reshape(3