ArduPilot / ArduPilot/ardupilot

Copter: switch to NED for WPNav

Open
#187 5 comments 0 reactions 1 assignee Claimed by @lthall View on GitHub
Copter Enhancement
Dominant language
C++
Stars
15.9k
Forks
21.4k
Avg merge
3d 17h
Merged PRs (30d)
119

Description

```
// wpinav_set_origin_and_destination - set origin and destination using lat/lon coordinates
public function wpinav_set_origin_and_destination(origin:Location, destination:Location):void
{
//trace("wpinav_set_origin_and_destination", destination);
wpinav_origin.x = (origin.lat-home.lat) * LATLON_TO_CM;
wpinav_origin.y = (origin.lng-home.lng) * LATLON_TO_CM * scaleLongDown;
wpinav_destination.x = (destination.lat-home.lat) * LATLON_TO_CM;
wpinav_destination.y = (destination.lng-home.lng) * LATLON_TO_CM * scaleLongDown;
wpinav_pos_delta.x = wpinav_destination.x - wpinav_origin.x;
wpinav_pos_delta.y = wpinav_destination.y - wpinav_origin.y;
wpinav_track_length = wpinav_pos_delta.length;
wpinav_track_desired = 0;

// set next_WP, prev_WP for reporting purposes
// To-Do: move calcs below to a function
set_next_WP_latlon(
home.lat + wpinav_destination.x / LATLON_TO_CM,
home.lng + wpinav_destination.y / LATLON_TO_CM * scaleLongUp);
}
```

Throughout the code, the lat is assigned to the X axis. Latitude is North/South so it should be the Y axis!

Jason

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.