Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensors #273

Open
giovaniceotto opened this issue Nov 5, 2022 · 0 comments · Fixed by #583
Open

Sensors #273

giovaniceotto opened this issue Nov 5, 2022 · 0 comments · Fixed by #583
Assignees
Labels
Controllers Controlling rocket flight methods

Comments

@giovaniceotto
Copy link
Member

giovaniceotto commented Nov 5, 2022

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

  1. Support for the following types of sensors:

    • Clock
    • Accelerometer
    • Gyroscope
    • Magnetometer
    • Barometer
    • Thermometer (optional but desired)
    • PitotTube (optional but desired)
    • Luminosity (optional but desired)
  2. Support for the following methods/properties:

    • Sensor.current_value: to be used during flight by controllers
    • Sensor.export_data: to be used after flight
  3. 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!

@giovaniceotto giovaniceotto added the Controllers Controlling rocket flight methods label Nov 5, 2022
@giovaniceotto giovaniceotto added this to the Release v2.0.0 milestone Nov 5, 2022
@giovaniceotto giovaniceotto mentioned this issue Dec 20, 2023
10 tasks
@MateusStano MateusStano mentioned this issue Apr 2, 2024
8 tasks
@Gui-FernandesBR Gui-FernandesBR linked a pull request Apr 4, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Controllers Controlling rocket flight methods
Projects
Status: Mid-Term
Development

Successfully merging a pull request may close this issue.

2 participants