Objection detection using RPIlidara2 and cube orange

I want to control one output digital device(relay) by using lidar distance (based on threshold value of distance),how to set the value in mission planner using commands

You need to program a lua script that will run on the flight controller. Which FC do you have?

i am using cube orange plus board and lidar is RPILidara2M12 ,rover 4.4.0 version firmware and mission planner for GCS

where is that lua script in the memory card or mission planner

That flight controller can run lua scripts fine.
Lua scripts are on the sdcard

https://ardupilot.org/copter/docs/common-lua-scripts.html