#!/usr/bin/env python
import roslib
import rospy

from geometry_msgs.msg import Twist
from std_msgs.msg import Empty
from time import time

#moveBindingsAxis = {
#		67:(0,0,-1,0,0,0,0), #left
#		68:(0,0,1,0,0,0,0), #right
#		65:(1,0,0,0,0,0,0), #forward
#		66:(-1,0,0,0,0,0), #back
#		'w':(0,0,0,0,1,0), #increase altitude
#		's':(0,0,0,0,-1,0), #decrease altitude
#		'a':(0,0,0,0,0,1), #rotate left
#		'd':(0,0,0,0,0,-1), #rotate right
#	       }

speed = .05
turn = 1


if __name__=="__main__":
    	
	pub_twist = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
	pub_empty_takeoff = rospy.Publisher('/ardrone/takeoff', Empty, queue_size=1)
	pub_empty_landing = rospy.Publisher('/ardrone/land', Empty,queue_size=1)
	rospy.init_node('drone_keyboard')
	try:
		print("bsdjfksabd")		
		startime=time()
		while(1):
			pub_empty_takeoff.publish(Empty());
			nowtime=time()
			if (nowtime-startime>1):
				break
		while(1):
			x = y = z = 0
			th_x = th_y = th_z = 0
			y = -1
			twist = Twist()
			twist.linear.x = x*speed; twist.linear.y = y*speed; twist.linear.z = z*speed
			twist.angular.x = th_x*turn; twist.angular.y = th_y*turn; twist.angular.z = th_z*turn
			pub_twist.publish(twist)

	except:
		pass

	
