-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
Hi,
As discussed in #849 , I'm testing the broadcasting of camera data from a PC where the camera is connected to a PC used for processing.
Here is setup:
- PC1 with Azure Kinect connected and PlusServer running with the default config file
- PC2 with:
- server running using the configuration file detailed below
- a client connected to the local server
If I remove ImageMessageEmbeddedTransformName="VideoStreamRGBToVideoStreamRGB" from the PC2 server config file, I never receive any data:
|WARNING|001.203191| No data is broadcasted, as no data is available yet.| in source_subfolder/src/PlusServer/vtkPlusOpenIGTLinkServer.cxx(440)
If I set it, I correctly receive the image. But I've some error logs that make me worry:
ERROR|001.234576| Setting a transform to itself is not allowed: VideoStreamRGBToVideoStreamRGB| in /source_subfolder/Source/IGSIOCommon/vtkIGSIOTransformRepository.cxx(153)
My goal is to receive the image without any error log bound to the receiving process :)
NOTE: I have no problem retrieving the camera data through a direct connection to the PC1 server with the PC2 client.
Here are some details about the configuration and code I use.
PC2 server config:
<PlusConfiguration version="2.4">
<DataCollection StartupDelaySec="1.0">
<Device Id="KinectRemoteRGBDevice" Type="OpenIGTLinkVideo" ImageMessageEmbeddedTransformName="VideoStreamRGBToVideoStreamRGB" MessageType="IMAGE" ServerAddress="195.83.246.66" ServerPort="18945" IgtlMessageCrcCheckEnabled="false">
<DataSources>
<DataSource Type="Video" Id="Video" PortUsImageOrientation="UN" />
</DataSources>
<OutputChannels>
<OutputChannel Id="VideoStreamRGB" VideoDataSourceId="Video" />
</OutputChannels>
</Device>
</DataCollection>
<PlusOpenIGTLinkServer MaxNumberOfIgtlMessagesToSend="1" MaxTimeSpentWithProcessingMs="50" ListeningPort="18944" SendValidTransformsOnly="true" OutputChannelId="VideoStreamRGB">
<DefaultClientInfo>
<MessageTypes>
<Message Type="IMAGE" />
</MessageTypes>
<ImageNames>
<Image Name="VideoStreamRGB" EmbeddedTransformToFrame="VideoStreamRGB" />
</ImageNames>
</DefaultClientInfo>
</PlusOpenIGTLinkServer>
</PlusConfiguration>
PC2 client code snippet (without detailed error handling):
/*
main.cpp
*/
// Launch server
dataCollector->ReadConfiguration(inputConfigFileName)
vtkXMLDataElement *configRootElement = vtkPlusConfig::GetInstance()->GetDeviceSetConfigurationData();
vtkNew<vtkIGSIOTransformRepository> transformRepository;
transformRepository->ReadConfiguration(configRootElement);
dataCollector->Connect();
dataCollector->Start();
// ...
server->Start(dataCollector.GetPointer(), transformRepository.GetPointer(), serverElement, vtkPlusConfig::GetInstance()->GetDeviceSetConfigurationFileName());
// In a loop:
server->ProcessPendingCommands();
// ...
// Run client
auto client = vtkSmartPointer<vtkPlusOpenIGTLinkClientWithTransformLogging>::New();
client->SetServerHost("127.0.0.1");
client->SetServerPort(server->GetListeningPort());
client->Connect(2.0) ;
/*
vtkPlusOpenIGTLinkClientWithTransformLogging.cpp
*/
bool OnMessageReceived(igtl::MessageHeader::Pointer messageHeader)
{
bool messageBodyReceived = false;
igtl::MessageBase::Pointer bodyMsg = this->IgtlMessageFactory->CreateReceiveMessage(messageHeader);
if (bodyMsg.IsNull())
{
LOG_ERROR("Unable to create message of type: " << messageHeader->GetMessageType());
return false;
}
if (typeid(*bodyMsg) == typeid(igtl::ImageMessage))
{
igtl::ImageMessage::Pointer imageMsg = dynamic_cast<igtl::ImageMessage *>(bodyMsg.GetPointer());
imageMsg->SetMessageHeader(messageHeader);
imageMsg->AllocatePack();
SocketReceive(imageMsg->GetBufferBodyPointer(), imageMsg->GetBufferBodySize());
messageBodyReceived = true;
int c = imageMsg->Unpack(1);
if (!(c & igtl::MessageHeader::UNPACK_BODY))
{
LOG_ERROR("Failed to receive IMAGE reply (invalid body)");
return messageBodyReceived;
}
LOG_INFO("Matrix for " << imageMsg->GetDeviceName() << " IMAGE received: ");
}
}
else if (typeid(*bodyMsg) == typeid(igtl::StatusMessage))
{
//std::cout << "Device type " << std::string(messageHeader->GetDeviceType()) << std::endl;
igtl::StatusMessage::Pointer statusMessage = dynamic_cast<igtl::StatusMessage *>(bodyMsg.GetPointer());
statusMessage->SetMessageHeader(messageHeader);
statusMessage->AllocatePack();
SocketReceive(statusMessage->GetBufferBodyPointer(), statusMessage->GetBufferBodySize());
messageBodyReceived = true;
int c = statusMessage->Unpack(1);
if (!(c & igtl::MessageHeader::UNPACK_BODY))
{
LOG_ERROR("Failed to receive STATUS reply (invalid body)");
return messageBodyReceived;
}
LOG_INFO("Status message code " << statusMessage->GetCode());
LOG_INFO("Status message subcode " << statusMessage->GetSubCode());
LOG_INFO("Status error name " << statusMessage->GetErrorName());
LOG_INFO("Status status string " << statusMessage->GetStatusString());
}
else
{
LOG_INFO("Received " << messageHeader->GetMessageType() << " message.");
}
return messageBodyReceived;
}
Metadata
Metadata
Assignees
Labels
No labels