feat(tracker-native): kinect_tracker.log diagnostics for playtest
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python root tests (pytest, no tracker deps) (push) Canceled after 0s
ci / Python tracker (pytest, tracker/.venv) (push) Canceled after 0s

Adds a ShimLog-style trace log next to the exe (startup, camera enumeration,
negotiated capture format + MF_MT_DEFAULT_STRIDE, per-N-frame presence/tracked,
shm CreateFileMapping result, errors) so the first real-hardware run is
diagnosable instead of blind - mirrors how kinect_shim.log drove the shim fixes.
Logs the camera stride so a top-down/bottom-up RGB32 image-flip is immediately
visible.
This commit is contained in:
kinect-bot committed 2026-11-25 19:04:20 -05:00
1 parent 31178f1675
commit b2513c5722
5 files changed
+96 -2

No files matched your search

+23 -2
View File
@@ -11,6 +11,7 @@
#include "frame_pipeline.h"
#include "pose_estimator.h"
#include "shm_publisher.h"
#include "trace_log.h"
#include "win_camera.h"
using namespace kinect_tracker;
@@ -115,12 +116,16 @@ void DrawOverlay(std::vector<uint8_t>& bgra, int w, int h, const PoseResult& pos
void WorkerLoop(std::wstring symlink, int req_w, int req_h) {
Camera camera;
if (!camera.open(symlink, req_w, req_h)) {
TraceLog("WorkerLoop: camera.open(%dx%d) FAILED", req_w, req_h);
SetStatus("ERROR: could not open camera");
g_app.running = false;
return;
}
PoseEstimator estimator(ModelPath().c_str());
const std::string model_path = ModelPath();
TraceLog("WorkerLoop: camera open, loading model '%s'", model_path.c_str());
PoseEstimator estimator(model_path.c_str());
TraceLog("WorkerLoop: model loaded, entering capture loop");
PipelineConfig cfg;
FramePipeline pipeline(g_app.shm_base, cfg);
@@ -157,6 +162,11 @@ void WorkerLoop(std::wstring symlink, int req_w, int req_h) {
const int64_t ts_us = (now.QuadPart - t0_now.QuadPart) * 1000000 / freq.QuadPart;
pipeline.publish(++frame_number, ts_us, tracked ? &pose : nullptr, bgra.data(), w, h);
if (frame_number <= 3 || frame_number % 150u == 0) {
TraceLog("frame#%u %dx%d presence=%.3f tracked=%d",
frame_number, w, h, pose.presence, tracked ? 1 : 0);
}
std::vector<uint8_t> overlay = bgra;
if (tracked) DrawOverlay(overlay, w, h, pose);
{
@@ -177,9 +187,13 @@ bool StartShm() {
g_app.mapping = CreateFileMappingW(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE,
static_cast<DWORD>((region >> 32) & 0xffffffffu),
static_cast<DWORD>(region & 0xffffffffu), kShmName);
if (!g_app.mapping) return false;
if (!g_app.mapping) {
TraceLog("shm CreateFileMapping FAILED err=%lu", GetLastError());
return false;
}
g_app.shm_base = static_cast<uint8_t*>(
MapViewOfFile(g_app.mapping, FILE_MAP_ALL_ACCESS, 0, 0, region));
TraceLog("shm '%ls' region=%zu mapped=%d", kShmName, region, g_app.shm_base ? 1 : 0);
return g_app.shm_base != nullptr;
}
@@ -220,6 +234,8 @@ void StartCapture() {
}
g_app.running = true;
const CameraResolution res = g_app.resolutions[rsel];
TraceLog("Start: device[%d]='%s' %dx%d", dsel, g_app.devices[dsel].name.c_str(),
res.width, res.height);
g_app.worker = std::thread(WorkerLoop, g_app.devices[dsel].symbolic_link, res.width,
res.height);
SetWindowTextA(g_app.start_btn, "Stop");
@@ -272,6 +288,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
512, 12, 300, 20, hwnd,
reinterpret_cast<HMENU>(kIdStatus), inst, nullptr);
g_app.devices = enumerate_cameras();
TraceLog("enumerated %zu camera(s)", g_app.devices.size());
for (const auto& d : g_app.devices) {
TraceLog(" camera: %s", d.name.c_str());
}
for (const auto& d : g_app.devices) {
SendMessageA(g_app.device_combo, CB_ADDSTRING, 0,
reinterpret_cast<LPARAM>(d.name.c_str()));
@@ -327,6 +347,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
int WINAPI wWinMain(HINSTANCE inst, HINSTANCE, PWSTR, int show) {
CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
MFStartup(MF_VERSION);
TraceLog("==== kinect-tracker starting ====");
WNDCLASSW wc{};
wc.lpfnWndProc = WndProc;