-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from tilak-io/dev
TLOG Parser
- Loading branch information
Showing
26 changed files
with
301 additions
and
38,218 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/node_modules | ||
/api/venv | ||
/api/__pycache__/ | ||
/api/parsers/__pycache__/ | ||
/.pnp | ||
.pnp.js | ||
|
||
|
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
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
Empty file.
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
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
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
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
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,60 @@ | ||
import pandas as pd | ||
from cesium_entity import CesiumEntity | ||
from .parser import Parser | ||
from pymavlink import mavutil | ||
|
||
class TLOGParser(Parser): | ||
def __init__(self): | ||
super().__init__() | ||
self.name = "tlog_parser" | ||
self.initDefaultEntity() | ||
self.initEntities() | ||
|
||
def parse(self,filename): | ||
mlog = mavutil.mavlink_connection(filename) | ||
buf = {} | ||
|
||
while True: | ||
m = mlog.recv_match() | ||
if (m is None): break | ||
name = m.get_type() | ||
data = m.to_dict() | ||
if 'time_boot_ms' in list(data.keys()): | ||
data['timestamp_tiplot'] = data['time_boot_ms'] / 1e3 | ||
else: | ||
#ignore tables with no timestamp | ||
continue | ||
|
||
if(name in buf): | ||
del data['mavpackettype'] | ||
buf[name].append(data) | ||
else: | ||
clean_dict = m.to_dict() | ||
del clean_dict['mavpackettype'] | ||
buf[name] = [clean_dict] | ||
|
||
self.datadict = {i:pd.DataFrame(buf[i]).bfill() for i in buf} | ||
return [self.datadict, self.entities] | ||
|
||
|
||
def initDefaultEntity(self): | ||
self.default_entity = CesiumEntity(name='tlog default entity', | ||
useRPY=True, | ||
useXYZ=True, | ||
color="#ffffff", | ||
pathColor="#0000ff", | ||
position={ | ||
'table':'LOCAL_POSITION_NED', | ||
'x': 'x', | ||
'y': 'y', | ||
'z': 'z', | ||
}, | ||
attitude={ | ||
'table':'ATTITUDE', | ||
'roll':'roll', | ||
'pitch':'pitch', | ||
'yaw':'yaw', | ||
}) | ||
|
||
def setDefaultEntities(self): | ||
self.addEntity(self.default_entity) |
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
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
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
Oops, something went wrong.