Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Continuous robot arm movement

Unlike edge triggered here ,I am now trying to move the arm continuously till the buttons are continuously pressed and must stop moving once the user stops pressing it, but as soon as I launch the code I wrote, the messages 0.0 start publishing and the commands that I give takes a while to be executed as they are stored in the buffer. The code is

def callback(data, group1):
    global j1, a

    if ((data.buttons[0]==1) and (data.axes[6]==1)):
         a += 1
    print 'a = %s' %a
    j1 = (int(a/5))*0.1
    print j1
    if (j1 >= 3.1): 
        group1_variable_values[0] = 3.1
        print "Limit reached joint 1"
    else:
        print "changing joint 1"
        group1_variable_values[0] = j1
        group1.set_joint_value_target(group1_variable_values)
        plan2 = group1.plan()
        execute2= group1.execute(plan2)
        print "plan complete"

Screenshot of the code: Screenshot