Safety and Efficiency in Robotics: The Control Barrier Functions Approach