Description
To aid in exporting different flight information, such as pressure at a specific point along the fuselage during flight or an acceleration as if measured by an accelerometer at a particular orientation mounted at a particular location in the rocket, this issue proposes the implementation of a Sensor
abstract class, along if modifications to the Rocket
and Flight
class to interface with it.
Proposed Usage Example
from rocketpy import Rocket, Flight
from rocketpy.sensors import Accelerometer
test_rocket = Rocket(...)
nose_cone_accel = Accelerometer(
orientation=(1, 0, 0),
sample_rate=100,
saturation_values=(-160, 160),
accuracy=1e-3,
noise=...,
)
test_rocket.add_sensor(
sensor=nose_cone_accel,
position=(x, y, z)
)
def throttle_control():
if nose_cone_accel.current_value[0] > 100:
# To fast, throttle_down
...
test_rocket.add_discrete_controller(
controller=throttle_control
refresh_rate=100
)
test_flight = Flight(...)
nose_cone_accel.export_data('accel.csv')
Requirements
-
Support for the following types of sensors:
- Clock
- Accelerometer
- Gyroscope
- Magnetometer
- Barometer
- Thermometer (optional but desired)
- PitotTube (optional but desired)
- Luminosity (optional but desired)
-
Support for the following methods/properties:
Sensor.current_value
: to be used during flight by controllersSensor.export_data
: to be used after flight
-
Each sensor should be able to emulate:
- Saturation limits
- Noise
- Accuracy
- Malfunction (random defective values if specified)
Proposed Architecture
Create a submodule rocketpy.sensors
. The submodule should have at least the following classes:
- Sensor(abc)
- Accelerometer(Sensor)
- Gyroscope(Sensor)
- Magnetometer(Sensor)
- Barometer(Sensor)
Proposed Milestone
This feature should be implemented in a major release with a better support for continuous and discrete controllers, along with a refactoring of the Flight
class.
Therefore, it can be released with v2.0.0.
Context
This idea was first proposed by @Lucas-KB. It was a great idea and we are excited to implement it!
Metadata
Metadata
Assignees
Type
Projects
Status