Skip to content

Commit 6d71be3

Browse files
authored
Merge pull request #79 from tilak-io/vehicle_attitude_degrees
Fix coordinate precision + Add degrees to ulg parser attitude
2 parents 96b3f2e + fb38d86 commit 6d71be3

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

api/parsers/ulgparser.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pandas import DataFrame
33
from cesium_entity import CesiumEntity
44
import math
5+
import numpy as np
56
from .parser import Parser
67

78
class ULGParser(Parser):
@@ -36,16 +37,23 @@ def add_euler(self,datadict):
3637
if "vehicle_attitude" in datadict:
3738
a=datadict['vehicle_attitude']
3839
result = []
39-
for i in a.to_dict('records'):
40-
result.append(self.euler_from_quaternion(
41-
i['q[0]'],
42-
i['q[1]'],
43-
i['q[2]'],
44-
i['q[3]'],))
45-
r = DataFrame(result)
46-
a['pitch'] = r['pitch']
47-
a['roll'] = r['roll']
48-
a['yaw'] = r['yaw']
40+
if('q[0]' in a and \
41+
'q[1]' in a and \
42+
'q[2]' in a and \
43+
'q[3]' in a):
44+
for i in a.to_dict('records'):
45+
result.append(self.euler_from_quaternion(
46+
i['q[0]'],
47+
i['q[1]'],
48+
i['q[2]'],
49+
i['q[3]'],))
50+
r = DataFrame(result)
51+
a['pitch'] = r['pitch']
52+
a['roll'] = r['roll']
53+
a['yaw'] = r['yaw']
54+
a['pitch_deg'] = r['pitch']*180.0/np.pi
55+
a['roll_deg'] = r['roll']*180.0/np.pi
56+
a['yaw_deg'] = r['yaw']*180.0/np.pi
4957

5058
def parse(self,filename):
5159
self.ulg = ULog(filename)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tiplot",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"private": true,
55
"homepage": "./",
66
"proxy": "http://localhost:5000",

src/components/Graph.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function Graph({ id, initialKeys, updateKeys, removeGraph }) {
195195
margin: {
196196
t: 10,
197197
b: 25,
198-
l: 50,
198+
l: 100,
199199
r: 25,
200200
},
201201
xaxis: {
@@ -206,7 +206,8 @@ function Graph({ id, initialKeys, updateKeys, removeGraph }) {
206206
exponentformat: "e",
207207
},
208208
yaxis: {
209-
exponentformat: "e",
209+
exponentformat: "none",
210+
tickformat:".8f"
210211
},
211212
// hovermode: "x unified",
212213
hovermode: "x",

0 commit comments

Comments
 (0)