Skip to content

Commit

Permalink
fix 3line orient
Browse files Browse the repository at this point in the history
  • Loading branch information
1-Bart-1 committed Nov 13, 2024
1 parent a1980e0 commit a5fcad3
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,29 +199,20 @@ function update_system(kv::AKV, state::SysState; scale=1.0, kite_scale=1.0, ned=
kv.markersizes[] = calc_markersizes(kv.set.segments)
kv.rotation[] = calc_rotations(kv.set.segments)

if ned
q0 = quat2viewer(state.orient) # SVector in the order w,x,y,z
else
q0 = state.orient # SVector in the order w,x,y,z
end
quat[] = Quaternionf(q0[2], q0[3], q0[4], q0[1]) # the constructor expects the order x,y,z,w
if fourpoint
s = kv.set.segments
if ned
q0 = quat2viewer(state.orient) # SVector in the order w,x,y,z
else
q0 = state.orient # SVector in the order w,x,y,z
end
quat[] = Quaternionf(q0[2], q0[3], q0[4], q0[1]) # the constructor expects the order x,y,z,w
kite_pos[] = 0.8 * 0.5 * (kv.points[s+4] + kv.points[s+5]) + 0.2 * kv.points[s+1]
elseif fourpoint_3l
s = kv.set.segments
q0 = state.orient # SVector in the order w,x,y,z
quat[] = Quaternionf(q0[2], q0[3], q0[4], q0[1]) # the constructor expects the order x,y,z,w
kite_pos[] = 0.8 * 0.5 * (kv.points[s*3+4] + kv.points[s*3+5]) + 0.2 * kv.points[s*3+3]
else
if ned
q0 = quat2viewer(state.orient) # SVector in the order w,x,y,z
else
q0 = state.orient # SVector in the order w,x,y,z
end
# move and turn the kite to the new position
# SVector in the order w,x,y,z
quat[] = Quaternionf(q0[2], q0[3], q0[4], q0[1]) # the constructor expects the order x,y,z,w
kite_pos[] = Point3f(state.X[kv.set.segments+1], state.Y[kv.set.segments+1], state.Z[kv.set.segments+1]) * scale
end

Expand Down

0 comments on commit a5fcad3

Please sign in to comment.