is there any limit to when the robot should turn coz i have given it as 30. here is my code

! /usr/bin/env python

import rospy from sensor_msgs.msg import LaserScan from geometry_msgs.msg import Twist

rospy.init_node('topics_quiz_node') pub = rospy.Publisher('/cmd_vel', Twist,queue_size = 1) var = Twist() rate = rospy.Rate(2) pub.publish(var)

def callback(msg): y = msg.ranges[360] print y if (y > 30): pub.publish(var) var.linear.x = 0.5 var.angular.z = 0.0 elif (y<=30): pub.publish(var) var.angular.z = 0.5

sub = rospy.Subscriber('/kobuki/laser/scan', LaserScan, callback) rospy.spin()

asked 06 Jul, 19:26

AkshayNair's gravatar image

AkshayNair
0
accept rate: 0%


Hi @AkshayNair,

The robot turning should not be based on timing but on how close the robot is to the obstacle (wall). That's why you have the LaserScan to detect when the robot is seeing an obstacle and how close the obstacle is.

Based on the LaserScan data, you should turn your robot, using the ranges array, as specified in the instructions.

One other hint: you can print some messages to see the closeness of the robot to the wall and then adjust your program accordingly.

permanent link

answered 08 Jul, 09:39

bayodesegun%40bayodesegun.com's gravatar image

bayodesegun@...
1352
accept rate: 37%

Instructions clearly say to use ALL of the functions. So you're supposed to use the timed functions for something.

I'm finding the Turtlebot very inconsistent. Very small changes in time (e.g. from 4.99 to 5.0) make large differences in the amount turned. There seems to be no way to get in between.

/K

permanent link

answered 11 Jul, 00:39

comm%40woeltje.org's gravatar image

comm@woeltje...
01
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×33
×5

question asked: 06 Jul, 19:26

question was seen: 37 times

last updated: 11 Jul, 00:39

powered by OSQA