moving a robot inside specific area
I have a pioneer robot and I want to move it in the lab and I want to keep it in a square area. So when ever it want to cross that area it cant. I dont want to send a zero velocity to it so it will stuck in the boundry of the square.
Using the odom of the robot the start position is (0,0). I want the sqaure area is 2 by 2 and the pioneer starts from a corner or in the middle. When it reah the boundry it can rotate to inside direction of the square do it can move forward and backword.
The pioneer has topic RosAria/pose which is from type nav_msgs/Odometry ...
any suggestions or a code some one wrote for this