Code: Select all

```
targetP=simGetObjectPosition(targetHandle,-1)
vv={targetP[1]-desiredTargetPos[1],targetP[2]-desiredTargetPos[2]}
if (math.sqrt(vv[1]*vv[1]+vv[2]*vv[2])>0.01) then
pathCalculated=0 -- We have to recompute the path since the target position has moved
desiredTargetPos[1]=targetP[1]
desiredTargetPos[2]=targetP[2]
end
currentTime=simGetSimulationTime()
result,f,t=simReadForceSensor(bumperSensorHandle)
if (result>0) then
if (math.abs(f[2])>1) or (math.abs(f[3])>1) then
backwardModeUntilTime=currentTime+3 -- 3 seconds backwards
end
end
```

2)Can we replace force sensors by VisionSensors?

3)Also you have initialised desiredTargetPosition ={-99,99}. How is this helping us in the calculation of the movement of the target position?

4)Also how (math.sqrt(vv[1]*vv[1]+vv[2]*vv[2])>0.01) is telling us the target has moved?

5)I also tried the automatic path planning functionality of your demo 3DoFHolonomicPathPlanning.ttt. But as soon as I increase the distance it doesn't work. It only works for smaller distance say 2m. If the distance between the dummy objects is more than 2m we can't search the path.