ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I created a solution to this using a bootstrapping technique: subscribe to an AnyMsg with a regular rospy.Subscriber callback, then look in _connection_header['message_definition']
for Header header
, if it exists import the message type using exec()
, then resubscribe with a message_filters.Subscriber using eval()
and create the TimeSynchronizer, unregister the bootstrap subscriber.
It would be nice to have a solution that doesn't use exec or eval though.
2 | No.2 Revision |
I created a solution to this using a bootstrapping technique: subscribe to an AnyMsg with a regular rospy.Subscriber callback, then look in _connection_header['message_definition']
for Header header
, then if it has it:
import roslib.message
...
topic_type = msg._connection_header['type']
topic_class = roslib.message.get_message_class(topic_type)
sub = message_filters.Subscriber("foo", topic_class)
__import__
or importlib - need an example.
if it exists import the message type using exec()
, then resubscribe with a message_filters.Subscriber using eval()
and create the TimeSynchronizer, unregister the bootstrap subscriber.
It would be nice to have a solution that doesn't use Using exec or and eval though.is undesirable for security reasons.
3 | No.3 Revision |
I created a solution to this using a bootstrapping technique: subscribe to an AnyMsg with a regular rospy.Subscriber callback, then look in _connection_header['message_definition']
for Header header
then if it has it:
import roslib.message
...
topic_type = msg._connection_header['type']
topic_class = roslib.message.get_message_class(topic_type)
bootstrap_sub.unregister()
sub = message_filters.Subscriber("foo", topic_class)
__import__
or importlib - need an example.
if it exists import the message type using exec()
, then resubscribe with a message_filters.Subscriber using eval()
and create the TimeSynchronizer, unregister the bootstrap subscriber.
Using exec and eval is undesirable for security reasons.