Guitar Robot

From Industrial Robotics & Automation - Fanuc Teach Pendant Programming

This page details a program loosely based on the robotic playing of a bass guitar in the video AUTOMATICA - Robots Vs. Music - Nigel Stanford

https://www.youtube.com/watch?v=bAdqazixuRY


Guitar fretting (pressing the strings against the frets) can be accomplished by offsets and registers. Typically you would set your fret position, then strum the strings.

Guitar Notes Mapped as Positions
Guitar Notes Mapped as Positions

1. Set the neck of the guitar in a user frame. The length of the strings should represent the Y axis, the selection of string the X axis.

2. Move to a position 5mm above the first fret of the first string.


3. Put the program together.


Set up our registers ahead of time (these lines aren't part of the loop, so they only happen once)

R[11] = 4

R[10] = whatever the first note length must be

PR[10] = whatever the first note value must be


Label the first line in the loop so we can loop our program later.

LBL [1]


A joint move to the desired position. (record it your first time)

J P[1] 100% Fine OFFSET PR[10]


A change of height by adjusting the contents of the position register's Z element.

PR[10,3] = PR[1,3] - 10


Going to the new position. (Same XY coordinate, but now pushing the string down against the fret). Use linear to avoid X motion (possibly damaging strings)

L P[1] 225mm/s Fine OFFSET PR[10]


Strum the guitar. This doesn't have to be done by a robot at all, it can be accomplished with a pneumatic cylinder. We will have to keep track of what the last position of the cylinder is, so we'll add a few lines that do nothing but do the opposite of its current state.

IF DO[101] = ON JMP LBL [2] Check if it's already on. If it is, jump to label 2.

DO[101] = ON If it's off, then we want to turn it on.

JMP LBL [3] Jump to the exit of this part.

LBL [2] Jump here if it's already on.

DO[101] = OFF If it's on, we want to turn it off.

LBL [3] Exit this routine.

Wait for the next note. It will wait the pre-determined amount of time, whatever is in R[10]

WAIT R[10]

A change of height by adjusting the contents of the position register's Z element.

PR[10,3] = PR[10,3] + 10


Going to the new position. (Same XY coordinate, but now back above the string)

L P[1] 225mm/s Fine OFFSET PR[10]


We're done with the motion part. These lines increment R[11] by one each time so we can keep track of which note to play next. It will jump to setting up that note, immediately afterwards.

R[11] = R[11] + 1

JMP LBL[R[11]]


Now consider that if we want to choose a note to play, we only need to set two things ahead of time:

PR[10]'s X and Y element for string and fret.

R[10]'s contents for time to next note.

We can manually program this into the robot with a long list of values, jumps to playing the note, then jumps back. There are data types that can handle this information wonderfully (such as pallet registers) but for the sake of simplicity and remaining within the scope of this course, I'll just write them down as "whatever".

LBL [4]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [5]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [6]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [7]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [8]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [9]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!

LBL [10]

PR[10,1] = whatever

PR[10,2] = whatever

R[10] = whatever

JMP LBL [1] Go to the motion instruction to play that note!


Note: This is of course not an ideal program. Notes could easily be stored in single position registers, splitting out with register instructions such as modulus and integer division. The purpose of the example is simplicity, not efficiency.