Closed YujieLu closed 1 year ago
Hi @YujieLu, you are using the eCAL Release build which is packaged with Protobuf 3.11.4. In C#, this Protobuf version does not offer the functionality which is necessary for reflection in the monitor. The necessary functionality on Protobuf side was introduced with a release ~3.18 (not 100% sure).
If you want to be able to use the reflection, you will need a custom eCAL build with a newer Protobuf version. We have an open issue to upgrade Protobuf to 3.21 for our default builds, #1187
@KerstinKeller Thank you very much for your reply.
It is very strange that it works well with the sample code without changing the environment.
And if i modified the code, the topic "person" will still be okay, but the topic "dog" will have the same error.
static void Main()
{
// initialize eCAL API
Util.Initialize("Person Send C#");
// print version info
System.Console.WriteLine(String.Format("eCAL {0} ({1})\n", Util.GetVersion(), Util.GetDate()));
// create a publisher (topic name "Hello", type "base:std::string", description "")
var publisher = new ProtobufPublisher<Pb.People.Person>("person");
var publisher2 = new ProtobufPublisher<Pb.Animal.Dog>("dog");
// idle main thread
int loop = 0;
var dog = new Pb.Animal.Dog { Name = "Brandy" };
var person = new Pb.People.Person
{ Id = 0,
Email = "max@online.de",
Name = "Max",
Stype = Pb.People.Person.Types.SType.Female,
Dog = dog,
House = new Pb.Environment.House { Rooms = 4 }
};
while (Util.Ok())
{
// message to send
person.Id = loop;
loop++;
// print message
System.Console.WriteLine(String.Format("Sending: {0}", person.ToString()));
System.Console.WriteLine(String.Format("Sending: {0}", dog.ToString()));
// send the content
publisher.Send(person);
publisher2.Send(dog);
// cool down
System.Threading.Thread.Sleep(500);
}
// finalize eCAL API
Util.Terminate();
}
@YujieLu, This looks like you probably had a publisher on person
, that also sent a descriptor. For example, you had the C++ sample ecal_sample_person_snd running for a second. The eCAL Monitor was then able to grab the descriptor and store it in a database. Later, when your C# sample publishes to the same topic, the eCAL Monitor still has that descriptor around and will use it, as it didn't get anything newer.
If you close all eCAL Application and then only start the Monitor and the person C# sample, you should get the exact same error message.
@FlorianReimold yes, you are right. I got the same error. @KerstinKeller I tried to recompile ecal with 3.20.3. it doesn't work.
------------------------- SYSTEM ---------------------------------
Version : v5.11.5-dirty (24.07.2023)
Platform : x64
------------------------- CONFIGURATION --------------------------
Default INI : [C:\ProgramData\eCAL\ecal.ini](file:///C:/ProgramData/eCAL/ecal.ini)
------------------------- NETWORK --------------------------------
Host name : LAPTOP-QARRQ79A
Network mode : local
Network ttl : 2
Network sndbuf : 5 MByte
Network rcvbuf : 5 MByte
Multicast group : 239.0.0.1
Multicast mask : 0.0.0.15
Multicast ports : 14000 - 14010
Multicast join all IFs : off
Bandwidth limit (udp) : not limited
------------------------- TIME -----------------------------------
Synchronization realtime : "ecaltime-localtime"
Synchronization replay :
State : synchronized
Master / Slave : Master
Status (Code) : "everything is fine." (0)
------------------------- PUBLISHER LAYER DEFAULTS ---------------
Layer Mode INPROC : off
Layer Mode SHM : auto
Layer Mode TCP : off
Layer Mode UDP MC : auto
------------------------- SUBSCRIPTION LAYER DEFAULTS ------------
Layer Mode INPROC : on
Layer Mode SHM : on
Layer Mode TCP : on
Layer Mode UDP MC : on
Npcap UDP Reciever : off
more serious problem is that if i use c# program to send messages, use c++ program to recieve messages, the message sent and the message recieved are not exactly the same!!!
What exactly makes you believe that the received message differs from the sent message? To me it looks like you need to scroll down / up 1 message. The message with id 402 is the upper-most message in your left console window
Oh, and I think you have to use eCAL 5.12 or master for proper C# + protobuf reflection support. The old 5.11 branch doesn't have that. This is from the 5.12.0 changelog:
@KerstinKeller I tried Ecal5.12 + Protobuf 3.21.12, it works! Thank you!
Problem Description
I'm trying to use csharp to pub ecal messages. The messages seem to be published, but not properly. I got the Error of "ERROR : CDynamicSubScriber: Could not get description for topic pose" when i was trying to watch the content of the topic using eCal Monitor.
How to reproduce
I used the protoc.exe in C:\eCAL\bin, and the following command to generate the c# code.
The proto file and generated cs file can be find here: Protobuf.zip
Following is my pub code. it is quite simple:
How did you get eCAL?
Download from Release Page
Environment
eCAL System Information