Turbot与python教程-实现后退
说明:
介绍如何实现通过python控制turbot后退
代码:
实现代码:
# A very basic TurtleBot script that moves TurtleBot forward indefinitely. Press CTRL + C to stop. To run:
# On TurtleBot:
# roslaunch turtlebot_bringup minimal.launch
# On work station:
# python goBack.py
import rospy
from geometry_msgs.msg import Twist
class GoForward():
def __init__(self):
# initiliaze
rospy.init_node('GoForward', anonymous=False)
# tell user how to stop TurtleBot
rospy.loginfo("To stop TurtleBot CTRL + C")
# What function to call when you ctrl + c
rospy.on_shutdown(self.shutdown)
# Create a publisher which can "talk" to TurtleBot and tell it to move
# Tip: You may need to change cmd_vel_mux/input/navi to /cmd_vel if you're