Extracting message type in callback (Python)
Hey all, I want to extract data of a specific type from the message in the callback. I have only one callback where I get messages from different topics of different type like Float64, Odometry,.etc. Now I want to extract only the data of type Quaternion in side any message of any topic. My call back looks like (although its not correctly working): def callback(self, msg, arg): for m in msg.__slots__: if type(m) == [Quaternion]: self.process(m) but Quaternion is not directly recognized. Also I have to dig into the messages like Odometry has quaternion data but inside the pose.pose.position, how to check the whole structure of message for quaternion datatype data. Thanks in advance,
Are you sure that you can't find a better/cleaner design for what you want? Seem's kinda odd to me.
thanks for the suggestion! can you please just write me a hint for the better/cleaner design.I just want to extract Quaternion data xywz (if any) from the msgs, AND I do not know in prior how many topics I shall get and of which type. so I have one generic callback for all the topics...regards
The thing is that I"m not sure why you'd want something like that.