Skip to content

Commit

Permalink
add test for GetPIDVals
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston committed Sep 5, 2024
1 parent b4db62f commit 969a31e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions control/control_loop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ func TestControlLoop(t *testing.T) {
}

func TestMultiSignalLoop(t *testing.T) {
expectedPIDVals := PIDConfig{
P: 10.0,
I: 0.2,
D: 0.5,
}
logger := logging.NewTestLogger(t)
cfg := Config{
Blocks: []BlockConfig{
Expand All @@ -342,9 +347,9 @@ func TestMultiSignalLoop(t *testing.T) {
Name: "pid_block",
Type: "PID",
Attribute: utils.AttributeMap{
"kP": 10.0, // random for now
"kD": 0.5,
"kI": 0.2,
"kP": expectedPIDVals.P, // random for now
"kD": expectedPIDVals.D,
"kI": expectedPIDVals.I,
},
DependsOn: []string{"gain_block"},
},
Expand Down Expand Up @@ -381,5 +386,8 @@ func TestMultiSignalLoop(t *testing.T) {
cLoop.Start()
test.That(t, err, test.ShouldBeNil)

pidVals := cLoop.GetPIDVals(0)
test.That(t, pidVals, test.ShouldResemble, expectedPIDVals)

cLoop.Stop()
}

0 comments on commit 969a31e

Please sign in to comment.