Skip to content

Commit

Permalink
add comments about each member functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShisatoYano committed Oct 27, 2023
1 parent 49a79d5 commit a4c34a3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/sensors/gnss/gnss.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Gnss:
"""
Position data sensing simulation class with GNSS
GNSS position data sensing simulation class
"""

def __init__(self, x_noise_std=0.5, y_noise_std=0.5, color='g'):
Expand All @@ -28,6 +28,11 @@ def __init__(self, x_noise_std=0.5, y_noise_std=0.5, color='g'):

@staticmethod
def observation_model(state):
"""
Static function of observation model of vehicle state
state: Vehicle's state (x, y, yaw, speed) object
"""

H = np.array([[1, 0, 0, 0],
[0, 1, 0, 0]])

Expand All @@ -39,6 +44,11 @@ def observation_model(state):
return H @ x

def update(self, state):
"""
Function to update GNSS observation data (x, y)
state: Vehicle's state (x, y, yaw, speed) object
"""

observed_noise = self.NOISE_VAR_MAT @ np.random.randn(2, 1)
observed_xy = self.observation_model(state) + observed_noise

Expand All @@ -47,5 +57,11 @@ def update(self, state):
self.y_history.append(self.latest_observed_xy[1])

def draw(self, axes, elems):
"""
Function to draw GNSS observation position (x, y)
axes: Axes object of figure
elems: List of plot object
"""

hist_plot, = axes.plot(self.x_history, self.y_history, linewidth=0, marker='.', color=self.DRAW_COLOR)
elems.append(hist_plot)

0 comments on commit a4c34a3

Please sign in to comment.