Quantcast
Channel: ArduPilot Discourse - Latest topics
Viewing all articles
Browse latest Browse all 48321

MR72 + ArduPilot : AUTO→LOITER and Lua proximity readings

$
0
0

Hi all,

I’m working on integrating a Nanoradar MR72 with ArduPilot (Copter 4.6.2) for obstacle avoidance, and I’ve run into an issue where the Lua proximity API returns incorrect values whereas the Mission Planner Proximity UI shows the correct values.

My final goal is the fly the drone in AUTO mode and when an obstacle is too close it should switch to LOITER mode.

Here is a minimal Lua test script the should print the distances and angle of the detected obstacles by the MR72:

function update()
    local count = proximity:get_object_count()
    gcs:send_text(0, "Objects: " .. tostring(count))
    for i = 0, count - 1 do
        local dist_cm, angle = proximity:get_object_angle_and_distance(i)
        if dist_cm and angle then
            gcs:send_text(0, string.format("Obj %d: %.2f m at %.1f°", i, dist_cm/100, angle))
        else
            gcs:send_text(0, string.format("Obj %d: invalid", i))
        end
    end
    return update, 100
end
return update()


(The proximity UI shows the correct obstacle distances whereas the logs print incorrect distance and angle readings)

Problem:

  • Mission Planner’s Proximity UI shows correct distances/angles from the MR72.
  • In Lua, the values returned by proximity:get_object_angle_and_distance() are clearly incorrect and don’t match what the UI displays.

Environment:

  • Hardware: NanoRadar MR72
  • Flight stack: ArduPilot Copter 4.6.2
  • GCS: Mission Planner (Windows) 1.3.38

Thanks in advance for any guidance or examples!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48321

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>