How would you write a linux program to read data from a joystick, and turn that data into a command that is pushed onto the queue?

If you label your School Subject correctly, then it's more likely that the expert in that area will respond to your question.