Not sure, never used it but maybe getMap().canReach ?
if it cant reach an obstacle is in the way
So i suggest making a walkingevent with a break condition, using !getMap().canReach etc then when it breaks out search for x obstacle interact with it then start walking event again i guess, theres probs a better way but thats how I would start anyways