3

I am implementing a robotic system based on ROS. I have different nodes which send data multiple times per second. However, I don't need that. I want to send the robot state only when it is at a new location. What technique of ROS do you suggest to use?

CognitiveRobot
  • 1,337
  • 1
  • 9
  • 26
Eric Valls
  • 71
  • 1
  • 7
  • Won't a topic accumulate a lot of information I don't need? Like past states? – Eric Valls Feb 19 '19 at 22:24
  • The subscriber will only maintain up to however many messages you define the buffer to be. If this is some global state information, like a robot's position in the world, you might just make the subscriber callback save the latest incoming value in some variable. If you only use them infrequently, you can use `rospy.wait_for_message()` to grab one message. – Hal Jarrett Feb 21 '19 at 14:57

1 Answers1

4

Dependent on your requirements, you can either use the ROS Services or the Parameter Server.

ROS Service: The publish / subscribe model is a very flexible communication paradigm, but its many-to-many one-way transport is not appropriate for RPC request / reply interactions, which are often required in a distributed system. Request / reply is done via a Service, which is defined by a pair of messages: one for the request and one for the reply.

Parameter Server: A parameter server is a shared, multi-variate dictionary that is accessible via network APIs. Nodes use this server to store and retrieve parameters at runtime. As it is not designed for high-performance, it is best used for static, non-binary data such as configuration parameters.

Tik0
  • 2,499
  • 4
  • 35
  • 50