diff options
author | Martin Miller | 2017-03-22 15:47:00 -0500 |
---|---|---|
committer | Martin Miller | 2017-03-22 15:47:00 -0500 |
commit | 50834b4ba0904a13242476cc515f85fda4f30844 (patch) | |
tree | 4f8fa5f22710482d5b9df394185921ad4889a44c /src/main.cpp | |
parent | d020ec03598b90fb8d78194554471b1cfb4794dd (diff) | |
download | refslam-50834b4ba0904a13242476cc515f85fda4f30844.zip refslam-50834b4ba0904a13242476cc515f85fda4f30844.tar.gz |
Add feature handling to state
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index af602c5..390a57e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,8 +43,9 @@ covCallback(const message &msg, State &mu, const Quaterniond &q) } void -imgCallback(message &msg) +imgCallback(message &msg, State &mu, Camera &cam, const Quaterniond &q) { + std::vector<measurement_t> z; int id,sx,sy,rx,ry; strcat(msg.image_names[0],".txt"); FILE *fin; @@ -52,11 +53,21 @@ imgCallback(message &msg) err_sys("fopen: %s", msg.image_names[0]); } while (fscanf(fin,"%d,%d,%d,%d,%d", &id, &sx, &sy, &rx, &ry)!=EOF) { - printf("id: %d source: (%d, %d) reflection: (%d, %d)\n", id, sx, sy, rx, ry); + measurement_t m; + m.id = id; + // Points in the image frame + Vector3d xi, xir; + xi << sx, sy, 1.; + xir << rx, ry, 1.; + // Points in the camera frame + m.source = cam.img2body(xi); + m.reflection = cam.img2body(xir); + z.push_back(m); } if (fclose(fin)==EOF) { err_sys("fclose"); } + mu.feature_update(z,q); return; } @@ -261,7 +272,7 @@ while (scanf("%s", line)!=EOF) { break; case IMG: - imgCallback(msg); + imgCallback(msg, mu, cam, qbw); break; case INSPVAS: |