From c29b115b4a5da120723d81d8d019d60ee37440d3 Mon Sep 17 00:00:00 2001 From: "oceanpdoshi@g.ucla.edu" <oceanpdoshi@.ucla.edu> Date: Sun, 7 Jul 2019 20:19:45 -0700 Subject: [PATCH] some comments, changed < to <= avoids cropping off time at the end of sim --- CoLo-AT/dataset_manager/data_generator.py | 6 +++--- CoLo-AT/dataset_manager/simulated_dataset_manager.py | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CoLo-AT/dataset_manager/data_generator.py b/CoLo-AT/dataset_manager/data_generator.py index 1af1b6c..6d1cf77 100644 --- a/CoLo-AT/dataset_manager/data_generator.py +++ b/CoLo-AT/dataset_manager/data_generator.py @@ -4,7 +4,7 @@ import matplotlib.pyplot as plt import IPython -# TODO - add collision checking for circle/random data + class DataGenerator(): def __init__(self, landmarks, duration, robot_labels, starting_states, start_time, delta_t, velocity_noise = 0, angular_velocity_noise = 0, measurement_range_noise = 0, bearing_noise = 0, communication_noise = 0, @@ -87,7 +87,7 @@ class DataGenerator(): # Generates simulated of robots moving in a circle def generate_circular_data(self, test, velocity=0.1, velocity_spread=0): - radian_step = 2*pi/self.duration + radian_step = 2*pi/self.duration # can be hardcoded to be a certain amount of degrees (radians) # if it's a "perfect" circle, then velocity spread will be 0 distance_step = (velocity + np.random.normal(0, velocity_spread))*self.delta_t @@ -111,7 +111,7 @@ class DataGenerator(): self.groundtruth_data[i].append({'time' : self.time_arr['groundtruth'][i][time_idx], 'x_pos': next_x, 'y_pos': next_y, 'orientation': next_orientation}) - + self.generate_odometry_data() self.generate_measurement_data() diff --git a/CoLo-AT/dataset_manager/simulated_dataset_manager.py b/CoLo-AT/dataset_manager/simulated_dataset_manager.py index 702e82d..f5baa20 100644 --- a/CoLo-AT/dataset_manager/simulated_dataset_manager.py +++ b/CoLo-AT/dataset_manager/simulated_dataset_manager.py @@ -23,7 +23,6 @@ def find_nearest_time_idx(l, value): # TODO # communication -# scheduling class SimulatedDataSetManager: def __init__(self, dataset_name, landmarks, duration, robot_labels, @@ -42,7 +41,7 @@ class SimulatedDataSetManager: self.curr_request = 'odometry' self.curr_robot_idx = 0 - # time step of the simulation (secs) TODO - user specified + # time step of the simulation (secs) self.delta_t = delta_t # landmarks = {landmark ID: [x,y]} (m) @@ -52,7 +51,7 @@ class SimulatedDataSetManager: raise Exception("Invalid landmark ID: landmark IDs must be bigger than 5.") # starting_states = {robot label: [time, x_pos, y_pos, orientation], ... } - # TODO - create a generate starting states function (potentially randomized to fit boundary) + # TODO - create a generate starting states function self.starting_states = {label : [self.start_time, i, 0, 0.0] for i,label in enumerate(self.robot_labels)} # groundtruth & odometry are of fixed length=duration @@ -127,8 +126,6 @@ class SimulatedDataSetManager: req.set_message(message) req.set_type(req_type) - - # TODO - perhaps this is the sourceo f the issue? if (req_type == 'measurement' and self.reset_robot_ctr()): current_time += self.delta_t @@ -159,7 +156,7 @@ class SimulatedDataSetManager: message['robot_index'] = robot_idx # Past the total time of simulation or no further measurements - valid_dataline = current_time < self.end_time or (abs(current_time - self.end_time) < 0.001) # <= w/floats + valid_dataline = current_time <= self.end_time or (abs(current_time - self.end_time) < 0.001) # <= w/floats # Select message data if valid_dataline: -- GitLab