mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 21:19:35 +00:00
snippet: correct formula for calculating angle to horizon
This commit is contained in:
@@ -86,12 +86,14 @@ flipped = not -pi_2 <= telem.pitch <= pi_2 or not -pi_2 <= telem.roll <= pi_2
|
||||
|
||||
Рассчет общего угла коптера к горизонту:
|
||||
|
||||
TODO: fix
|
||||
|
||||
```python
|
||||
pi_2 = math.pi / 2
|
||||
telem = get_telemetry()
|
||||
|
||||
flipped = not -pi_2 <= telem.pitch <= pi_2 or not -pi_2 <= telem.roll <= pi_2
|
||||
angle_to_horizon = math.atan(math.hypot(math.tan(telem.pitch), math.tan(telem.roll)))
|
||||
if flipped:
|
||||
angle_to_horizon = math.pi - angle_to_horizon
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user