add ping function and avoid obstacle