Fix steering/throttle controls

This commit is contained in:
cyrilix committed 2021-02-08 23:33:31 +01:00
1 parent 5a99160f65
commit d0c8ef76fc
3 files changed
+72 -70

No files matched your search

+48 -48
View File
@@ -19,37 +19,37 @@ func TestGateway_WriteSteering(t *testing.T) {
nil,
simulator.ControlMsg{
MsgType: "control",
Steering: 0.5,
Throttle: 0,
Brake: 0,
Steering: "0.50",
Throttle: "0.0",
Brake: "0.0",
}},
{"Update steering",
&events.SteeringMessage{Steering: -0.5, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0,
Brake: 0,
Steering: "0.2",
Throttle: "0.0",
Brake: "0.0",
},
simulator.ControlMsg{
MsgType: "control",
Steering: -0.5,
Throttle: 0,
Brake: 0,
Steering: "-0.50",
Throttle: "0.0",
Brake: "0.0",
}},
{"Update steering shouldn't erase throttle value",
&events.SteeringMessage{Steering: -0.3, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.6,
Brake: 0.1,
Steering: "0.2",
Throttle: "0.6",
Brake: "0.1",
},
simulator.ControlMsg{
MsgType: "control",
Steering: -0.3,
Throttle: 0.6,
Brake: 0.1,
Steering: "-0.30",
Throttle: "0.6",
Brake: "0.1",
}},
}
@@ -96,79 +96,79 @@ func TestGateway_WriteThrottle(t *testing.T) {
nil,
simulator.ControlMsg{
MsgType: "control",
Steering: 0,
Throttle: 0.5,
Brake: 0,
Steering: "0.0",
Throttle: "0.50",
Brake: "0.0",
}},
{"Update Throttle",
&events.ThrottleMessage{Throttle: 0.6, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0,
Throttle: 0.4,
Brake: 0,
Steering: "0",
Throttle: "0.4",
Brake: "0",
},
simulator.ControlMsg{
MsgType: "control",
Steering: 0,
Throttle: 0.6,
Brake: 0,
Steering: "0",
Throttle: "0.60",
Brake: "0.0",
}},
{"Update steering shouldn't erase throttle value",
&events.ThrottleMessage{Throttle: 0.3, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.6,
Brake: 0.,
Steering: "0.2",
Throttle: "0.6",
Brake: "0.0",
},
simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.3,
Brake: 0.,
Steering: "0.2",
Throttle: "0.30",
Brake: "0.0",
}},
{"Throttle to brake",
&events.ThrottleMessage{Throttle: -0.7, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.6,
Brake: 0.,
Steering: "0.2",
Throttle: "0.6",
Brake: "0.0",
},
simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.,
Brake: 0.7,
Steering: "0.2",
Throttle: "0.0",
Brake: "0.70",
}},
{"Update brake",
&events.ThrottleMessage{Throttle: -0.2, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.,
Brake: 0.5,
Steering: "0.2",
Throttle: "0.0",
Brake: "0.5",
},
simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.,
Brake: 0.2,
Steering: "0.2",
Throttle: "0.0",
Brake: "0.20",
}},
{"Brake to throttle",
&events.ThrottleMessage{Throttle: 0.9, Confidence: 1},
&simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.,
Brake: 0.4,
Steering: "0.2",
Throttle: "0.0",
Brake: "0.4",
},
simulator.ControlMsg{
MsgType: "control",
Steering: 0.2,
Throttle: 0.9,
Brake: 0.,
Steering: "0.2",
Throttle: "0.90",
Brake: "0.0",
}},
}