It definitely sounds doable; but how complex it gets, or if it runs fast enough, depends on your specific requirements.
Are you able to use KAREL or only TP programs?
Do you need this to be running at all times (BG logic) or only during execution of specific programs (RUN statement)?
How fast will the robot TCP be moving at max speed? i.e. what's the maximum frequency of the pulse train you're expecting?