Typically, we split the functions of the robot into different classes/modules that implement a portion of the robot functionality. Then all you do in myrobot.cpp is things like "if joystick button 1 is pressed, call this function". This helps keep things more organized and easier to debug.
More importantly, it makes autonomous mode really easy to implement and easy to understand, since it's only manipulating existing objects, and not creating new functionality. Most of the time, the functionality is shared between autonomous and teleoperated mode, so we get extra testing for free
