Is it possible to use an external controller to move IRB40?


I was wondering if there is any way to use the joysticks on DS4 to move the robot in x,y and z directions, and use the buttons on the DS4 to perform other tasks when programmed in an if loop? For instance, if button 1 is pressed, do something.