Cool, that is what I was thinking you wanted to do 
How high off the ground?
40m is long, that will limit your track and propulsion method.
If you used the aluminium extrusion that I use (25.4mm square) you can probably get that in 6m lengths, meaning about 7 lengths. I use 3m lengths but only because I can get it from bunnings.
Your biggest issue with long tracks is the join and not getting a bump.
I wouldnt go with PVC piping as the track as it will sag without a serious amount of support, however round metal pipe would do just as well as the square that I used.
I went with square as it was easier to mount and get the whole lot flat as you havea continuous flat face to drill the mount holes.
In previous versions I used round pipe and found it difficult over even the 1.2m track that I was using to get the mount holes aligned as the pipe can spin around when drilling.
You need to think about how you’re going to mount it, but I’d say a track config like mine, but hung upside down.
You wont need to have the third rail if you are able to hang the track at regular intervals from the roof trusses, or even fit directly to them.
Rack and pinion motion is going to be an expensive option for 40m unless you can 3D print like my ones, but that will a lot of printing, although they print pretty fast. ie I printed enough for 4m of track in a day, so it would take you a couple of weeks.
Here is the stl if you want it, I have a lot of various gears that mate with this track too.
track.stl.zip (551.5 KB)
Track will work, as would a belt, but the belt tension over 40m is going to be tough.
I can tell you from experience that it’s difficult to not break the 3D printed gearboxes when using a long belt drive due to the forces that the tension applies to the drive gears.
However, probably the best option for such a long dolly track would be to use paracord and wrap it a couple of times around a drum in the dolly cart.
It will make its own tension, as long as the paracord is reasonably without slack in it, as long as you are always travelling in the same direction. Changes in direction will always provide large backlash in a belt/paracord based locomotive solution, but this might not be an issue for you.
Note the other issues that you will need to solve are to do with power and waterproofing.
-
40m is a LONG dolly track to sling a power cable.
I think that if you slung a catenary cable above or to the side of the dolly track and concertina’d it on loops, then it would just drag it along with it. You dont want the cable to be able to snag on anything.
-
How do you plan to waterproof the raspberry pi? It is really going to need to be sealed up otherwise moisture will definitely get in. You would probably want to look at sealing the Pi with a paint on coating as well.
The last question is how fast do intend it to travel?
Is if for video, stills to check up on growth etc, or for time-lapse purposes?
Those questions will affect the motor/gearbox/control combination and options that you choose.
Oh one more idea, dont forget to include limit switches at either end, the last thing that you want is the cart to crash into an end and try and drive itself off a stop.
You can do limits in a variety of ways, but you will either have the limit at either end of the track and cut power if it hits it (downlise is that you cant start it again and it would cut the power to the Pi) or you would have the limits on either end of the cart and wire them up to the Pi to a GPIO and use the input to stop the Pi locomotion.
The benefit to having them on the cart is that your wires are short and the action is right at the Pi so easy to make sure that you are preventing a crash.
I think that is my brain dump for now, but happy to answer anything that will arise.