Yes. While pilots must leave the cockpit for “proper sleep”, short naps are taken in the cockpit at the controls. Known as “controlled rest”, these naps are usually less than 40 minutes in length and are taken during both long-haul, and, short-haul flights.