diff --git a/applications/gui2/src/modules/camera.cpp b/applications/gui2/src/modules/camera.cpp index 352d2c67b6013a7970fd2a7d9bd3489c33ac7ea7..24eec071bab4ccccc4a8bf7e930ffcb612b8cc48 100644 --- a/applications/gui2/src/modules/camera.cpp +++ b/applications/gui2/src/modules/camera.cpp @@ -140,3 +140,11 @@ bool Camera::hasFrame() { } return false; } + +void Camera::sendPose(const Eigen::Matrix4d &pose) { + if (auto ptr = std::atomic_load(¤t_fs_)) { + auto response = ptr->frames[frame_idx].response(); + auto &rgbdresponse = response.cast<ftl::rgbd::Frame>(); + rgbdresponse.setPose() = pose; + } +} diff --git a/applications/gui2/src/modules/camera.hpp b/applications/gui2/src/modules/camera.hpp index 3ecdf949b299f498adf74a8fcbd860b97285ac23..018ee20c435f8b55944727daecf0e0c59db9333c 100644 --- a/applications/gui2/src/modules/camera.hpp +++ b/applications/gui2/src/modules/camera.hpp @@ -30,6 +30,8 @@ public: /** Check if new frame is available */ bool hasFrame(); + void sendPose(const Eigen::Matrix4d &pose); + ftl::render::Colouriser* colouriser() { return colouriser_.get(); }; ftl::overlay::Overlay* overlay() { return overlay_.get(); } diff --git a/applications/gui2/src/views/camera3d.cpp b/applications/gui2/src/views/camera3d.cpp index 885e3864129f3308211f4ffab50778869accb21f..37b1fa8f1da0faf2d90e92a116efa9ba98ac2f3d 100644 --- a/applications/gui2/src/views/camera3d.cpp +++ b/applications/gui2/src/views/camera3d.cpp @@ -1,4 +1,5 @@ #include "camera3d.hpp" +#include "../modules/camera.hpp" using ftl::gui2::CameraView3D; @@ -55,7 +56,8 @@ bool CameraView3D::keyboardEvent(int key, int scancode, int action, int modifier //transform_ix_ = ix-1; } - LOG(INFO) << "New pose: \n" << getUpdatedPose(); + //LOG(INFO) << "New pose: \n" << getUpdatedPose(); + //ctrl_->sendPose(getUpdatedPose()); return true; } @@ -72,7 +74,8 @@ bool CameraView3D::mouseMotionEvent(const Eigen::Vector2i &p, const Eigen::Vecto rx_ += rel[0]; ry_ += rel[1]; - LOG(INFO) << "New pose: \n" << getUpdatedPose(); + //LOG(INFO) << "New pose: \n" << getUpdatedPose(); + //ctrl_->sendPose(getUpdatedPose()); return true; } @@ -107,5 +110,6 @@ Eigen::Matrix4d CameraView3D::getUpdatedPose() { void CameraView3D::draw(NVGcontext* ctx) { imview_->fit(); // TODO: should be moved to ::performLayout(ctx)? + ctrl_->sendPose(getUpdatedPose()); CameraView::draw(ctx); }