Skip to content

Commit

Permalink
create angle_diff() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani authored Apr 17, 2024
1 parent 2b5aa4d commit f84b0eb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/mavextra/mymavextra.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ window.named = (NAMED_VALUE_FLOAT, key) => {
}
return null
}

window.angle_diff = (angle1, angle2) => {
let ret = angle1 - angle2
if (ret > 180) {
ret -= 360
}
if (ret < -180) {
ret += 360
}
return ret
}

0 comments on commit f84b0eb

Please sign in to comment.