I would like to publish velocities for my ARDrone using /cmd_vel
topic using the below python script. But it does nothing. It does not publish the required information.
What is wrong in the below code?
#!/usr/bin/env python3
import numpy as np
import rospy
from geometry_msgs.msg import Twist
class KeyboardControl:
def __init__(self):
rospy.init_node('Script_controlling_ARDrone', anonymous=False)
publisher = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
twist = Twist()
twist.linear.x = 0
twist.linear.y = 0
twist.linear.z = -1
twist.angular.x = 0
twist.angular.y = 0
twist.angular.z = 0.5
publisher.publish(twist)
def main():
try:
kc = KeyboardControl()
rospy.spin()
except KeyboardInterrupt:
rospy.loginfo("Shutting down")
if __name__ == '__main__':
main()