mirror of
https://github.com/SMerrony/telloterm.git
synced 2023-04-24 19:01:59 +03:00
Add Pitch, Roll & Yaw display
This commit is contained in:
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"remotePath": "",
|
||||
"port": 2345,
|
||||
"host": "127.0.0.1",
|
||||
"program": "${fileDirname}",
|
||||
"env": {},
|
||||
"args": [],
|
||||
"showLog": true
|
||||
}
|
||||
]
|
||||
}
|
||||
14
telloterm.go
14
telloterm.go
@@ -100,6 +100,9 @@ const (
|
||||
fQatY
|
||||
fQatZ
|
||||
fTemp
|
||||
fRoll
|
||||
fPitch
|
||||
fYaw
|
||||
fSSID
|
||||
fVersion
|
||||
fNumFields
|
||||
@@ -157,6 +160,10 @@ func setupFields() {
|
||||
fields[fTemp] = field{label{4, 19, termbox.ColorWhite, termbox.ColorDefault, "Temp:"}, 16, 19, 6, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
fields[fQatW] = field{label{30, 19, termbox.ColorWhite, termbox.ColorDefault, "W Quat:"}, 42, 19, 6, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
|
||||
fields[fRoll] = field{label{4, 20, termbox.ColorWhite, termbox.ColorDefault, "Roll:"}, 16, 20, 6, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
fields[fPitch] = field{label{30, 20, termbox.ColorWhite, termbox.ColorDefault, "Pitch:"}, 42, 20, 6, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
fields[fYaw] = field{label{54, 20, termbox.ColorWhite, termbox.ColorDefault, "Yaw:"}, 66, 20, 6, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
|
||||
fields[fSSID] = field{label{10, 22, termbox.ColorWhite, termbox.ColorDefault, "SSID: "}, 16, 22, 20, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
fields[fVersion] = field{label{56, 22, termbox.ColorWhite, termbox.ColorDefault, "Firmware: "}, 66, 22, 10, termbox.ColorWhite, termbox.ColorDefault, "?"}
|
||||
|
||||
@@ -461,6 +468,11 @@ func updateFields(newFd tello.FlightData) {
|
||||
fields[fQatZ].value = fmt.Sprintf("%f", newFd.IMU.QuaternionZ)
|
||||
fields[fTemp].value = fmt.Sprintf("%dC", newFd.IMU.Temperature)
|
||||
|
||||
p, r, y := tello.QuatToEulerDeg(float64(newFd.IMU.QuaternionX), float64(newFd.IMU.QuaternionY), float64(newFd.IMU.QuaternionZ), float64(newFd.IMU.QuaternionW))
|
||||
fields[fRoll].value = fmt.Sprintf("%d", r)
|
||||
fields[fPitch].value = fmt.Sprintf("%d", p)
|
||||
fields[fYaw].value = fmt.Sprintf("%d", y)
|
||||
|
||||
fields[fSSID].value = newFd.SSID
|
||||
fields[fVersion].value = newFd.Version
|
||||
}
|
||||
@@ -495,7 +507,7 @@ func startVideo() {
|
||||
go func() {
|
||||
for {
|
||||
drone.StartVideo()
|
||||
time.Sleep(time.Second)
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user