Skip to content
Snippets Groups Projects
Commit 145a70dd authored by oceanpdoshi@g.ucla.edu's avatar oceanpdoshi@g.ucla.edu
Browse files

dead code

parent e26e07b6
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 13 16:11:36 2018
@author: william
"""
class DataGenerator():
def init_(self):
pass
def within_map(self, loc):
'''
For runtime self_generated data,
Parameters:
loc: array, shape = (2,1)
robot's location for [x, y]
Return: Boolean
True if within the map, False if not
'''
center_point = [0,0]
if sqrt(pow(loc[0]-center_point[0], 2)+pow(loc[1]-center_point[1], 2)) > d_max:
return False
else:
return True
def generate_propgation_data(self, current_loc, current_orientation):
'''
To generate propagtion data randomly so that it will run within predefined map *assuming orientation is perfect
Parameters:
current_loc: array, shape = (2,1)
robot's current location for [x, y]
current_orientation: float
robot's current orientation in radian
Return array, shape = (2,1)
'''
[meas_v, meas_a_v] = [random.uniform(-max_v,max_v), random.uniform(-max_a_v, max_a_v)]
actual_v = meas_v + random.normal(0, sqrt(var_u_v))
pre_update_position = [current_loc[0] + cos(current_orientation)*actual_v*delta_t, current_loc[1] + sin(current_orientation)*actual_v*delta_t]
while(not within_map(pre_update_position)):
[meas_v, meas_a_v] = [random.uniform(-max_v,max_v), random.uniform(-max_a_v, max_a_v)]
actual_v = meas_v + random.normal(0, sqrt(var_u_v))
pre_update_position = [current_loc[0] + cos(current_orientation)*actual_v*delta_t, current_loc[1] + sin(current_orientation)*actual_v*delta_t]
orientation = current_orientation + meas_a_v*delta_t
actual_loc = pre_update_position
return [actual_v, meas_v, orientation, actual_loc]
def generate_measurement_data(self, observer_loc, observee_loc, observer_orientation):
delta_x = observer_loc[0] - observee_loc[0]
delta_y = observer_loc[1] - observee_loc[1]
dis = sqrt(delta_y*delta_y + delta_x*delta_x) + random.normal(0, sqrt(var_dis))
bearing = atan2(delta_y, delta_x) + random.normal(0, sqrt(var_angle)) - observer_orientation
return [dis, bearing]
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment