What I want to achieve is this. I have a rod, which I want to move only in the direction of its axis, but move it (ideally) without resistance, meaning that If i pull the rod, I want it to follow (possibly aided by a stepper?) and if I push the rod, I want it to move back (retract) without resistance. But I want to be able dynamically to push it or pull it up to a point and be able to lock it after that. Example: I want to push the rod for 12.5cm but after that I want it to prevent me from pushing more.
So, I would be able to push for max 12.5cm and not after that, but also be able to pull it freely (up to some points let's say 30 cm). Maybe a stepper could do that? Hold torque in one direction (once it reaches 12.5cm) but rotate freely in the other direction (pulling). I'm not even sure a torque sensor would help, since I'm not applying torque, or that even a stepper is the right thing to use.
What I mean by dynamically, is that those distances are not fixed and can change programmatically (arduino/PI doesn't matter). It's not an absolute requirement that the rod follows automatically aided by a motor (=no resistance), but would be ideal. The most important is that I want it to lock once it has reaches certain distances either while I pull or I push it (mechanically with my hand).