Skip to content

Commit

Permalink
more research into EKF
Browse files Browse the repository at this point in the history
  • Loading branch information
adangert committed Jul 23, 2021
1 parent e4d5499 commit 6a7501b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions controller_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def FormatVec(v, places=5):
return ', '.join([ fmt.format(e) for e in v ])
def VecLen(v):
return math.sqrt(sum([ e*e for e in v ]))
def Normalize(v):
def Normalize(v):n
m = VecLen(v)
return tuple([ e / m for e in v ])

async def Loop(plr):
print("Acceleration Jerk Gyro")
dt = 0.05
rk = ExtendedKalmanFilter(dim_x=3,dim_z=6)
rk = ExtendedKalmanFilter(dim_x=12,dim_z=6)
#initial starting values
#we care about linear acceleration.
#orientation, acceleration, velocity?
Expand All @@ -35,8 +35,8 @@ async def Loop(plr):
#From Link3 we are going to use orientation, linear velocity, gyroscope bias, and accelerometer bias
#for the Joustmania game we don't care so much about position


rk.x = array([0,0,0,0])
#there is 4 states each with 3 variables,.
rk.x = array([0,0,0,0,0,0,0,0,0,0,0,0])

#state transition matrix
#again Link3
Expand All @@ -48,6 +48,11 @@ async def Loop(plr):
#n_ba]

#currently incorect, needs to be updated with maths
#we need dead reconing for the orientation first:

#current orientation
#look at github code next

rk.F = eye(3) + array([[0, 1, 0],
[0, 0, 0],
[0, 0, 0]]) * dt
Expand Down

0 comments on commit 6a7501b

Please sign in to comment.