Can We Use Lua Script To Locate Geolocation of Ground Object (position coordinate)?

Hello gentlemen,
I have small project to locate geolocation of some ground objects (hot spots) accurately in real time.
My idea is to use Laser Tracking Camera (Laser Range Finder) . But that Camera does not show position coordinate of the ground object being tracked… So we have to do some scripting to show that coordinate. There are two possibilities: Using Companion computer or using Lua script… But I need help from expert here how is the best approach.
Any advice is highly appreciated…
I really hope that @Yuri_Rage or @rmackay9 or other expert could help me.
Thank you very much.

The mount-poi lua script can provide the lat, lon and alt of what the camera gimbal is pointing at and it also sends a message to the ground station so that it displays a camera icon on the map. I’ve never made a video showing it off but it does work. This latest version which includes sending the mavlink message that prints the icon on the GCS requires the use of AP 4.5.0-dev (aka “latest”). If you don’t need the icon on the map then here is the version that works with AP 4.4. It simply prints the lat,lon, alt in the GCS’s messages tab.

2 Likes

Thank you very much for the contribution towards the development on geo coordinates of the target. if you help us by making some videos on how to do that to get geo coordinates and alt of the target. what are the FC setting and Mount type or cameras supports.
how the Accuracy of the GEO coordinates of the Target position .any ardupilot wiki page is available.

Hi @kalai1219,

The instructions are at the top of the script although that assumes that you’ve already managed to enable Lua scripts on the autopilot (see here) and have copied the script to the autopilot’s APM/scripts directory.

The accuracy is OK… it really depends upon how accurate the gimbal is at reporting its angles and also the error grows the further away the target is. If the target is maybe 100m ~ 200m away i think the script produces results that are within 10m. That’s a bit of a guess though.

The accuracy also depends upon the camera gimbal angle. If its pointing straight down then it is extremely accurate but when pointing nearly horizontal the lat,lat,alt can be very far off.

2 Likes

Hi @rmackay9 ,

Wow thank you very much for your super fast response… This is amazing…
I think this is very interesting and urgent topic, especially for me. I have some questions as follows:

  1. Camera: in this case we don’t need Camera with high optical zoom (10X or 30X), or expensive Laser Tracking Camera right? But question is, can we increase the accuracy by using:
    a). Non LRF Camera with 10X or 30X optical zoom camera ?
    b). LRF Camera with Tracking function ?
    c). How can we acquire data from the Laser Tracking Camera (distance to the ground object) to do more accurate calculation ?
    d). Or basically we don’t need LRF Camera, because once we get the camera angle, we can do proper calculation.
  2. I expect can show the distance from drone to the target object as well as geolocation .
  3. I will do this using fixed wing UAV, that means the Uav keep moving (maybe in loiter mode). Do you think the accuracy will be bad??
    I am sorry to raise ton of issue here… This is because I want to execute the idea until finish.
    Thank very much again, and I really appreciate your response.
    Tony

Hi @ton999,

The script uses the terrain database built into the autopilot so an LRF won’t help I’m afraid. We’d need to change the script a bit to allow it to use a rangefinder instead. Also if the rangefinder is built right into the camera gimbal then we’d probably need to write a driver or enhance an existing driver to get the distance… what camera gimbal are you using?

Using a camera with a higher zoom won’t help the accuracy much although I suppose it might allow the pilot to more accurately point at the landmark.

BTW, if TERRAIN_SPACING is reduced from 100m to 30m then the accuracy will improve a bit especially in mountainous areas.

Enhancing the script to show the distance to the target is pretty straight forward.

Hi @rmackay9

Ok, I understand better your concept of this script.
So,my basic question is, which one is better (in term of accuracy) between using LRF Camera or non LRF Camera?
If using LRF camera does not improve accuracy, then I don’t use it… In other word, what is benefit using LRF Camera in this case??

But without LRF camera, how do we “lock” the ground target (while drone keep moving)??

I am considering these camera :
SIYI ZR10 (Non LRF), SIYI ZR30 (non LRF) , SIYI 30ZT (LRF), Viewpro Z30TM (LRF).
Any advice?

Thank you…

LRF camera will be able to deal with above ground targets and possibly avoid operator error of targeting center of silhouette instead of center of footprint.

1 Like

Yes, I agree with @LupusTheCanine’s reasoning.

By the way, locking a camera gimbal onto a target is not supported by the lua script but it could be added relatively easily. The AP_Mount library already supports pointing at a specific lat,lon,alt (aka a “Location”) so the issue is just to take the lat,lon,alt calculated by the script and use it to set the AP_Mount library’s Location target.

Hi @rmackay9 @LupusTheCanine
Thank you for this info.
Another key important issue is;
Is it possible to do “Calibration” by modifying the Lua script to improve accuracy?
I mean that the accuracy will be mainly depent on

  1. Terrain data base and
  2. Gimbal angle
    Correct ?

So I will do testing by pointing a known coordinate target ground object, and will check using your Lua script. I believe by doing several adjustment (of the Lua script calculation) , we may improve the accuracy… I understand the concept, But I don’t know how to do the detail script…
Any advice?
Tks

Add

  • Position estimation (especially altitude)
  • Camera attitude estimation (sum of drone orientation and gimbal angles if gimbal has no internal AHRS)
  • Sight collimation (basically gimbal and reticle pointing in (slightly) different directions)

You can increase errors by for example measuring in downslope direction.

During tests try measuring one small and symmetrical object (inverted bowl or a stake should be a good target, you don’t even really need it’s true position) on a flat ground (preferably at least 3x3 flat SRTM squares) from different directions and altitudes as this will make it easier to separate out bias caused by GPS offset, altitude estimation error and gimbal related errors.

Hello @rmackay9 , @LupusTheCanine
One of the key factor of accuracy is the Spacing Resolution of Terain dbase… So how to increase this 30m resolution? Do I have to do mapping for certain interest area? If yes, how to convert the mapping result into terrain dbase??
I really need your advice, as I am working to find hotspot geo location that causing fire in the forrest …
Any advice is highly appreciated.
Thank you…

On Ardupilot side of things there is a parameter to adjust grid spacing. It should be in the TERRAIN group.

On MP side of things I don’t know much.

Depending on where you live your government might make available digital elevation model and other geospatial information that will be significantly more up to date than SRTM.

Hello,
I think there are 2 possibilities to improve Terrain dbase
1.). Do mapping the area of interest
2). Obtain more accurate digital elevation map with better resolution.

So my key questions are:

  1. What data format of this DEM that I should input into Mission planner / Ardupilot?
  2. Where can I obtain this high accuracy DEM from well known institution ?? ( assuming my Government don’t have such dbase).
    3.If I can get this DEM dabse, how to convert into database format that can be input into MP/Ardupilot? (Similar to what terrain generator does)…
  3. If I have to do mapping certain area to get this High accuracy DEM, how to convert into data format that can be input nto MP same as question no.3 ?

Please help me to solve this issue, I really need advice from experts…
Maybe @rmackay9 @Michael_Oborne , @tridge could give advice…
Thank you very much for your valuable advice.
Tony

2. What country are you operating in?

Hi @LupusTheCanine
I am in Indonesia, South east Asia