robotics tutorial
some refactoring