But I'm pretty sure that the first item is a track telemetry (Sp.) machine.
I got a few pictures and a close look at one here in the Junction.
There's two parts to this machine. A little cart with arms on it that holds up mirrors and the rest of the machine that has lasers on it.
The lasers are aimed at the mirrors on the cart and are reflected back to sensors to record dips and curves in the track.
There are also jack hammer thingies on the sides of the main machine to adjust the ties and ballast of the track to fix those dips and curves in the track.