Robotics StackExchange | Archived questions

Python call callback function on input change

Some basic programming question:

My node is subscribed to the /joint_states topic, more exactly /joint_states/position[5]. I am trying to publish a message, each time the joint6's state has changed. The /joint_states topic has a high rate 0.1 sec/ published messages, so right now i publish the same value, 10x a sec. I would like to call the callback function only on input change.

Does python have some special function for that?

Any ideas?

btw: i would have a much easier task if i could publish fake_gripperarm_controller using demo.launch from my MoveIt! package

Asked by TkrA on 2015-06-15 17:39:45 UTC

Comments

Answers

ROS doesn't have any concept of calling a callback only when the data changes; callbacks are called whenever a new message is published, and the publisher is responsible for the semantics of when new messages are published.

If you want to detect when the data changes, you'll have to implement that yourself.

Asked by ahendrix on 2015-06-15 22:20:40 UTC

Comments