Please select Into the mobile phone version | Continue to access the computer ver.
Close
You need to log in before you can reply       Login | Register now

[iOS] Conditions about Setting Corner Radius

Author: tonycph 2017-8-17 08:42
4 62
For what I knew, there are two conditions.
1. radius must be >= 0.2 and <= 1000
2. should not be larger than the three dimensional distance between any two of the three waypoints which make the corner


But when I tried to set corner radius, I hit an issue. First, if I set corner radius to 1, everything works fine. But, if I set corner radius to different numbers according to different coordinates, I get an error message of invalid corner radius.


One thing I am confusing is how to set the corner radius for the first coordinate and last coordinate because only this and next or last and this coordinates can be used.


Here is the case I double check the numbers to make sure all the numbers meet the above two conditions. I can see that my custom corner radius did not violate the above two conditions. Any suggestions for further checking?


let missionData = [[22.415248,114.2257918],[22.41534495726227,114.2255309676346],[22.41536197252572,114.2253109426763],[22.41529793478546,114.2252379362995],[22.41526197642088,114.2251529438014],[22.41527396254241,114.2249429771269],[22.41536599583924,114.2247299929672],[22.41544294171035,114.2246599202567],[22.41557998582719,114.224620944407],[22.41572499275207,114.2246339363569],[22.41584192030131,114.2246889216417],[22.41592297330498,114.22474793024],[22.41598994471132,114.2248429810221],[22.41601794026791,114.2249569749052],[22.4159959796816,114.2250819490815],[22.41591995581983,114.2252569632199],[22.41578492335974,114.2253739745881],[22.41568199358879,114.2253999584879],[22.41546398028731,114.2256349870529],[22.41486391983925,114.2272219327808],[22.41439595818519,114.2270759200275],[22.41414098069072,114.2269469225376],[22.41408096626401,114.2268879977583],[22.41402899846435,114.2267719922184],[22.41403696127236,114.2266279911219],[22.4141779448837,114.2262639650671],[22.41425396874547,114.2261439362136],[22.41466493345797,114.2263049525736],[22.41485998034475,114.226305958402],[22.41496592760085,114.2262709220467],[22.41504899226129,114.2262089797823],[22.41519693285226,114.2259529964593],[22.41517597809434,114.2256889665093],[22.41508092731237,114.2254209970649],[22.41497095674276,114.22527599014],[22.41482293233275,114.2251399518515],[22.41331594996154,114.2245739219302],[22.4132521,114.2247875]]


var missionCoords = [CLLocationCoordinate2D]()
for i in 0..<missionData.count {
    missionCoords.append(CLLocationCoordinate2D(latitude: missionData[0], longitude: missionData[1]))
}

let waypointMission = DJIMutableWaypointMission()
waypointMission.maxFlightSpeed = 15
waypointMission.autoFlightSpeed = 10
waypointMission.finishedAction = .autoLand
waypointMission.headingMode = .auto
waypointMission.flightPathMode = .curved

print("corner radius\t minDistanceBetweenAnyOfTwo \t cornerRadius<minDistanceBetweenAnyOfTwo\tcornerRadius>=0.2\tcornerRadius<=1000")
for i in 0..<missionCoords.count {
    var cornerRadius = 1.00
    var minDistanceBetweenAnyOfTwo = 0.00
    if i == 0 {
        cornerRadius = getDistanceBetweenTwoPoints(point1: missionCoords, point2: missionCoords[i+1]) / 2
        minDistanceBetweenAnyOfTwo = getDistanceBetweenTwoPoints(point1: missionCoords, point2: missionCoords[i+1])
    } else if i == missionCoords.count - 1 {
        cornerRadius = getDistanceBetweenTwoPoints(point1: missionCoords[i-1], point2: missionCoords) / 2
        minDistanceBetweenAnyOfTwo = getDistanceBetweenTwoPoints(point1: missionCoords[i-1], point2: missionCoords)
    } else {
        cornerRadius = getCornerRadiusInMeters(coord1: missionCoords[i-1], coord2: missionCoords, coord3: missionCoords[i+1], tolerateAwayFromPoint: 1.0)
         minDistanceBetweenAnyOfTwo = min(getDistanceBetweenTwoPoints(point1: missionCoords[i-1], point2: missionCoords), getDistanceBetweenTwoPoints(point1: missionCoords, point2: missionCoords[i+1]), getDistanceBetweenTwoPoints(point1: missionCoords[i-1], point2: missionCoords[i+1]))
    }
    print("\(cornerRadius)\t\(minDistanceBetweenAnyOfTwo)\t\(cornerRadius<minDistanceBetweenAnyOfTwo)\t\(cornerRadius>=0.2)\t\(cornerRadius<=1000)")


    let waypoint = DJIWaypoint(coordinate: missionCoords)
    waypoint.altitude = 50
    waypoint.cornerRadiusInMeters = Float(cornerRadius)
    waypointMission.add(waypoint)
}



Result:
corner radius         minDistanceBetweenAnyOfTwo          cornerRadius<minDistanceBetweenAnyOfTwo        cornerRadius>=0.2        cornerRadius<=1000
14.4608595603501        28.9217191207002        true        true        true
11.3658632957952        22.7317265915903        true        true        true
4.89053629983063        10.3337418223548        true        true        true
4.80704084380218        9.61408168760437        true        true        true
4.80704084380218        9.61408168760437        true        true        true
10.7129816710388        21.6586221316253        true        true        true
5.58239011649335        11.1647802329867        true        true        true
5.58239011649335        11.1647802329867        true        true        true
7.84865394509694        15.6973078901939        true        true        true
7.06580067880182        14.1316013576036        true        true        true
5.41918715164524        10.8383743032905        true        true        true
5.41918715164524        10.8383743032905        true        true        true
6.06959987270075        12.1391997454015        true        true        true
6.06959987270075        12.1391997454015        true        true        true
6.54748695283041        13.0949739056608        true        true        true
8.84588452298569        19.2023208266642        true        true        true
5.85388753002493        11.7077750600499        true        true        true
5.85388753002493        11.7077750600499        true        true        true
10.0956882233072        34.1816774828081        true        true        true
2.99348764169166        53.9567359887415        true        true        true
15.6014495611451        31.2028991222901        true        true        true
4.49923269138981        8.99846538277962        true        true        true
4.49923269138981        8.99846538277962        true        true        true
6.62892723210253        13.2578544642051        true        true        true
7.42618800683438        14.8523760136688        true        true        true
7.47651558316905        14.9530311663381        true        true        true
3.26704450626251        14.9530311663381        true        true        true
10.799472253268                21.598944506536                true        true        true
6.13710751575804        12.2742150315161        true        true        true
5.59643094994578        11.1928618998916        true        true        true
5.59643094994578        11.1928618998916        true        true        true
6.31644125150148        27.2830600021497        true        true        true
13.6415300010748        27.2830600021497        true        true        true
9.63318782002384        19.2663756400477        true        true        true
9.63318782002384        19.2663756400477        true        true        true
10.7803368822471        21.5606737644942        true        true        true
2.798595525624                23.0984925742473        true        true        true
11.5492462871237        23.0984925742473        true        true        true




Reply
Replies
DJI SDK Support
"2. should not be larger than the three dimensional distance between any two of the three waypoints which make the corner"  I don't know where you got this information. but this is something away from the real limitation.

For this , if the corner is made by three adjacent waypoints, ABC, then radius of A(short for Ra) plus raiuds of B(short for Rb) must be smaller than the distance between A and B. For the first and last waypoint , you shouldn't make the radius too large, it won't do the curve anyway.
2017-8-17 17:39
tonycph
DJI SDK Support Posted at 2017-8-17 17:39
"2. should not be larger than the three dimensional distance between any two of the three waypoints  ...

When I command+click the cornerRadiusInMeters, here is what I see.



This post contains more resources

You need to Login Before they can download or view, Not have an account?Register now

x
2017-8-17 18:44
tonycph
DJI SDK Support Posted at 2017-8-17 17:39
"2. should not be larger than the three dimensional distance between any two of the three waypoints  ...

Thank you for your help. Finally works fine now.
Before your reply, I already kept an eye on the sum of Ra and Rb but didn't notice that Ra+Rb must be < than distance between A and B. I thought Ra+Rb <= the distance is also ok.
2017-8-17 19:58
DJI SDK Support
Glad to see your problem is solved.
2017-8-21 14:36
You need to log in before you can reply Login | Register now

Quick Reply Back to top Back to list
Quick Reply Back to top Back to list