Astromech droids are a series of versatile utility robots generally used for the maintenance and repair of starships and related technology. These small droids are often equipped with a variety of tool-tipped appendages that are stowed in recessed compartments. The R2 unit is a popular example of an astromech droid.
One of the most resourceful, helpful and loyal of astromech droids is R2-D2. Serving the Queen of Naboo, R2-D2 saved the monarch's royal starship when it came under fire from a Trade Federation blockade. Artoo later served Jedi Knight Anakin Skywalker, becoming a helpful friend to the Jedi hero during the Clone Wars. A generation later, R2-D2 served Anakin's offspring, Luke Skywalker and Princess Leia.
Astromech droids often serve as counterparts to protocol droids on well equipped starships and installations. While astromech droids are well suited to handle technical tasks, their electronic means of communications makes it difficult for organic beings to understand them. Thus it often falls to protocol droids to bridge such human/cyborg operations.
The Rebel Alliance X-wing fighter is equipped with an astromech socket behind its cockpit. From the socket, an astromech droid can enact repairs, handle navigation, and even pilot the craft in the event of emergency.
The Naboo Space Fighter Corps keeps a supply of astromech droids well tended for duty aboard their sleek and elegant Naboo N-1 fighters. The astromech droids need to compress their legs and telescope their necks in order to fit within the tight confines of the starfighter fuselage.
Pit droids serve as all purpose mechanics. Though they do not have the diagnostic or interface equipment that astromechs have, they are cheap and easily stowable alternatives to the more expensive and adaptable astromech droid.