feat(calibration,contract,tracker): T-pose calibration + seqlock fix + articulated-depth wiring (wave 8a; todos 11,20,21 done)
This commit is contained in:
1 parent
b1638944cb
commit
0af22f1783
16 files changed
+733
-49
No files matched your search
@@ -0,0 +1,45 @@
|
||||
#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;
|
||||
}
|
||||
Reference in new issue
Block a user