Ejemplo n.º 1
0
Archivo: main.py Proyecto: e3u3/2DSLAM
def load_data(dataset, texture):
    '''
    Load and preprocess data
    Input:
        dataset - number of dataset to use
        texture - boolean to switch on texture mapping (include kinect data)
    Output:
        enc_data - Encoder data in dictionary, with left and right displacement, and timestamps
        imu_data -  IMU data in dictionary, with angular velocity (yaw rate), linear acceleration and timestamps
        lidar_data - LiDAR data in dictionary, with ranges, angles and timestamps
    '''
    #load data
    imu_data = ld.get_imu(dataset)
    lidar_data = ld.get_lidar(dataset)
    enc_data = ld.get_enc(dataset)
    if texture == True:
        kinect_data = ld.get_kinect_time(dataset)
    else:
        kinect_data = 0

    # remove bias for odometry, init state is (0,0,0)
    yaw_bias_av = np.mean(imu_data['av'][0:380])
    imu_data['av'] -= yaw_bias_av

    #apply band pass filter
    order = 1
    fs = 50  # sample rate, Hz
    low = 0.000001  # desired band frequency of the filter, Hz
    high = 10
    imu_data['av'] = butter_bandpass_filter(imu_data['av'], low, high, fs,
                                            order)

    return enc_data, imu_data, lidar_data, kinect_data
Ejemplo n.º 2
0
def load_folder(folder_par):

    # prefix_list= ["Hokuyo","Encoders","imu"]
    # find location of period (where file extension starts) and extract unique filenames
    unique_files = list(
        set([i[i.find(".") - 2:i.find(".")] for i in os.listdir(folder_par)]))

    # load all map attributes into classes
    '''NOTE: r prefix tells interpreter the backslash is to be take literally, as any other character.'''
    map_list = [map_object(\
                            id,\
                            load_data.get_lidar(folder_par+r"/Hokuyo{0}".format(id)),\
                            load_data.get_encoder(folder_par+r"/Encoders{0}".format(id)),\
                            load_data.get_imu(folder_par+r"/imu{0}".format(id)))\
                            for id in unique_files]
    return map_list
Ejemplo n.º 3
0
# Jinwook Huh

import load_data as ld
import p3_util as ut

acc_x, acc_y, acc_z, gyro_x, gyro_y, gyro_z, imu_ts	 = ld.get_imu('imuRaw20')

FR, FL, RR, RL,enc_ts = ld.get_encoder('Encoders20')

lidar = ld.get_lidar('Hokuyo20')
ut.replay_lidar(lidar)
Ejemplo n.º 4
0
#!/usr/bin/env python
# coding: utf-8

# In[10]:

#load data
import matplotlib.pyplot as plt
import load_data as ld
import math
import numpy as np
import MapUtils as MU
from scipy.special import logsumexp

acc_x, acc_y, acc_z, gyro_x, gyro_y, gyro_z, imu_ts = ld.get_imu('data/imu23')

FR, FL, RR, RL, enc_ts = ld.get_encoder('data/Encoders23')

lidar = ld.get_lidar('data/Hokuyo23')

# In[11]:


# Bresenham's ray tracing algorithm in 2D.
# Inputs:
#(sx, sy) start point of ray
#(ex, ey) end point of ray
def bresenham2D(sx, sy, ex, ey):
    sx = int(round(sx))
    sy = int(round(sy))
    ex = int(round(ex))
    ey = int(round(ey))