-
Notifications
You must be signed in to change notification settings - Fork 0
/
actionsD2C.go
33 lines (30 loc) · 1.33 KB
/
actionsD2C.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package parrotbebop
import (
"fmt"
)
// Try to figure out what kind of command that where received.
// Based on the type of cmdArgs we can execute som action.
func (d *Drone) checkCmdFromDrone(cmd protocolARCommands, cmdArgs interface{}) {
fmt.Printf("----------COMMAND-------------------------------------------\r\n")
fmt.Printf("-- cmd = %+v\r\n", cmd)
fmt.Printf("-- Value of cmdArgs = %+v\r\n", cmdArgs)
fmt.Printf("-- Type of cmdArgs = %+T\r\n", cmdArgs)
switch cmdArgs := cmdArgs.(type) {
case Ardrone3CameraStateOrientationArguments:
//log.Printf("** EXECUTING ACTION FOR TYPE, Ardrone3CameraStateOrientationArguments ...........\r\n")
case Ardrone3PilotingStateAttitudeChangedArguments:
//log.Printf("** EXECUTING ACTION FOR TYPE, Ardrone3PilotingStateAttitudeChangedArguments\r\n")
case Ardrone3PilotingStateGpsLocationChangedArguments:
d.gps.chCurrentLocation <- gpsLatLonAlt{
latitude: cmdArgs.Latitude,
longitude: cmdArgs.Longitude,
altitude: cmdArgs.Altitude,
}
case Ardrone3PilotingStatemoveToChanged:
// Indicated that the drone have moved to the asked position.
// We send a signal to the moveTo handling here to indicate
// that it can pick the next available position in the buffer.
d.gps.chMoveToPositionDone <- struct{}{}
}
fmt.Printf("-----------------------------------------------------------\r\n")
}