How to make a raising pantograph?

How would you be able to make a raising pantograph on a train?

I don’t think it would need much scripting, but it would need many constraints. Maybe springs and hinges.

Would this also need scripting?