Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
c-astral-wrapper
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
c-astral-wrapper
Commits
12932f37
Commit
12932f37
authored
Aug 30, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug distance
parent
96011a77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
mavsdk_wrapper.cpp
mavsdk_wrapper.cpp
+10
-0
No files found.
mavsdk_wrapper.cpp
View file @
12932f37
...
@@ -118,6 +118,14 @@ static double bearing(double lat1, double lon1, double lat2, double lon2) {
...
@@ -118,6 +118,14 @@ static double bearing(double lat1, double lon1, double lat2, double lon2) {
return
atan2
(
x
,
y
);
return
atan2
(
x
,
y
);
}
}
// static double distance(double lat1, double lon1, double lat2, double lon2) {
// double la1 = toRad(lat1), la2 = toRad(lat2), lo1 = toRad(lon1), lo2 = toRad(lon2);
// double haversine_phi = pow(sin((la2 - la1) / 2), 2);
// double sin_lon = sin((lo2 - lo1) / 2);
// double h = haversine_phi + cos(la1) * cos(la2) * sin_lon * sin_lon;
// return 2 * EARTH_RADIUS * asin(sqrt(h));
// }
static
Coordinates
project
(
Coordinates
destination
,
double
bearing
)
{
static
Coordinates
project
(
Coordinates
destination
,
double
bearing
)
{
double
laRad
=
toRad
(
destination
.
latitude
);
double
laRad
=
toRad
(
destination
.
latitude
);
double
sinLa
=
sin
(
laRad
);
double
sinLa
=
sin
(
laRad
);
...
@@ -159,6 +167,8 @@ static int updateProjection(double current_lat, double current_lon) {
...
@@ -159,6 +167,8 @@ static int updateProjection(double current_lat, double current_lon) {
bearing
(
current_lat
,
current_lon
,
bearing
(
current_lat
,
current_lon
,
targeted_destination
.
latitude
,
targeted_destination
.
longitude
)
targeted_destination
.
latitude
,
targeted_destination
.
longitude
)
);
);
// printf("distance between follower and projection %f\n", distance(current_lat, current_lon, targeted_destination.latitude, targeted_destination.longitude));
// printf("bearing %f\n", toDeg(bearing(targeted_destination.latitude, targeted_destination.longitude, projected_destination.latitude, projected_destination.longitude)));
return
doReposition
(
return
doReposition
(
(
float
)
projected_destination
.
latitude
,
(
float
)
projected_destination
.
latitude
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment