Files
kinect/tests/contract_reader_probe.cpp
kinect-bot 0af22f1783
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python tracker (pytest) (push) Canceled after 0s
feat(calibration,contract,tracker): T-pose calibration + seqlock fix + articulated-depth wiring (wave 8a; todos 11,20,21 done)
2026-11-25 05:47:19 -05:00

46 lines
1.1 KiB
C++

#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstdio>
#include <string>
#include "contract/contract.h"
int main(int argc, char** argv) {
if (argc != 2) {
return 2;
}
const std::string name = "/" + std::string(argv[1]);
const int fd = shm_open(name.c_str(), O_RDONLY, 0);
if (fd < 0) {
return 3;
}
void* map = mmap(
nullptr,
sizeof(nui::contract::FrameContract),
PROT_READ,
MAP_SHARED,
fd,
0);
if (map == MAP_FAILED) {
close(fd);
return 4;
}
const auto* contract =
static_cast<const nui::contract::FrameContract*>(map);
nui::contract::FrameData frame{};
nui::contract::read_latest_frame(*contract, frame);
std::printf(
"published=%llu frame=%u slot_sequence=%llu\n",
static_cast<unsigned long long>(contract->published_sequence),
frame.frame_number,
static_cast<unsigned long long>(
contract->slots[
contract->published_sequence % nui::contract::kFrameSlotCount]
.sequence));
munmap(map, sizeof(nui::contract::FrameContract));
close(fd);
return 0;
}