Skip to content

Commit d0cae40

Browse files
committed
Tests pass
1 parent d862291 commit d0cae40

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

src/SimpleKiteControllers.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ module SimpleKiteControllers
22

33
using DiscretePIDs, Parameters
44

5+
export ParkingController, ParkingControllerSettings
6+
export linearize
7+
58
@with_kw mutable struct ParkingControllerSettings @deftype Float64
69
dt
710
# turn rate controller settings

test/runtests.jl

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,75 @@ using SimpleKiteControllers
22
using Test
33

44
@testset "SimpleKiteControllers.jl" begin
5-
# Write your tests here.
5+
@testset "test_linearize" begin
6+
# set the parameters of the parking controller
7+
pcs = ParkingControllerSettings(dt=0.05)
8+
pcs.kp_tr=1.05
9+
pcs.ki_tr=0.012
10+
# create the parking controller
11+
pc = ParkingController(pcs)
12+
# set the desired turn rate
13+
psi_dot = 0.1
14+
# set the heading
15+
psi = 0.0
16+
# set the elevation angle
17+
elevation = 0.0
18+
# set the apparent wind speed
19+
v_app = 10.0
20+
# set the depower setting
21+
ud_prime = 0.5
22+
# linearize the NDI block
23+
u_s, ndi_gain = linearize(pc, psi_dot, psi, elevation, v_app; ud_prime)
24+
@test u_s 0.41666666666666674
25+
@test ndi_gain 4.166666666666667
26+
end
27+
28+
29+
# function test_calc_steering()
30+
# @testset "test_calc_steering" begin
31+
# # set the parameters of the parking controller
32+
# pcs = ParkingControllerSettings(dt=0.05)
33+
# pcs.kp_tr=1.05
34+
# pcs.ki_tr=0.012
35+
# # create the parking controller
36+
# pc = ParkingController(pcs)
37+
# # set the heading
38+
# heading = deg2rad(1.0)
39+
# elevation = deg2rad(70.0)
40+
# chi_set = deg2rad(34.0)
41+
# u_s, ndi_gain, psi_dot, psi_dot_set = calc_steering(pc, heading, chi_set; elevation)
42+
# @test u_s ≈ 18.135061759003584
43+
# @test ndi_gain ≈ 2.0833333333333335
44+
# @test psi_dot ≈ 0.3490658503988659
45+
# @test psi_dot_set ≈ 8.639379797371932
46+
# end
47+
# nothing
48+
# end
49+
50+
# function test_navigate()
51+
# @testset "test_navigate" begin
52+
# # set the parameters of the parking controller
53+
# pcs = ParkingControllerSettings(dt=0.05)
54+
# pcs.kp=1.05
55+
# pcs.ki=0.012
56+
# # create the parking controller
57+
# pc = ParkingController(pcs)
58+
# # set the azimuth
59+
# azimuth = deg2rad(90.0)
60+
# # set the elevation
61+
# elevation = deg2rad(70.0)
62+
# chi_set = navigate(pc, azimuth, elevation)
63+
# @test chi_set ≈ -deg2rad(34.019878734151234)
64+
# end
65+
# nothing
66+
# end
67+
68+
# function test_parking_controller()
69+
# @testset verbose=true "test_parking_controller" begin
70+
# test_calc_steering()
71+
# test_linearize()
72+
# test_navigate()
73+
# end
74+
# nothing
75+
# end
676
end

0 commit comments

Comments
 (0)