A Virtual Fencing Framework for Safe and Efficient Collaborative Robotics