Real-time control of robot manipulators in the presence of obstacles