<p>The invention relates to a crane that comprises a trolley (7) or the like arranged to move along an essentially horizontal track, whereby at least one laser scanning device (8) is arranged in the trolley (7) for detecting any obstacles in the manoeuvring space of the trolley and the load (C) attached thereto. The invention also relates to a method for controlling the crane by using said laser scanning device.</p>