Question about OBSTACLE_DISTANCE message to use Collision Prevention

Hi,
I’m trying to use Collision Prevention with OBSTACLE_DISTANCE message.
PX4 used is v1.11

For this purpose, the OBSTACLE_DISTANCE dummy message was transmitted to the PX4 through telem2 at intervals of 100ms. The dummy message was written by referring to the link below.
https://discuss.px4.io/t/question-on-distances-array-in-obstacle-distance/12911

The dummy message is below.
frame = MAV_FRAME_BODY_FRD
increment = 0
angle_offset = 0
distance data = [500, UINT16_MAX, UINT16_MAX …]

          mavlink_msg_obstacle_distance_pack(SYSTEM_ID,
                                             COMPONENT_ID,
                                             &msg_dist,
                                             (uint64_t)(HAL_GetTick() * 1000),
                                             MAV_DISTANCE_SENSOR_RADAR,
                                             distance,
                                             0,
                                             50,
                                             4000,
                                             0,
                                             0,
                                             MAV_FRAME_BODY_FRD);

And set CP_DIST to 1 in PX4 position mode. but PX4 changed to Hold mode soon.
According to the data loss description of collision prevention of PX4, it is mentioned below.

After 5 seconds of not receiving any data, the vehicle will switch into HOLD mode.

Am I doing something wrong with filling in the message?

Any help will be appreciated. Thanks.

Hi Did u try implementing the code on the drone?? is it working?? actually, I also want to implement collision prevention sort of things on my drone using a depth camera I need some help in sending obstacle distance messages can you please help me out

Hi, It work.
Instead of implementing the code on the drone, I implemented it to generate and send MAVLink messages in offboard mode on the Radar board.

Can you please help me with the code of the same or any function. Actually im stuck in the implementation of the same on my drone

I wrote code for the comany, so can’t give you.
But, implementation is simple. I use distance sensor as offboard. Connect to telem port and set PX4 parameter. And just pack and send distance data in OBSTACLE_DISTANCE message. In PX4 v1.11, angle increment use 10deg.
Heartbeat message is necessary.

Which distance sensor did u used?? did u used camera?? and also there are some many wrong values if im using depth image to laser scan any solution for that?

I used radar sensor. I have no experience implement using depth camera, so I can’t give you advice for using depth camera.