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

Replace location_monitor_node.py

parent bc976266
No related merge requests found
...@@ -158,13 +158,13 @@ def objectWithRadiusDetection(radius, cordlist, l_x, l_y, simtime): ...@@ -158,13 +158,13 @@ def objectWithRadiusDetection(radius, cordlist, l_x, l_y, simtime):
global SafeDist global SafeDist
safedist = radius + SafeDist # Radius/Size + Bot front Rad + safe dist safedist = radius + SafeDist # Radius/Size + Bot front Rad + safe dist
rospy.loginfo("Safedist: " + str(safedist)) rospy.loginfo("Safedist: " + str(safedist))
logger.info("Safedist.: " + str(safedist))
lenght = len(cordlist)-1 lenght = len(cordlist)-1
rospy.loginfo("Distance: " + str(distance(cordlist[0], cordlist[1], l_x, l_y))) rospy.loginfo("Distance: " + str(distance(cordlist[0], cordlist[1], l_x, l_y))) #Zenterpunkt
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): for i in range(lenght):
dist = distance(cordlist[i], cordlist[i+1], l_x, l_y) dist = distance(cordlist[i], cordlist[i+1], l_x, l_y)
if WriteFlag == 0:
logger.info("Safedist.: " + str(safedist))
logger.info("[T:" + simtime + "] " + "Dist. To Collision Point: " + str(dist))
if dist < safedist: if dist < safedist:
rospy.loginfo("Collision!") rospy.loginfo("Collision!")
if WriteFlag == 0: if WriteFlag == 0:
...@@ -209,8 +209,8 @@ def boxkdetection(size, cordlist, l_x, l_y, yaw_degrees, simtime): ...@@ -209,8 +209,8 @@ def boxkdetection(size, cordlist, l_x, l_y, yaw_degrees, simtime):
dynY = l_y + dis * math.sin(math.radians(angle1)) dynY = l_y + dis * math.sin(math.radians(angle1))
distult = distance(cordlist[i], cordlist[i+1], dynX, dynY) distult = distance(cordlist[i], cordlist[i+1], dynX, dynY)
if WriteFlag == 0: if WriteFlag == 0 and i == 0:
logger.info("[T:" + str(simtime) + "] " + "Dist to collision point: " + str(distult)) logger.info("[T:" + str(simtime) + "] " + "Dist. To Bot Center: " + str(distult))
rospy.loginfo("Dist to collision point: " + str(distult)) rospy.loginfo("Dist to collision point: " + str(distult))
if distult < safedist: if distult < safedist:
rospy.loginfo("Collision!") rospy.loginfo("Collision!")
...@@ -270,6 +270,8 @@ def callback(msg): ...@@ -270,6 +270,8 @@ def callback(msg):
cordlist.append(botx + BotSides * math.cos(math.radians(yawBot-BotSideRad))) cordlist.append(botx + BotSides * math.cos(math.radians(yawBot-BotSideRad)))
cordlist.append(boty + BotSides * math.sin(math.radians(yawBot-BotSideRad))) cordlist.append(boty + BotSides * math.sin(math.radians(yawBot-BotSideRad)))
detect.show_gazebo_models(cordlist) detect.show_gazebo_models(cordlist)
gc.collect() gc.collect()
......
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