Skip to content
Snippets Groups Projects
Commit dd063bd5 authored by Daniel Christoph's avatar Daniel Christoph
Browse files

Deleted Simulation/location_monitor/scripts/location_monitor_node.py

parent 8a7dcb3a
No related merge requests found
#!/usr/bin/env python
import math
import rospy
from nav_msgs.msg import Odometry
ob = []
ob.append((0.00 , -0.70)); #Beispeiele, befinden sich auf der X Linie
ob.append((0.00 , 0.00));
ob.append((0.00 , 0.80));
def distance(x1, y1, x2, y2):
xd = x1 - x2
yd = y1 - y2
return math.sqrt(xd*xd + yd*yd)
def callback(msg):
x = msg.pose.pose.position.x
y = msg.pose.pose.position.y
for l_x, l_y in ob:
dist = distance(x, y, l_x, l_y)
if dist < 0.20: #muss individuell angepasst wreden
rospy.loginfo("Collision!")
def main():
rospy.init_node('location_monitor')
rospy.Subscriber("/odom", Odometry, callback)
rospy.spin()
if __name__ == '__main__':
main()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment