-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommandStructure.go.prev
More file actions
14526 lines (11276 loc) · 432 KB
/
commandStructure.go.prev
File metadata and controls
14526 lines (11276 loc) · 432 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package parrotbebop
import (
"encoding/binary"
"fmt"
"log"
"math"
"reflect"
)
type ProjectDef uint8
type ClassDef uint8
type CmdDef uint16
type Command struct {
Project ProjectDef
Class ClassDef
Cmd CmdDef
}
// All ARDrone3-only commands
const ProjectArdrone3 ProjectDef = 1
// All commands related to piloting the drone
const ClassPiloting ClassDef = 0
// title : Take off,
// desc : Ask the drone to take off.\n On the fixed wings (such as Disco): not used except to cancel a land.,
// support : 0901;090c;090e,
// result : On the quadcopters: the drone takes off if its [FlyingState](#1-4-1) was landed.\n On the fixed wings, the landing process is aborted if the [FlyingState](#1-4-1) was landing.\n Then, event [FlyingState](#1-4-1) is triggered.,
const CmdTakeOff CmdDef = 1
type Ardrone3PilotingTakeOff Command
type Ardrone3PilotingTakeOffArguments struct {
}
func (a Ardrone3PilotingTakeOff) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingTakeOffArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingTakeOffArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingTakeOff = Ardrone3PilotingTakeOff{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdTakeOff,
}
// title : Move the drone,
// desc : Move the drone.\n The libARController is sending the command each 50ms.\n\n **Please note that you should call setPilotingPCMD and not sendPilotingPCMD because the libARController is handling the periodicity and the buffer on which it is sent.**,
// support : 0901;090c;090e,
// result : The drone moves! Yaaaaay!\n Event [SpeedChanged](#1-4-5), [AttitudeChanged](#1-4-6) and [PositionChanged](#1-4-4) (only if gps of the drone has fixed) are triggered.,
const CmdPCMD CmdDef = 2
type Ardrone3PilotingPCMD Command
type Ardrone3PilotingPCMDArguments struct {
Flag uint8
Roll int8
Pitch int8
Yaw int8
Gaz int8
TimestampAndSeqNum uint32
}
func (a Ardrone3PilotingPCMD) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingPCMDArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Flag)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Roll)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Pitch)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Yaw)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Gaz)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.TimestampAndSeqNum)
offset += 4
return arg
}
func (a Ardrone3PilotingPCMDArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingPCMD = Ardrone3PilotingPCMD{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdPCMD,
}
// title : Land,
// desc : Land.\n Please note that on copters, if you put some positive gaz (in the [PilotingCommand](#1-0-2)) during the landing, it will cancel it.,
// support : 0901;090c;090e,
// result : On the copters, the drone lands if its [FlyingState](#1-4-1) was taking off, hovering or flying.\n On the fixed wings, the drone lands if its [FlyingState](#1-4-1) was hovering or flying.\n Then, event [FlyingState](#1-4-1) is triggered.,
const CmdLanding CmdDef = 3
type Ardrone3PilotingLanding Command
type Ardrone3PilotingLandingArguments struct {
}
func (a Ardrone3PilotingLanding) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingLandingArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingLandingArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingLanding = Ardrone3PilotingLanding{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdLanding,
}
// title : Cut out the motors,
// desc : Cut out the motors.\n This cuts immediatly the motors. The drone will fall.\n This command is sent on a dedicated high priority buffer which will infinitely retry to send it if the command is not delivered.,
// support : 0901;090c;090e,
// result : The drone immediatly cuts off its motors.\n Then, event [FlyingState](#1-4-1) is triggered.,
const CmdEmergency CmdDef = 4
type Ardrone3PilotingEmergency Command
type Ardrone3PilotingEmergencyArguments struct {
}
func (a Ardrone3PilotingEmergency) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingEmergencyArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingEmergencyArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingEmergency = Ardrone3PilotingEmergency{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdEmergency,
}
// title : Return home,
// desc : Return home.\n Ask the drone to fly to its [HomePosition](#1-24-0).\n The availability of the return home can be get from [ReturnHomeState](#1-4-3).\n Please note that the drone will wait to be hovering to start its return home. This means that it will wait to have a [flag](#1-0-2) set at 0.,
// support : 0901;090c;090e,
// result : The drone will fly back to its home position.\n Then, event [ReturnHomeState](#1-4-3) is triggered.\n You can get a state pending if the drone is not ready to start its return home process but will do it as soon as it is possible.,
const CmdNavigateHome CmdDef = 5
type Ardrone3PilotingNavigateHome Command
type Ardrone3PilotingNavigateHomeArguments struct {
Start uint8
}
func (a Ardrone3PilotingNavigateHome) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingNavigateHomeArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Start)
offset++
return arg
}
func (a Ardrone3PilotingNavigateHomeArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingNavigateHome = Ardrone3PilotingNavigateHome{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdNavigateHome,
}
// title : Auto take off mode,
// desc : Auto take off mode.,
const CmdAutoTakeOffMode CmdDef = 6
type Ardrone3PilotingAutoTakeOffMode Command
type Ardrone3PilotingAutoTakeOffModeArguments struct {
State uint8
}
func (a Ardrone3PilotingAutoTakeOffMode) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingAutoTakeOffModeArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.State)
offset++
return arg
}
func (a Ardrone3PilotingAutoTakeOffModeArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingAutoTakeOffMode = Ardrone3PilotingAutoTakeOffMode{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdAutoTakeOffMode,
}
// title : Move the drone to a relative position,
// desc : Move the drone to a relative position and rotate heading by a given angle.\n Moves are relative to the current drone orientation, (drone's reference).\n Also note that the given rotation will not modify the move (i.e. moves are always rectilinear).,
// support : 0901:3.3.0;090c:3.3.0,
// result : The drone will move of the given offsets.\n Then, event [RelativeMoveEnded](#1-34-0) is triggered.\n If you send a second relative move command, the drone will trigger a [RelativeMoveEnded](#1-34-0) with the offsets it managed to do before this new command and the value of error set to interrupted.,
const CmdMoveBy CmdDef = 7
type Ardrone3PilotingmoveBy Command
type Ardrone3PilotingmoveByArguments struct {
DX float32
DY float32
DZ float32
DPsi float32
}
func (a Ardrone3PilotingmoveBy) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingmoveByArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.DX)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.DY)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.DZ)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.DPsi)
offset += 4
return arg
}
func (a Ardrone3PilotingmoveByArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingmoveBy = Ardrone3PilotingmoveBy{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdMoveBy,
}
// title : Prepare the drone to take off,
// desc : Prepare the drone to take off.\n On copters: initiates the thrown takeoff. Note that the drone will do the thrown take off even if it is steady.\n On fixed wings: initiates the take off process on the fixed wings.\n\n Setting the state to 0 will cancel the preparation. You can cancel it before that the drone takes off.,
// support : 090e;090c:4.3.0,
// result : The drone will arm its motors if not already armed.\n Then, event [FlyingState](#1-4-1) is triggered with state set at motor ramping.\n Then, event [FlyingState](#1-4-1) is triggered with state set at userTakeOff.\n Then user can throw the drone to make it take off.,
const CmdUserTakeOff CmdDef = 8
type Ardrone3PilotingUserTakeOff Command
type Ardrone3PilotingUserTakeOffArguments struct {
State uint8
}
func (a Ardrone3PilotingUserTakeOff) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingUserTakeOffArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.State)
offset++
return arg
}
func (a Ardrone3PilotingUserTakeOffArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingUserTakeOff = Ardrone3PilotingUserTakeOff{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdUserTakeOff,
}
// title : Circle,
// desc : Make the fixed wing circle.\n The circle will use the [CirclingAltitude](#1-6-14) and the [CirclingRadius](#1-6-13),
// support : 090e,
// result : The fixed wing will circle in the given direction.\n Then, event [FlyingState](#1-4-1) is triggered with state set at hovering.,
const CmdCircle CmdDef = 9
type Ardrone3PilotingCircle Command
type Ardrone3PilotingCircleArguments struct {
Direction uint32
}
func (a Ardrone3PilotingCircle) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingCircleArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Direction)
offset += 4
return arg
}
func (a Ardrone3PilotingCircleArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingCircle = Ardrone3PilotingCircle{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdCircle,
}
// title : Move to a location,
// desc : Move the drone to a specified location.\n If a new command moveTo is sent, the drone will immediatly run it (no cancel will be issued).\n If a [CancelMoveTo](#1-0-11) command is sent, the moveTo is stopped.\n During the moveTo, all pitch, roll and gaz values of the piloting command will be ignored by the drone.\n However, the yaw value can be used.,
// support : 090c:4.3.0,
// result : Event [MovingTo](#1-4-12) is triggered with state running. Then, the drone will move to the given location.\n Then, event [MoveToChanged](#1-4-12) is triggered with state succeed.,
const CmdMoveTo CmdDef = 10
type Ardrone3PilotingmoveTo Command
type Ardrone3PilotingmoveToArguments struct {
Latitude float64
Longitude float64
Altitude float64
Orientationmode uint32
Heading float32
}
func (a Ardrone3PilotingmoveTo) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingmoveToArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Latitude)
offset += 8
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Longitude)
offset += 8
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Altitude)
offset += 8
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Orientationmode)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Heading)
offset += 4
return arg
}
func (a Ardrone3PilotingmoveToArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingmoveTo = Ardrone3PilotingmoveTo{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdMoveTo,
}
// title : Cancel the moveTo,
// desc : Cancel the current moveTo.\n If there is no current moveTo, this command has no effect.,
// support : 090c:4.3.0,
// result : Event [MoveToChanged](#1-4-12) is triggered with state canceled.,
const CmdCancelMoveTo CmdDef = 11
type Ardrone3PilotingCancelMoveTo Command
type Ardrone3PilotingCancelMoveToArguments struct {
}
func (a Ardrone3PilotingCancelMoveTo) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingCancelMoveToArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingCancelMoveToArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingCancelMoveTo = Ardrone3PilotingCancelMoveTo{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdCancelMoveTo,
}
// title : Start a piloted POI,
// desc : Start a piloted Point Of Interest.\n During a piloted POI, the drone will always look at the given POI but can be piloted normally. However, yaw value is ignored. Camera tilt and pan command is also ignored.\n Ignored if [PilotedPOI](#1-4-14) state is UNAVAILABLE.,
// support : 090c:4.3.0,
// result : If the drone is hovering, event [PilotedPOI](#1-4-14) is triggered with state RUNNING. If the drone is not hovering, event [PilotedPOI](#1-4-14) is triggered with state PENDING, waiting to hover. When the drone hovers, the state will change to RUNNING. If the drone does not hover for a given time, piloted POI is canceled by the drone and state will change to AVAILABLE. Then, the drone will look at the given location.,
const CmdStartPilotedPOI CmdDef = 12
type Ardrone3PilotingStartPilotedPOI Command
type Ardrone3PilotingStartPilotedPOIArguments struct {
Latitude float64
Longitude float64
Altitude float64
}
func (a Ardrone3PilotingStartPilotedPOI) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingStartPilotedPOIArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Latitude)
offset += 8
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Longitude)
offset += 8
ConvLittleEndianSliceToNumeric(b[offset:offset+8], &arg.Altitude)
offset += 8
return arg
}
func (a Ardrone3PilotingStartPilotedPOIArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingStartPilotedPOI = Ardrone3PilotingStartPilotedPOI{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdStartPilotedPOI,
}
// title : Stop the piloted POI,
// desc : Stop the piloted Point Of Interest.\n If [PilotedPOI](#1-4-14) state is RUNNING or PENDING, stop it.,
// support : 090c:4.3.0,
// result : Event [PilotedPOI](#1-4-14) is triggered with state AVAILABLE.,
const CmdStopPilotedPOI CmdDef = 13
type Ardrone3PilotingStopPilotedPOI Command
type Ardrone3PilotingStopPilotedPOIArguments struct {
}
func (a Ardrone3PilotingStopPilotedPOI) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingStopPilotedPOIArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingStopPilotedPOIArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingStopPilotedPOI = Ardrone3PilotingStopPilotedPOI{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdStopPilotedPOI,
}
// title : Cancel the relative move,
// desc : Cancel the current relative move.\n If there is no current relative move, this command has no effect.,
// result : Event [RelativeMoveChanged](#1-4-16) is triggered with state canceled.,
const CmdCancelMoveBy CmdDef = 14
type Ardrone3PilotingCancelMoveBy Command
type Ardrone3PilotingCancelMoveByArguments struct {
}
func (a Ardrone3PilotingCancelMoveBy) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3PilotingCancelMoveByArguments{}
// No arguments to decode here !!
return arg
}
func (a Ardrone3PilotingCancelMoveByArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var PilotingCancelMoveBy = Ardrone3PilotingCancelMoveBy{
Project: ProjectArdrone3,
Class: ClassPiloting,
Cmd: CmdCancelMoveBy,
}
// Animation commands
const ClassAnimations ClassDef = 5
// title : Make a flip,
// desc : Make a flip.,
// support : 0901;090c,
// result : The drone will make a flip if it has enough battery.,
const CmdFlip CmdDef = 0
type Ardrone3AnimationsFlip Command
type Ardrone3AnimationsFlipArguments struct {
Direction uint32
}
func (a Ardrone3AnimationsFlip) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3AnimationsFlipArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Direction)
offset += 4
return arg
}
func (a Ardrone3AnimationsFlipArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var AnimationsFlip = Ardrone3AnimationsFlip{
Project: ProjectArdrone3,
Class: ClassAnimations,
Cmd: CmdFlip,
}
// Ask the drone to move camera
const ClassCamera ClassDef = 1
// title : Move the camera,
// desc : Move the camera.\n You can get min and max values for tilt and pan using [CameraInfo](#0-15-0).,
// support : 0901;090c;090e,
// result : The drone moves its camera.\n Then, event [CameraOrientation](#1-25-0) is triggered.,
const CmdOrientation CmdDef = 0
type Ardrone3CameraOrientation Command
type Ardrone3CameraOrientationArguments struct {
Tilt int8
Pan int8
}
func (a Ardrone3CameraOrientation) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3CameraOrientationArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Tilt)
offset++
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Pan)
offset++
return arg
}
func (a Ardrone3CameraOrientationArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var CameraOrientation = Ardrone3CameraOrientation{
Project: ProjectArdrone3,
Class: ClassCamera,
Cmd: CmdOrientation,
}
// title : Move the camera,
// desc : Move the camera.\n You can get min and max values for tilt and pan using [CameraInfo](#0-15-0).,
// support : 0901;090c;090e,
// result : The drone moves its camera.\n Then, event [CameraOrientationV2](#1-25-2) is triggered.,
const CmdOrientationV2 CmdDef = 1
type Ardrone3CameraOrientationV2 Command
type Ardrone3CameraOrientationV2Arguments struct {
Tilt float32
Pan float32
}
func (a Ardrone3CameraOrientationV2) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3CameraOrientationV2Arguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Tilt)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Pan)
offset += 4
return arg
}
func (a Ardrone3CameraOrientationV2Arguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var CameraOrientationV2 = Ardrone3CameraOrientationV2{
Project: ProjectArdrone3,
Class: ClassCamera,
Cmd: CmdOrientationV2,
}
// title : Move the camera using velocity,
// desc : Move the camera given velocity consign.\n You can get min and max values for tilt and pan using [CameraVelocityRange](#1-25-4).,
// support : 0901;090c;090e,
// result : The drone moves its camera.\n Then, event [CameraOrientationV2](#1-25-2) is triggered.,
const CmdVelocity CmdDef = 2
type Ardrone3CameraVelocity Command
type Ardrone3CameraVelocityArguments struct {
Tilt float32
Pan float32
}
func (a Ardrone3CameraVelocity) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3CameraVelocityArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Tilt)
offset += 4
ConvLittleEndianSliceToNumeric(b[offset:offset+4], &arg.Pan)
offset += 4
return arg
}
func (a Ardrone3CameraVelocityArguments) Encode() []byte {
//TODO: .............
//TODO: .............
var bs []byte
valueOf := reflect.ValueOf(a)
log.Printf("valueOf: %#v\n", valueOf)
fmt.Printf("Number of fields in the struct: %v\n", valueOf.NumField())
fmt.Println("--------------Iterating fields-----------------")
log.Printf("valueOf.NumField(): %#v\n", valueOf.NumField())
for i := 0; i < valueOf.NumField(); i++ {
b := ConvLittleEndianNumericToSlice(valueOf.Field(i).Interface())
fmt.Printf("mySlice = %#v\n", b)
log.Printf("b: %#v\n", b)
bs = append(bs, b...)
}
return bs
}
var CameraVelocity = Ardrone3CameraVelocity{
Project: ProjectArdrone3,
Class: ClassCamera,
Cmd: CmdVelocity,
}
// Media recording management
const ClassMediaRecord ClassDef = 7
// title : Take a picture,
// desc : Take a picture.,
const CmdPicture CmdDef = 0
type Ardrone3MediaRecordPicture Command
type Ardrone3MediaRecordPictureArguments struct {
Massstorageid uint8
}
func (a Ardrone3MediaRecordPicture) Decode(b []byte) interface{} {
//TODO: .............
arg := Ardrone3MediaRecordPictureArguments{}
var offset = 0
ConvLittleEndianSliceToNumeric(b[offset:offset+1], &arg.Massstorageid)
offset++