Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
88cd9a2
ENH: class GNSS
MateusStano May 28, 2024
686e665
ENH: gnss prints
MateusStano May 28, 2024
a5c8513
ENH: add params to measure call
MateusStano May 28, 2024
7c0e507
ENH: export data
MateusStano May 28, 2024
ae682cb
ENH: pass env in .measure
MateusStano May 28, 2024
575148a
DOC: gnss attribute docs
MateusStano May 28, 2024
da74430
MNT: units in prints
MateusStano May 28, 2024
c62f475
Merge branch 'enh/sensors-impl' into enh/gps
MateusStano Jul 2, 2024
0f25181
MNT: fix merge errors
MateusStano Jul 8, 2024
0bc461d
TST: add gnss tests
MateusStano Jul 8, 2024
3b46ae2
TST: fix time nodes tests
MateusStano Jul 8, 2024
dd4d63c
DEV: add gnss to sensors testing notebook
MateusStano Jul 8, 2024
137c6ec
Merge branch 'enh/sensors-impl' into enh/gps
MateusStano Jul 8, 2024
f926472
DEV: fix merge errors
MateusStano Jul 8, 2024
d9458a1
MNT: lint and isort
MateusStano Jul 8, 2024
0e1c58e
MNT: black notebooks
MateusStano Jul 12, 2024
0744b79
TST: fix test by inversion of rotation
MateusStano Jul 12, 2024
e6fdaeb
TST: lower rel tolerances and delete duplicated tests
MateusStano Jul 12, 2024
6f741df
MNT: minor fixes
MateusStano Aug 15, 2024
9ce718e
ENH: export sensor data by sensor name
MateusStano Aug 20, 2024
a28e7bd
MNT: use inverted_haversine in GNSS
MateusStano Aug 20, 2024
887e0a9
BUG: bearing unit in inverted_haversine
MateusStano Aug 20, 2024
dc43f27
MNT: pylint
MateusStano Aug 23, 2024
2295609
TST: add test for export with sensor name
MateusStano Aug 23, 2024
015f5ea
MNT: rename `GNSS` class to `GnssReceiver`
Gui-FernandesBR Sep 8, 2024
26859e6
MNT: fix lint
Gui-FernandesBR Sep 8, 2024
6265f05
MNT: rename gnss file
Gui-FernandesBR Sep 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MNT: fix merge errors
  • Loading branch information
MateusStano committed Jul 8, 2024
commit 0f25181a7ac1afe167d883ba31400fa53637dd23
2 changes: 1 addition & 1 deletion rocketpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Tail,
TrapezoidalFins,
)
from .sensors import Accelerometer, Barometer, Gyroscope, GNSS
from .sensors import GNSS, Accelerometer, Barometer, Gyroscope
from .simulation import Flight, MonteCarlo
from .stochastic import (
StochasticEllipticalFins,
Expand Down
2 changes: 1 addition & 1 deletion rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from rocketpy.control.controller import _Controller
from rocketpy.mathutils.function import Function
from rocketpy.mathutils.vector_matrix import Vector, Matrix
from rocketpy.mathutils.vector_matrix import Matrix, Vector
from rocketpy.motors.motor import EmptyMotor
from rocketpy.plots.rocket_plots import _RocketPlots
from rocketpy.prints.rocket_prints import _RocketPrints
Expand Down
4 changes: 2 additions & 2 deletions rocketpy/sensors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .sensor import InertialSensor, ScalarSensor, Sensor
from .accelerometer import Accelerometer
from .gyroscope import Gyroscope
from .barometer import Barometer
from .gnss import GNSS
from .gyroscope import Gyroscope
from .sensor import InertialSensor, ScalarSensor, Sensor
20 changes: 8 additions & 12 deletions rocketpy/sensors/gnss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import numpy as np

from ..mathutils.vector_matrix import Matrix, Vector
from ..prints.sensors_prints import _BarometerPrints, _GNSSPrints
from .sensors import ScalarSensors
from ..prints.sensors_prints import _GNSSPrints
from .sensor import ScalarSensor


class GNSS(ScalarSensors):
class GNSS(ScalarSensor):
"""Class for the GNSS sensor

Attributes
Expand Down Expand Up @@ -90,7 +90,7 @@ def measure(self, time, **kwargs):
# Apply accuracy to the position
x = np.random.normal(x, self.position_accuracy)
y = np.random.normal(y, self.position_accuracy)
z = np.random.normal(z, self.altitude_accuracy)
altitude = np.random.normal(z, self.altitude_accuracy)

# Convert x and y to latitude and longitude
lat1 = math.radians(lat) # Launch lat point converted to radians
Expand Down Expand Up @@ -120,30 +120,26 @@ def measure(self, time, **kwargs):
)
)

latitude = np.random.normal(latitude, self.position_accuracy)
longitude = np.random.normal(longitude, self.position_accuracy)
altitude = np.random.normal(z, self.altitude_accuracy)

self.measurement = (latitude, longitude, altitude)
self._save_data((time, *self.measurement))

def export_measured_data(self, filename, format):
def export_measured_data(self, filename, file_format):
"""Export the measured values to a file

Parameters
----------
filename : str
Name of the file to export the values to
format : str
file_format : str
Format of the file to export the values to. Options are "csv" and
"json". Default is "csv".

Returns
-------
None
"""
super().export_measured_data(
self._generic_export_measured_data(
filename=filename,
format=format,
file_format=file_format,
data_labels=("t", "latitude", "longitude", "altitude"),
)
9 changes: 4 additions & 5 deletions rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,10 +662,9 @@ def __simulate(self, verbose):
# Initialize phase time nodes
phase.time_nodes = self.TimeNodes()
# Add first time node to the time_nodes list
phase.time_nodes.add_node(phase.t, [], [])
phase.time_nodes.add_node(phase.t, [], [], [])
# Add non-overshootable parachute time nodes
if self.time_overshoot is False:
# TODO: move parachutes to controllers
phase.time_nodes.add_parachutes(
self.parachutes, phase.t, phase.time_bound
)
Expand Down Expand Up @@ -1147,7 +1146,7 @@ def __init_flight_state(self):
self.out_of_rail_time = self.initial_solution[0]
self.out_of_rail_time_index = 0
self.initial_derivative = self.u_dot_generalized
if self._controllers:
if self._controllers or self.sensors:
# Handle post process during simulation, get initial accel/forces
self.initial_derivative(
self.t_initial, self.initial_solution[1:], post_processing=True
Expand Down Expand Up @@ -3503,8 +3502,8 @@ def merge(self):
# Try to access the node and merge if it exists
tmp_dict[time].parachutes += node.parachutes
tmp_dict[time].callbacks += node.callbacks
tmp_dict[-1]._component_sensors += node._component_sensors
tmp_dict[-1]._controllers += node._controllers
tmp_dict[time]._component_sensors += node._component_sensors
tmp_dict[time]._controllers += node._controllers
except KeyError:
# If the node does not exist, add it to the dictionary
tmp_dict[time] = node
Expand Down