VIS4ROB-lab / covins

COVINS-(G) -- A (Generic) Framework for Collaborative Visual-Inertial SLAM and Multi-Agent 3D Mapping
366 stars 63 forks source link

There is a problem transmitting data from the server to the client #23

Closed WuZihao12 closed 2 years ago

WuZihao12 commented 2 years ago

Hello, I want to transmit msg.T_w_s = T_ws from the server to the client; but the client always receives the unit array. why this msg.T_sref_s = T_w_sref.inverse() * T_ws; can be transmitted Screenshot from 2022-06-08 16-58-56

WuZihao12 commented 2 years ago

Screenshot from 2022-06-08 17-00-51 What the client receives is always the identity matrix

ThomasZiegler commented 2 years ago

Hi, That seems strange. The identity matrix is the default value https://github.com/VIS4ROB-lab/covins/blob/f505b45e2d23734b2a4d58fc36dd4e2987090884/covins_comm/include/covins/covins_base/msgs/msg_keyframe.hpp#L93 so I assume it does not correctly store the value in the message.

Can you check if after converting the KF to the message, the message really contains the correct value of T_w_s_. So check msg_kf after here https://github.com/VIS4ROB-lab/covins/blob/e21f25992369d39c9abb920259dd8fef3f30d973/covins_backend/src/covins_backend/communicator_be.cpp#L66

Btw. it's not good practice to add screenshots of code, instead link to the line of code in the corresponding file (as I did). Otherwise it can be quite hard to figure out which part of code from which file you are referencing to. See here how this can be done.

WuZihao12 commented 2 years ago

Thanks for your suggestion. I just tried it,after converting the KF to the message,the message msg_kf really contains the correct value of T_ws.

WuZihao12 commented 2 years ago

https://github.com/VIS4ROB-lab/covins/blob/e21f25992369d39c9abb920259dd8fef3f30d973/covins_backend/src/covins_backend/communicator_be.cpp#L66 I added the test output code under this line of code: std::cout << "msg_kf: \n" << msg_kf.T_w_s << std::endl; I see that it outputs not an identity matrix.

ThomasZiegler commented 2 years ago

Then the problem is in the transmission. And I just checked and it looks like this parameter is not defined in the serialization (which means it is not transmitted).

You probably just need to add T_w_s after e.g. T_sref_s in the serialization save https://github.com/VIS4ROB-lab/covins/blob/f505b45e2d23734b2a4d58fc36dd4e2987090884/covins_comm/include/covins/covins_base/msgs/msg_keyframe.hpp#L136-L139 and load method https://github.com/VIS4ROB-lab/covins/blob/f505b45e2d23734b2a4d58fc36dd4e2987090884/covins_comm/include/covins/covins_base/msgs/msg_keyframe.hpp#L172-L175

Edit: The methods above are only for updated KF messages. If you need this variable also for new KFs (so the first time they are sent to the server) you need need to add T_w_s also in the following methods: https://github.com/VIS4ROB-lab/covins/blob/f505b45e2d23734b2a4d58fc36dd4e2987090884/covins_comm/include/covins/covins_base/msgs/msg_keyframe.hpp#L141-L152 https://github.com/VIS4ROB-lab/covins/blob/f505b45e2d23734b2a4d58fc36dd4e2987090884/covins_comm/include/covins/covins_base/msgs/msg_keyframe.hpp#L177-L188

WuZihao12 commented 2 years ago

Thanks for your answer, I know the reason for the problem.

ThomasZiegler commented 2 years ago

Okay, in this case I close this issue. Feel free to reopen it if you encounter additional problems related to this issue.