PreArm: PRX1: No Data

Hi,

I’m trying to test out avoidance on ArduCopter in a SITL configuration by injecting sensor measurements. I have the following ArduCopter parameters:

param set PRX1_TYPE 2 # MAVLink (have also tried 4, RangeFinder)
param set AVOID_ENABLE 7
param set AVOID_BEHAVE 1
param set AVOID_MARGIN 2
param set SCR_ENABLE 1 # for custom messaging script
reboot

I have a Lua script loaded that is sending both DISTANCE_SENSOR and OBSTACLE_DISTANCE messages at 100 Hz. Examples from watch command in the MAVProxy controlling my ArduCopter:

< DISTANCE_SENSOR {time_boot_ms : 429217, min_distance : 20, max_distance : 1200, current_distance : 30, type : 0, id : 1, orientation : 0, covariance : 0, horizontal_fov : 0.0, vertical_fov : 0.0, quaternion : [0.0, 0.0, 0.0, 0.0], signal_quality : 100}

and

< OBSTACLE_DISTANCE {time_usec : 450303, sensor_type : 0, distances : [30, 30, 30, 30, 30, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201, 1201], increment : 5, min_distance : 20, max_distance : 1200, increment_f : 0.0, angle_offset : 0.0, frame : 12}

Shortly after I reboot with PRX1_TYPE set, I get PreArm: PRX1: No Data in QGroundControl. Why is this happening? What am I missing?

I was able to resolve this with the following parameters:

param set PRX1_TYPE 2
param set AVOID_ENABLE 7
param set AVOID_MARGIN 10
param set AVOID_BEHAVE 1
param set OA_TYPE 1
reboot

and the following Python:

from pymavlink import mavutil
import time


print('connecting')
mav_master = mavutil.mavlink_connection('udp:127.0.0.1:14550')
mav_master.wait_heartbeat()
print('connected')

def send_obs():
    distances = [65535]*72
    for i in range(0, 2):
        distances[i] = 100

    mav_master.mav.obstacle_distance_send(
        int(time.time()*1e6),
        0,
        distances,
        5,
        20,
        12000,
        0,
        0,
        12
    )

while True:
    send_obs()
    time.sleep(0.1)

Works when I have the copter set up to run a preplanned mission in AUTO mode in QGroundControl

2 Likes