A generic algorithm implementing path planing