Ask Your Question
0

Moving Turtlebot 3 burger to few meters

asked 2019-07-15 08:36:59 -0500

enthusiast.australia gravatar image

Hello everyone. I am using turtlebot 3 burger with ros kinetic kame with ubuntu 16.04 in my PC. I am a beginner. I have successfully installed ros and i can move my robot using keyboard. Now i want to move robot to few meters by giving him a command. My question is that is there a specific python api with which i can do that. Or anyway else i can move my robot autonomously.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-07-15 08:54:54 -0500

alsora gravatar image

updated 2019-07-16 07:22:22 -0500

You should have a look at the ROS Navigation Stack, that contains the components to implement a full autonomous navigation.

Among these packages, the one responsible for moving the robot is MoveBase. This provides you API for moving the robot toward a goal. This goal could be computed in local coordinates and it could easily represent the concept of "X meters in front of the robot". The "problem" is that you will also need a localization package in order to understand when the robot has really traveled that distance. Something very simple could be dead reckoning, i.e. just looking at the wheel encoders.

The Navigation stack contains tutorial for setting up all what you need.

However, in an extremely oversimplified scenario, if you know that your robot moves at 1m/s you can create a function that publishes the "move forward command" that you are executing through the keyboard for the required amount of time to cover your distance. This "command" will be a message of type geometry_msgs/Twist on topic cmd_vel.

EDIT:

I don't advise you to run something as "move randomly for 30 seconds" on a turtlebot, if you don't want to crash it against a wall. Anyhow, you can do something like

import rospy
from geometry_msgs.msg import Twist

pub = rospy.Publisher('cmd_vel', Twist, queue_size=10)
rospy.init_node('node_name')
r = rospy.Rate(30) # 30hz

total_time = 10 #seconds
start_time = time.time()

while not rospy.is_shutdown() or (time.time() - start_time < total_time):

    msg = Twist()

    # here you should fill the msg fields
    # http://docs.ros.org/api/geometry_msgs/html/msg/Twist.html
    # you can fill it randomly or with a direction in mind

    pub.publish(msg)
    r.sleep()
edit flag offensive delete link more

Comments

Thanks alot for your help. Actually i am looking for a simplified thing. I have turtlebot. I have removed LiDAR sensor, now it is just pi3 and a micro controller. I just want to move robot with commands rather than keyboard. for example move 1 meter forward or may be to start random motion for 30 seconds.

enthusiast.australia gravatar imageenthusiast.australia ( 2019-07-16 05:17:40 -0500 )edit
1

This is not an answer. You should edit your initial post or comment my answer if you want to add details. If you find my answer complete, mark it as accepted. Thanks

alsora gravatar imagealsora ( 2019-07-16 07:11:50 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-07-15 08:36:59 -0500

Seen: 33 times

Last updated: Jul 16