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

Replace location_monitor_node.py

parent 8f440949
No related merge requests found
......@@ -186,11 +186,11 @@ def objectWithRadiusDetection(radius, cordlist, l_x, l_y, simtime):
safedist = radius + SafeDist # Radius/Size + Bot front Rad + safe dist
rospy.loginfo("Safedist: " + str(safedist))
logger.info("Safedist.: " + str(safedist))
lenght = len(cordlist)-1
rospy.loginfo("Distance: " + str(distance(cordlist[0], cordlist[1], l_x, l_y))) #Zenterpunkt
lenght = len(cordlist)
dist = distance(cordlist[0], cordlist[1], l_x, l_y)
logger.info("[T:" + simtime + "] " + "Dist. To Bot Center: " + str(dist))
for i in range(lenght):
rospy.loginfo("Distance: " + str(dist)) #Zenterpunkt
logger.info("[T:" + simtime + "] " + "Dist. To Bot: " + str(dist))
for i in range(0,lenght,2):
dist = distance(cordlist[i], cordlist[i+1], l_x, l_y)
if dist < safedist:
rospy.loginfo("Collision!")
......@@ -213,9 +213,9 @@ def boxkdetection(size, cordlist, l_x, l_y, yaw_degrees, simtime):
xR = l_x + size * math.cos(math.radians(yaw_degrees))
yL = l_y + size * math.sin(math.radians(yaw_degrees))
lenght = len(cordlist) - 1
lenght = len(cordlist)
for i in range(lenght):
for i in range(0,lenght,2):
lineA = ((cordlist[i], cordlist[i+1]), (l_x, l_y))
lineB = ((l_x, l_y), (xR, yL))
......@@ -237,7 +237,7 @@ def boxkdetection(size, cordlist, l_x, l_y, yaw_degrees, simtime):
distult = distance(cordlist[i], cordlist[i+1], dynX, dynY)
if WriteFlag == 0 and i == 0:
logger.info("[T:" + str(simtime) + "] " + "Dist. To Bot Center: " + str(distult))
logger.info("[T:" + str(simtime) + "] " + "Dist. To Bot: " + str(distult))
rospy.loginfo("Dist to collision point: " + str(distult))
if distult < safedist:
rospy.loginfo("Collision!")
......
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