QUB-ASL / bzzz

Quadcopter with ESP32 and RaspberryPi
MIT License
7 stars 0 forks source link

correct paths for data logger and filters #171

Closed jamie-54 closed 5 months ago

jamie-54 commented 7 months ago

Describe the bug

Fails to run python bzzz/raspberry/main.py

This is due to the path for importing DataLogger and MedianFilter/NoFilter in the anemometer.py and evo_time_of_flight.py files.

However if I add bzzz.sensor. it will run the main.py file but then the anemometer.py and evo_time_of_flight.py files

Affected File

bzzz/raspberry/bzzz/sensor/anemometer.py bzzz/raspberry/bzzz/sensor/evo_time_of_flight.py

Affected Line

6/7 7/8

To Reproduce

No response

Minimum reproducible example

source venv_bzzz/bin/activate
python bzzz/raspberry/main.py

Additional context

No response

alphaville commented 5 months ago

I think local imports (when importing a module into another in the same folder) need a dot at the beginning. For example, in [another project] we have the folder constraints and there we have the files ball1.py and simplex.py. To import simplex into ball1 we do:

from .simplex import Simplex

In fact, we use from ... import ... to import only the things we need from simplex.py.

In another case, we wanted to import a whole sub-module, so we did:

import opengen.functions as fn

Here opengen is the name of the top-level model (ours is bzzz).

alphaville commented 5 months ago

@jamie-54 do we have a PR for this?

jamie-54 commented 5 months ago

@jamie-54 do we have a PR for this?

No, there isn't a branch for this either