ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thanks for the reply, Lorenz.

Maybe, I didn't say it clear enough: Each generic publisher is only publishing on one single topic. The type, the topic_name, message_definition and md5sum does not change once advertised. But each instance of this generic publisher class publishes a topic of a different type. (instance pub_1 of GenericPublisher publishes only messages of type std::Int32, instance pub_2 of GenericPublisher publishes messages of type sensor_msgs::PointCloud2,...)

In the meantime, I also know the md5sum and the message definition within GenericPublisher.

Thus I can advertise as followed:

ros::AdvertiseOptions opts( "/generic_topic_opc_client"+m_genericRosTopic.TopicName, 10, m_genericRosTopic.MD5Sum, m_genericRosTopic.MessageDataType, m_genericRosTopic.MessageDefinition);
m_genericRosTopic_publisher = n.advertise(opts);

Still, I don't know what

m_genericRosTopic_publisher.publish()

expects as a parameter and how I can get this parameter from

ros::serialization::IStream i_stream((u_int8_t*) testArray.data(), m_genericRosTopic.SerializedMessageSize);