-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bb2aba2
Showing
16 changed files
with
873 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# flo-data-analysis | ||
|
||
Data analysis for [FLO](https://github.com/strawlab/flo). | ||
|
||
## Directories | ||
|
||
- `load_floz` load data saved by FLO into Python | ||
- `flo-px4-merge` merge data saved by FLO with data saved by a PX4 flight controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
default: output/20240712-134130.gpx | ||
|
||
output/20240712-134130.rrd: merge_ulog_floz.py demo-data/20240712-134130.yaml | ||
python merge_ulog_floz.py demo-data/20240712-134130.yaml | ||
|
||
output/20240712-134130.gpx: output/20240712-134130.rrd smooth_bee_traj.py demo-data/20240712-134130.yaml | ||
python smooth_bee_traj.py demo-data/20240712-134130.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# FLO PX4 merge | ||
|
||
Merge data from FLO and PX4 flight logs to allow georeferencing of data saved by FLO. | ||
|
||
Pan, tilt and distance estimates from FLO are converted from their intrinsic | ||
quadcopter-centric to georeferenced coordinates first by converting them to the | ||
local coordinate frame used by the quadcopter’s flight controller. Local | ||
coordinates are then converted to global coordinates using the PX4 reference | ||
point (local NED frame origin) in global (GPS / WGS84) frame. | ||
|
||
## data acquisition | ||
|
||
Ideally, the PX4 flight controller is logging at high rate but the defaults are | ||
relatively slow. | ||
|
||
As a solution, set the PX4 parameter | ||
[`SDLOG_PROFILE`](https://docs.px4.io/main/en/advanced_config/parameter_reference.html#SDLOG_PROFILE) | ||
to a value of 4 (high rate). | ||
|
||
Alternatively, following [these | ||
instructions](https://docs.px4.io/main/en/dev_log/logging.html), high data rate | ||
logs can be enabled by setting `etc/logging/logger_topics.txt` to the following: | ||
|
||
``` | ||
vehicle_local_position | ||
vehicle_gps_position | ||
vehicle_attitude | ||
``` | ||
|
||
However, this disables all other logging, which makes the logs largely useless | ||
for many other purposes. Thus, we suggest changing the `SDLOG_PROFILE` parameter | ||
as described above. | ||
|
||
## setup | ||
|
||
``` | ||
conda create -n px4-log-analysis python=3.11 | ||
pip install pyulog # Used 1.1.0 | ||
pip install matplotlib # Used 3.9.1 | ||
pip install pandas # Used 2.2.2 | ||
pip install PyYAML # Used 6.0.1 | ||
pip install rerun-sdk # Used 0.17.0 | ||
pip install scipy # Used 1.14.0 | ||
pip install adskalman # Used 0.3.11 | ||
pip install imageio # Used 2.34.2 | ||
pip install pyned2lla # Used 0.1.0 | ||
pip install load_floz # Used 0.1.0 | ||
``` | ||
|
||
## run | ||
|
||
``` | ||
conda activate px4-log-analysis | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import yaml | ||
import os | ||
|
||
class ConfigLoader: | ||
def __init__(self, path: str): | ||
self.conf_path, _ = os.path.split(os.path.abspath(path)) | ||
self.conf = yaml.safe_load(open(path).read()) | ||
self.conf_filename = path | ||
_, filename = os.path.split(path) | ||
self.name, _ = os.path.splitext(filename) | ||
self.output_dir = self.get_filename('output_dir') | ||
|
||
def _rel_to_abs(self, path: str) -> str: | ||
"""convert relative paths to absolute paths""" | ||
if not os.path.isabs(path): | ||
path = os.path.join(self.conf_path, path) | ||
return path | ||
def get_filename(self, key: str) -> str | None: | ||
"""get a key as a filename | ||
return None if the key is not set | ||
""" | ||
path = self.conf.get(key) | ||
if path is not None: | ||
path = self._rel_to_abs(path) | ||
return path | ||
def __getitem__(self, key): | ||
return self.conf.__getitem__(key) | ||
def get(self, *args, **kwargs): | ||
return self.conf.get(*args, **kwargs) | ||
def out_filename(self, ext: str) -> str: | ||
return os.path.join(self.output_dir, self.name+ext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
mask_start,mask_end | ||
2024-07-12 11:41:30.692388352Z,2024-07-12 11:42:00.209415Z | ||
2024-07-12 11:41:59.425Z,2024-07-12 11:42:00.123Z | ||
2024-07-12 11:42:19.313686Z,2024-07-12 11:42:20.176216Z | ||
2024-07-12 11:42:27.438Z,2024-07-12 11:42:31.251Z | ||
2024-07-12 11:42:37.754Z,2024-07-12 11:42:39.404Z | ||
2024-07-12 11:43:28.034705Z,2024-07-12 11:43:29.029286Z | ||
2024-07-12 11:43:34.050221Z,2024-07-12 11:43:34.537991Z | ||
2024-07-12 11:43:40.773324Z,2024-07-12 11:43:41.193492Z | ||
2024-07-12 11:43:42.473247Z,2024-07-12 11:43:43.260954Z | ||
2024-07-12 11:43:53.005133Z,2024-07-12 11:43:53.612814Z | ||
2024-07-12 11:43:53.736896Z,2024-07-12 11:43:54.163695Z | ||
2024-07-12 11:43:55.315518Z,2024-07-12 11:43:55.766920Z | ||
2024-07-12 11:43:56.415569Z,2024-07-12 11:43:57.939959Z | ||
2024-07-12 11:43:58.996902Z,2024-07-12 11:43:59.548532Z | ||
2024-07-12 11:44:04.808324Z,2024-07-12 11:44:05.106669Z | ||
2024-07-12 11:44:05.233765Z,2024-07-12 11:44:05.538626Z | ||
2024-07-12 11:44:05.927869Z,2024-07-12 11:44:06.272200Z | ||
2024-07-12 11:44:06.187658Z,2024-07-12 11:44:09.689940Z | ||
2024-07-12 11:44:11.689740Z,2024-07-12 11:44:13.456619Z | ||
2024-07-12 11:44:23.721634Z,2024-07-12 11:44:24.222459Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# data from FLO methods paper | ||
ulog_file: log_34_2024-7-12-13-45-18.ulg | ||
floz_file: flo20240712_134130.684896145.floz | ||
mask_file: 20240712-134130-mask.csv | ||
output_dir: ../output | ||
|
||
recording_id: b7ba4662-2fd5-49c6-8fb9-f961a8f596b4 # autogenerated if not set | ||
flo_resample_rate: 10.0 # 10 Hz | ||
timestamp_tolerance_dt: 0.1 # 100 msec | ||
kalman_smoothing_dt: 0.1 # 100 msec |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.