Hi all, running into some unusual behaviour attempting to log sensor readings. I’m grabbing the telemetry feed from several HW ESCs and attempting to log the values at each successful read. The messages arrive at roughly 13Hz per ESC thus I am logging at roughly 13*no. of ESCs a second (The telemetry feeds are not necessarily in sync).
I am attempting to create an output as below, where each ESC gets its own log message corresponding to its instance (HET0, HET1, HET2 etc). Each message contains the same data columns though obviously with differing data for each ESC. The data should look like this:
HET0, 56510875, 0.1339198, 0.1339198, 1283, 0.1, 1, 45.5, 191, 193
HET1, 56510918, 0.1319648, 0.1319648, 1261, 0.1, 1, 45.4, 192, 194
HET2, 56510962, 0.1309873, 0.1309873, 1278, 0, 0.8, 45.2, 188, 189
HET3, 56512164, 0.1300098, 0.1300098, 1262, 0.1, 1, 45.2, 187, 191
Instead I am getting the below output:
MSG, 56510859, HET0
HET0, 56510875, 0.1339198, 0.1339198, 1283, 0.1, 1, 45.5, 191, 193
MSG, 56510907, HET1
HET0, 56510918, 0.1319648, 0.1319648, 1261, 0.1, 1, 45.4, 192, 194
MSG, 56510949, HET2
HET0, 56510962, 0.1309873, 0.1309873, 1278, 0, 0.8, 45.2, 188, 189
MSG, 56512145, HET3
HET0, 56512164, 0.1300098, 0.1300098, 1262, 0.1, 1, 45.2, 187, 191
The log write command I issue is as below.
char test[5];
hal.util->snprintf(test, 5, "HET\%1i", state.instance);
GCS_SEND_TEXT(MAV_SEVERITY_WARNING, test);
AP::logger().Write(test,
"TimeUS,thr_in,thr_out,rpm,cur_in,cur_out,vol_in,temp_cap,temp_mos",
"s%%qAAvOO",
"F00000000",
"Qffffffff",
AP_HAL::micros64(),
(double)state.thr_in,
(double)state.thr_out,
(double)state.rpm,
(double)state.cur_in,
(double)state.cur_out,
(double)state.vol_in,
(double)state.temp_cap,
(double)state.temp_mos);
I have verified the data being saved is the correct data. Each row, despite being labelled as HET0, is in fact relevant to each seperate ESC. As you can see I print the label string to the console on each write and this executes exactly as expected and yet the log function using the exact same string fails.
I am able to successfully write a single message say HWET with the same contents plus an additional column of the instance, however this destroys any functionality in log analysis or similar as the same message jumps between ESCs and makes it near impossible to graph it in any sensible fashion without first filtering out the unwanted instances.