I am trying to send a OBSTACLE_DISTANCE_3D message to Arducopter 4.1 beta5. The message is not being recognized (no errors) and the function immediately returns when the 3D message function is called. I compiled AC 4.1beta5 SITL and I believe I also installed the latest pymavlink. All other mavlink obstacle and distance messages like DISTANCE_SENSOR and OBSTACLE_DISTANCE work well in AC4.1beta5 SITL. It seems like just the new 3D message is completely ignored. @rishabsingh3003 I leveraged your coding - what am I missing?
from pymavlink import mavutil
.............
# Prepare for Arducopter 4.1 3D Obstacle Avoidance
def send_obstacle_distance_3D_message():
global mavlink_obstacle_coordinates, min_depth_cm, max_depth_cm
global last_obstacle_distance_sent_ms
global current_time_us
if (enable_3D_msg_obstacle_distance == True):
if current_time_us == last_obstacle_distance_sent_ms:
# no new frame
progress("no new frame")
return
last_obstacle_distance_sent_ms = current_time_us
for q in range(9):
conn.mav.obstacle_distance_3d_send(
current_time_us, # us Timestamp (UNIX time or time since system boot)
0,
0,
65535,
float(mavlink_obstacle_coordinates[q][0]),
float(mavlink_obstacle_coordinates[q][1]),
float(mavlink_obstacle_coordinates[q][2]),
float(min_depth_cm/100),
float(max_depth_cm/100) #needs to be in meters
)
current_time_us = int(round(time.time() * 1000000))
This is a sample dataset for the 9 sector depth matrix I am feeding into the OBSTACLE_DISTANCE_3D message:
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0
1625232381482134 0 0 65535 -1.5486565828323364 0.026432015001773834 0.6540128588676453 1.0 20.0