ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The publisher/subscriber tutorial will get you started interacting with ROS topics, and the LaserScan
documentation indicates the message structure. The rest is more of a Python question, but here's one way:
condition_met = false # Set outside scan_callback scope, so it's shared between callbacks
scan_callback(msg):
if not condition_met: # Don't need to do anything after condition met
for value in msg.ranges:
if value < 0.5:
condition_met = true
comm_pub.publish('hello')
return # Don't need to check the rest
This isn't a working example, but it should give you an idea. If you're stuck on a specific part, post your code, and I'll be happy to help you figure things out.