The tools module reference¶
Data Manager¶
-
class
tools.data_manager.
DataManager
(date)[source]¶ This class handles downloading, extracting and storing data to be used by the main application.
-
get_data
(key=None)[source]¶ This function gets data from the data manager’s data dictionary.
Returns: value of data at key
-
load_lidar
(num_samples, pickled=None, delete_pickle=None)[source]¶ This function loads lidar, with the option to use a pickled file.
Parameters: - num_samples (int.) – Number of samples to load
- pickled (str.) – If pickled=’pickled’, load from existing pickle of lidar, otherwise use existing and save a pickle of the data.
- delete_pickle (str.) – If delete_pickle=’delete’, delete any existing pickle of lidar.
-
Data Loader¶
This class is responsible for precessing data correctly corresponding to the user’s choice.
-
class
tools.data_loader.
DataLoader
(choose)[source]¶ A class to load data according to user’s choose, and do some preprocess to data. It can be usedin this way:
dataloader = Dataloader(choose) dataloader.get_gps_dictionary() dataloader.get_gps_range()
-
get_gps_range
()[source]¶ This function return a tuple contains three tuples like(tuple1, tuple2, tuple3) tuple1 is a tuple contains range of latitude(min, max) tuple2 is a tuple contains range of longitude(min, max) tuple3 is a tuple contains range of altitude(min, max) :return: A tuple contains three tuples contains range of three GPS coordinate
-
Downloading compressed files¶
This script downloads a tar file from the UMich robotics dataset
code referenced from: http://blog.ppkt.eu/2014/06/python-urllib-and-tarfile/
-
tools.download_tar.
download_tar
(base_name, date, data_type)[source]¶ This function downloads the tar file and puts it in the data directory.
Parameters: - base_name (str.) – Base url
- date (str.) – Date to select in the data set.
- data_type (str.) – Selects the type of data to download (lidar or GPS).
Returns: str. – name of file that was downloaded
Extracting compressed files¶
Filtering NaN values¶
Getting selectable dates for the UMich data set¶
dates referenced from: http://robots.engin.umich.edu/nclt/downloader.py
Reading data from the Hokuyo lidar scanner¶
code referenced from: http://robots.engin.umich.edu/nclt/python/read_hokuyo_30m.py
Staticmap API function overrides¶
Modification to the original staticmaps API, which can be found at https://github.com/komoot/staticmap/blob/master/staticmap/staticmap.py
-
class
tools.static_map_base_layer.
StaticMapBaseLayer
(width, height, padding)[source]¶ This is a overide class inherited from StaticMap. We overide some functions there to get something we want.
-
extract_line_points
()[source]¶ This method is not in the original API This function extract line features. :return: points((px, py),(),…)
-
render_without_features
(zoom=None, center=None)[source]¶ render static map with all map features that were added to map before :param zoom: optional zoom level, will be optimized automatically if not given. :type zoom: int :param center: optional center of map, will be set automatically from markers if not given. :type center: list :return: PIL image instance :rtype: Image.Image
-
Using GPS data with the staticmap API¶
This file is used to generate all points needed for plot in real-time.
-
tools.staticmap_for_gps.
divide_coordinates
(coordinates)[source]¶ Divide coordinates into about 50 pieces for following use. :param coordinates: coordinates contains gps data. :return: divided coordinates
-
tools.staticmap_for_gps.
generate_coordinates
(data_dict)[source]¶ This function preprocess gps data to make it useful for future use. :param data_dict: input gps data from dataManager :return: coordinates[[lng, lat], [], …]