scouting: Fix types for action timestamps and cycle times
Since we measure in nanoseconds (to be in line with what the robot
code does) we need a bigger type than `int32`. This patch changes
these fields to be `int64` instead.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Ibffc37e74b333ae12330ab1c4fedd34879113a9d
diff --git a/scouting/webserver/requests/messages/request_2023_data_scouting_response.fbs b/scouting/webserver/requests/messages/request_2023_data_scouting_response.fbs
index d9d36b3..93583ce 100644
--- a/scouting/webserver/requests/messages/request_2023_data_scouting_response.fbs
+++ b/scouting/webserver/requests/messages/request_2023_data_scouting_response.fbs
@@ -24,7 +24,8 @@
middle_cones:int (id:16);
high_cones:int (id:17);
cones_dropped:int (id:18);
- avg_cycle:int (id:19);
+ // Time in nanoseconds.
+ avg_cycle:int64 (id:19);
collected_by:string (id:20);
}
@@ -33,4 +34,4 @@
stats_list:[Stats2023] (id:0);
}
-root_type Request2023DataScoutingResponse;
\ No newline at end of file
+root_type Request2023DataScoutingResponse;
diff --git a/scouting/webserver/requests/messages/submit_actions.fbs b/scouting/webserver/requests/messages/submit_actions.fbs
index ebbaa5c..5488a79 100644
--- a/scouting/webserver/requests/messages/submit_actions.fbs
+++ b/scouting/webserver/requests/messages/submit_actions.fbs
@@ -50,7 +50,7 @@
}
table Action {
- timestamp:int (id:0);
+ timestamp:int64 (id:0);
action_taken:ActionType (id:2);
}
@@ -61,4 +61,4 @@
comp_level:string (id: 3);
actions_list:[Action] (id:4);
collected_by:string (id: 5);
-}
\ No newline at end of file
+}
diff --git a/scouting/webserver/requests/requests.go b/scouting/webserver/requests/requests.go
index 39f344e..6f83bfe 100644
--- a/scouting/webserver/requests/requests.go
+++ b/scouting/webserver/requests/requests.go
@@ -590,7 +590,7 @@
}
}
if cycles != 0 {
- stat.AvgCycle = int32(overall_time / cycles)
+ stat.AvgCycle = overall_time / cycles
} else {
stat.AvgCycle = 0
}