Commit 23b42f13 authored by Nikolai Zollner's avatar Nikolai Zollner
Browse files

t

parent 30cd836f
......@@ -36,7 +36,7 @@ class Tb3(Node):
cmd_vel_msg = Twist()
cmd_vel_msg.linear.x = MAX_LIN_VEL * lin_vel_percent / 100
cmd_vel_msg.angular.z = MAX_ANG_VEL * ang_vel_percent / 100
self.cmd_vel_pub.publish(cmd_vel_msg)
self.ang_vel_percent = ang_vel_percent
self.lin_vel_percent = lin_vel_percent
......@@ -65,7 +65,20 @@ class Tb3(Node):
self.walls+=1
while(time.time() < start+1):
print(self.walls)"""
def challenge0(self, msg):
smallest_dist = msg.ranges[0]
for elem in msg.ranges:
if elem < smallest_dist:
smallest_dist = elem
print(smallest_dist)
def challenge1(self,msg):
if((msg.intensities[0] == 2.0) and (msg.ranges[0] < 0.42)):
self.stop()
else:
self.vel(100,0)
def world5(self, msg):
if(self.start == True):
if(msg.ranges[0]> 0.4):
......@@ -88,8 +101,29 @@ class Tb3(Node):
if((msg.intensities[0] == 2.0) and (msg.ranges[0] < 0.42)):
self.stop()
def bonuschallenge(self, msg):
left_side = msg.ranges[320:360]
right_side = msg.ranges[0:40]
front_area = left_side + right_side
turn = False
for elem in front_area:
if(elem < 0.35 and elem != 0.0):
turn = True
if(turn):
self.turn_left(msg)
else:
self.vel(70,0)
def challenge4(self,msg):
if((msg.ranges[0] < 0.4) and (msg.ranges[0] != 0.0)):
self.vel(0,38)
time.sleep(4)
self.vel(0,0)
elif(msg.intensities[0] == 2.0) and (msg.ranges[0] < 0.42)):
self.stop()
else:
self.vel(70,0)
def world2(self, msg):
left_side = msg.ranges[320:360]
right_side = msg.ranges[0:40]
......@@ -114,16 +148,14 @@ class Tb3(Node):
self.vel(0,34)
def turn(self,dist):
if((dist < 0.5) and (dist != 0.0)):
self.vel(0,0)
def challenge2(self,dist):
if((dist < 0.4) and (dist != 0.0)):
self.vel(0,38)
time.sleep(4)
self.vel(0,0)
self.turns+=1
else:
self.vel(50,0)
if(self.turns > 5):
self.vel(70,0)
if(self.turns > 0):
self.stop()
def color(self, msg):
......
Supports Markdown
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