Skip to content

Commit

Permalink
Merge pull request #79 from tilak-io/vehicle_attitude_degrees
Browse files Browse the repository at this point in the history
Fix coordinate precision + Add degrees to ulg parser attitude
  • Loading branch information
HmZyy authored Dec 6, 2023
2 parents 96b3f2e + fb38d86 commit 6d71be3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
28 changes: 18 additions & 10 deletions api/parsers/ulgparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pandas import DataFrame
from cesium_entity import CesiumEntity
import math
import numpy as np
from .parser import Parser

class ULGParser(Parser):
Expand Down Expand Up @@ -36,16 +37,23 @@ def add_euler(self,datadict):
if "vehicle_attitude" in datadict:
a=datadict['vehicle_attitude']
result = []
for i in a.to_dict('records'):
result.append(self.euler_from_quaternion(
i['q[0]'],
i['q[1]'],
i['q[2]'],
i['q[3]'],))
r = DataFrame(result)
a['pitch'] = r['pitch']
a['roll'] = r['roll']
a['yaw'] = r['yaw']
if('q[0]' in a and \
'q[1]' in a and \
'q[2]' in a and \
'q[3]' in a):
for i in a.to_dict('records'):
result.append(self.euler_from_quaternion(
i['q[0]'],
i['q[1]'],
i['q[2]'],
i['q[3]'],))
r = DataFrame(result)
a['pitch'] = r['pitch']
a['roll'] = r['roll']
a['yaw'] = r['yaw']
a['pitch_deg'] = r['pitch']*180.0/np.pi
a['roll_deg'] = r['roll']*180.0/np.pi
a['yaw_deg'] = r['yaw']*180.0/np.pi

def parse(self,filename):
self.ulg = ULog(filename)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tiplot",
"version": "1.2.0",
"version": "1.2.1",
"private": true,
"homepage": "./",
"proxy": "http://localhost:5000",
Expand Down
5 changes: 3 additions & 2 deletions src/components/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function Graph({ id, initialKeys, updateKeys, removeGraph }) {
margin: {
t: 10,
b: 25,
l: 50,
l: 100,
r: 25,
},
xaxis: {
Expand All @@ -206,7 +206,8 @@ function Graph({ id, initialKeys, updateKeys, removeGraph }) {
exponentformat: "e",
},
yaxis: {
exponentformat: "e",
exponentformat: "none",
tickformat:".8f"
},
// hovermode: "x unified",
hovermode: "x",
Expand Down

0 comments on commit 6d71be3

Please sign in to comment.