After checking all the anchor position with cfclient when using ros package for autonomous flight I gave command
roslaunch bitcraze_lps_estimator dwm_loc_ekf_hover.launch uri:=radio://0/100/2M x:=3 y:=2.3 z:=1.0
it worked fine upto this point.
After that i gave command
rosservice call /crazyflie/takeoff
it takeoff and randomly goes to any other position and crash with wall rather then going to position allocated
please help me to fix this problem

The first things would be to verify that you are getting a good position estimate from the system.You can display the Crazyflie position and orientation with rviz and move the Crazyflie by hand to check that the lps is working properly.

One common problem is the startup position: are you switching your crazyflie ON while facing X?