[ros-users] ROS - performance comparison with Player (Client)

Peter Müller grandmastermt2000 at yahoo.de
Mon Aug 23 11:48:55 UTC 2010


Hi,

so this past weeks I have been trying to write a little performance comparison between those two frameworks to get a better feel for both of them.
Naturally, I need to know if my ROS implementation is sufficient for this, or if I have lost performance due to a bad implementation.


Right now I have a producer and a receiver class exchanging just byte data. (Similar to Player Opaque interface)
A receiver can have multiple "incoming" topics (each topic is unique for a producer). Every incoming message is dealt with in the same method. I indicate which producer sent the message by using an index with the callback method. The callback method stores timing information and does not use any ROS specific functions (except the message).

So in the end I initialize the receiver like this:
void OpaqueReceiver::init()
{
	unsigned int topic_count = topics.size();
	subscriptions.reserve(topic_count);

	for (unsigned int i = 0; i < topic_count; ++i) {
		subscriptions.push_back(node.subscribe<ros_perf::Opaque> (
		                            topics[i],
		                            DEFAULT_BUFFER_SIZE,
		                            boost::bind(&OpaqueReceiver::processMessage, this, _1, i),
		                            ros::VoidPtr(),
		                            ros::TransportHints().tcpNoDelay())
		                       );
	}
}

Afterwards I just call ros::spin and save the relevant timing data.

On the producer side I initialize like this:
	outStream = node.advertise<ros_perf::Opaque> (topic, 1024, boost::bind(
	                &OpaqueSender::receiverConnected, this/*, _1*/), boost::bind(
	                &OpaqueSender::receiverDisconnected, this/*, _1*/));

And send out data like this (after a receiver connected):
	while (ros::ok()) {
		if (current_iterations < iterations) {
			for (unsigned int i = 0; i < burst_count; ++i) {
				ros_perf::utility::PTime::now(data_packet.t_stamp);
				outStream.publish(data_packet);
			}
			++current_iterations;
		}

		usleep(30000); // 30ms
	}


Is there a way to handle things better with Ros (different spin method?)? Especially on the receiver side.

If there is a need for more explanations I am more than willing to clarify.

PS. I will probably make a similar post on the Player mailing list.





More information about the ros-users mailing list