ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Turtlebot ride backwards a specified distance

asked 2015-03-04 09:20:07 -0600

Elizaveta.Elagina gravatar image

updated 2015-03-04 09:25:55 -0600

I want to write a python script that makes Turtlebot ride backwards for a specified distance in meters. I have this function

def ImuCallback(data, angle):


 global stage
  quat = data.orientation
  q = [quat.x, quat.y, quat.z, quat.w]
  roll, pitch, yaw = euler_from_quaternion(q)

  sys.stdout.write("\r\033[1mGyro Angle\033[0m: [" + "{0:+.4f}".format(yaw) + " rad]  ["\
                 + "{0: >+7.2f}".format(degrees(yaw)) + " deg]"\
                 + "            \033[1mRate\033[0m: [" + "{0:+.4f}".format(data.angular_velocity.z) + " rad/s]  ["\
                 + "{0: >+7.2f}".format(degrees(data.angular_velocity.z)) + " deg/s] ")
  if angle > 0:
    if yaw > angle or yaw < 0:
      stage += 1
  else:
    if yaw > angle and yaw < 0:
      stage += 1

which makes it stop when the robot is rotating. I would like to read the distance travelled by the robot similarly as to how I read the angle of its rotation. I feel it has to be simple but I don't know how to do it. Thanks in advance!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-03-09 19:04:01 -0600

jihoonl gravatar image

This kobuki script might be helpful to implement backward move.

https://github.com/yujinrobot/kobuki/...

edit flag offensive delete link more
0

answered 2015-03-05 04:47:07 -0600

Elizaveta.Elagina gravatar image

I see that class TravelForward can be used for my purpose. Probably it's not the most straightforward way but it works.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-03-04 09:20:07 -0600

Seen: 480 times

Last updated: Mar 09 '15