#!/usr/bin/env python import rospy from sensor_msgs.msg import Joy from pcl_msgs.msg import Vertices drill = Vertices() drill.vertices = [0, 0, 0, 0, 0, 0, 0] drill_x=0 #up-down movement drill_y=0 #drill on off drill_z=0#container rotation drill_xpwm=255 drill_ypwm=255 drill_zpwm=255 drill_zangle=90 def find_drill_movements(data): global drill_x global drill_y global drill_z global drill_xpwm global drill_ypwm global drill_zpwm global drill_zangle #for drill up-down movement x = data.axes[0] if(x==0): drill_x =0 if(x==1): drill_x=1 if(x==-1): drill_x=2
#!/usr/bin/env python import rospy from sensor_msgs.msg import Joy from pcl_msgs.msg import Vertices from numpy import interp arm = Vertices() arm.vertices = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] actuator_x = 0 actuator_y = 0 base = 0 wrist = 0 gripper_rotation = 0 gripper_jaw = 0 def move_base(data): global base base = 0 base_pwm = 0 '''bl= data.buttons[4] br=data.buttons[5] if((br == 0 and bl == 0) or (br==1 and bl ==1)) : base = 0 if(br == 1 and bl == 0) : base = 1 if(br == 0 and bl == 1) : base = 2''' if (data.buttons[4] == 1): base_axis = data.axes[3]
#!/usr/bin/env python import rospy from pcl_msgs.msg import Vertices import time import getch import getkey as gk pantilt = Vertices() pan = 0 tilt = 0 antena = 0 pantilt.vertices = [0, 0, 0] def talker(): global pan global tilt global antena pub = rospy.Publisher('servo_pantilt', Vertices, queue_size=10) rospy.init_node('pan_tilt', anonymous=True) rate = rospy.Rate(3) # 3hz3 while (True): key = gk.getkey() if (key == gk.keys.UP): while (key == gk.keys.UP): pan = pan + 1 if (pan > 180): pan = 180 if (pan < 0): pan = 0 pantilt.vertices[0] = pan pub.publish(pantilt)