Skip to content

Commit cc9e2d6

Browse files
author
cpsl-jetson-1
committed
Add option for passive reference frame
1 parent 080cdc6 commit cc9e2d6

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

avstack/geometry/datastructs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import json
2+
from typing import Union
23

34
import numpy as np
45

56
import avstack
67

78
from . import transformations as tforms
89
from .base import q_mult_vec
9-
from .refchoc import ReferenceDecoder, ReferenceFrame, Rotation, Vector
10+
from .refchoc import ReferenceDecoder, ReferenceFrame, PassiveReferenceFrame, Rotation, Vector
1011

1112

1213
class VectorDecoder(json.JSONDecoder):
@@ -70,7 +71,7 @@ def object_hook(json_object):
7071

7172

7273
class Position(Vector):
73-
def _pull_from_reference(self, reference: ReferenceFrame):
74+
def _pull_from_reference(self, reference: Union[ReferenceFrame, PassiveReferenceFrame]):
7475
return reference.x
7576

7677
@property
@@ -83,7 +84,7 @@ def factory():
8384

8485

8586
class Velocity(Vector):
86-
def _pull_from_reference(self, reference: ReferenceFrame):
87+
def _pull_from_reference(self, reference: Union[ReferenceFrame, PassiveReferenceFrame]):
8788
return reference.v
8889

8990
@staticmethod
@@ -92,7 +93,7 @@ def factory():
9293

9394

9495
class Acceleration(Vector):
95-
def _pull_from_reference(self, reference: ReferenceFrame):
96+
def _pull_from_reference(self, reference: Union[ReferenceFrame, PassiveReferenceFrame]):
9697
return reference.acc
9798

9899
@staticmethod
@@ -101,7 +102,7 @@ def factory():
101102

102103

103104
class Attitude(Rotation):
104-
def _pull_from_reference(self, reference: ReferenceFrame):
105+
def _pull_from_reference(self, reference: Union[ReferenceFrame, PassiveReferenceFrame]):
105106
return reference.q
106107

107108
@staticmethod
@@ -110,7 +111,7 @@ def factory():
110111

111112

112113
class AngularVelocity(Rotation):
113-
def _pull_from_reference(self, reference: ReferenceFrame):
114+
def _pull_from_reference(self, reference: Union[ReferenceFrame, PassiveReferenceFrame]):
114115
return reference.ang
115116

116117
@staticmethod

avstack/modules/tracking/tracker2d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ def track(self, detections, platform, **kwargs):
2424
trk = BasicBoxTrack2D(
2525
t0=detections.timestamp,
2626
box2d=det.box2d,
27+
reference=platform,
2728
obj_type=det.obj_type,
2829
ID_force=None,
2930
v=None,
3031
P=np.eye(6), # fake this
3132
t=detections.timestamp,
32-
coast=0,
33+
dt_coast=0,
3334
n_updates=1,
34-
age=1,
3535
)
3636
tracks.append(trk)
3737
return tracks

0 commit comments

Comments
 (0)