Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
state.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2012 Felix Ruess <felix.ruess@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
31 #ifndef STATE_H
32 #define STATE_H
33 
34 #include "math/pprz_algebra_int.h"
36 #include "math/pprz_geodetic_int.h"
39 
40 #include "std.h"
41 #include <string.h>
42 
65 #define POS_ECEF_I 0
66 #define POS_NED_I 1
67 #define POS_ENU_I 2
68 #define POS_LLA_I 3
69 #define POS_UTM_I 4
70 #define POS_ECEF_F 5
71 #define POS_NED_F 6
72 #define POS_ENU_F 7
73 #define POS_LLA_F 8
74 #define POS_UTM_F 9
75 #define POS_LOCAL_COORD ((1<<POS_NED_I)|(1<<POS_NED_F)|(1<<POS_ENU_I)|(1<<POS_ENU_F))
76 #define POS_GLOBAL_COORD ((1<<POS_ECEF_I)|(1<<POS_ECEF_F)|(1<<POS_LLA_I)|(1<<POS_LLA_F)|(1<<POS_UTM_I)|(1<<POS_UTM_F))
77 
83 #define SPEED_ECEF_I 0
84 #define SPEED_NED_I 1
85 #define SPEED_ENU_I 2
86 #define SPEED_HNORM_I 3
87 #define SPEED_HDIR_I 4
88 #define SPEED_ECEF_F 5
89 #define SPEED_NED_F 6
90 #define SPEED_ENU_F 7
91 #define SPEED_HNORM_F 8
92 #define SPEED_HDIR_F 9
93 #define SPEED_LOCAL_COORD ((1<<SPEED_NED_I)|(1<<SPEED_ENU_I)|(1<<SPEED_NED_F)|(1<<SPEED_ENU_F))
94 
100 #define ACCEL_ECEF_I 0
101 #define ACCEL_NED_I 1
102 #define ACCEL_ECEF_F 2
103 #define ACCEL_NED_F 3
104 
110 #define RATE_I 0
111 #define RATE_F 1
112 
118 #define WINDSPEED_I 0
119 #define AIRSPEED_I 1
120 #define WINDSPEED_F 2
121 #define AIRSPEED_F 3
122 #define AOA_F 4
123 #define SIDESLIP_F 5
124 
130 struct State {
131 
141 
147 
154 
163 
168 
175 
182 
189 
194  float alt_agl_f;
195 
202 
208 
217 
220 
229 
232 
239 
257 
263 
269 
275 
281 
288 
294 
299 
305 
311 
328 
334 
340 
346 
358 
359 
368 
374 
391 
397 
403 
409 
414  float airspeed_f;
415 
421 
426  float sideslip_f;
427 
430 };
431 
432 extern struct State state;
433 
434 extern void stateInit(void);
435 
439 static inline void stateSetLocalOrigin_i(struct LtpDef_i* ltp_def) {
441  memcpy(&state.ned_origin_i, ltp_def, sizeof(struct LtpDef_i));
442  /* convert to float */
447 
448  /* clear bits for all local frame representations */
451  ClearBit(state.accel_status, ACCEL_NED_I);
452  ClearBit(state.accel_status, ACCEL_NED_F);
453 
456 }
457 
459 static inline void stateSetLocalUtmOrigin_f(struct UtmCoor_f* utm_def) {
460  memcpy(&state.utm_origin_f, utm_def, sizeof(struct UtmCoor_f));
462 
463  /* clear bits for all local frame representations */
466  ClearBit(state.accel_status, ACCEL_NED_I);
467  ClearBit(state.accel_status, ACCEL_NED_F);
468 }
469 /*******************************************************************************
470  * *
471  * Set and Get functions for the POSITION representations *
472  * *
473  ******************************************************************************/
474 
475 /************* declaration of transformation functions ************/
476 extern void stateCalcPositionEcef_i(void);
477 extern void stateCalcPositionNed_i(void);
478 extern void stateCalcPositionEnu_i(void);
479 extern void stateCalcPositionLla_i(void);
480 extern void stateCalcPositionUtm_f(void);
481 extern void stateCalcPositionEcef_f(void);
482 extern void stateCalcPositionNed_f(void);
483 extern void stateCalcPositionEnu_f(void);
484 extern void stateCalcPositionLla_f(void);
485 
486 /*********************** validity test functions ******************/
487 
489 static inline bool_t stateIsLocalCoordinateValid(void) {
491 }
492 
494 static inline bool_t stateIsGlobalCoordinateValid(void) {
496 }
497 
498 /************************ Set functions ****************************/
499 
501 static inline void stateSetPositionEcef_i(struct EcefCoor_i* ecef_pos) {
502  INT32_VECT3_COPY(state.ecef_pos_i, *ecef_pos);
503  /* clear bits for all position representations and only set the new one */
504  state.pos_status = (1 << POS_ECEF_I);
505 }
506 
508 static inline void stateSetPositionNed_i(struct NedCoor_i* ned_pos) {
509  INT32_VECT3_COPY(state.ned_pos_i, *ned_pos);
510  /* clear bits for all position representations and only set the new one */
511  state.pos_status = (1 << POS_NED_I);
512 }
513 
515 static inline void stateSetPositionEnu_i(struct EnuCoor_i* enu_pos) {
516  INT32_VECT3_COPY(state.enu_pos_i, *enu_pos);
517  /* clear bits for all position representations and only set the new one */
518  state.pos_status = (1 << POS_ENU_I);
519 }
520 
522 static inline void stateSetPositionLla_i(struct LlaCoor_i* lla_pos) {
523  LLA_COPY(state.lla_pos_i, *lla_pos);
524  /* clear bits for all position representations and only set the new one */
525  state.pos_status = (1 << POS_LLA_I);
526 }
527 
529 static inline void stateSetPosition_i(
530  struct EcefCoor_i* ecef_pos,
531  struct NedCoor_i* ned_pos,
532  struct EnuCoor_i* enu_pos,
533  struct LlaCoor_i* lla_pos) {
534  /* clear all status bit */
535  state.pos_status = 0;
536  if (ecef_pos != NULL) {
537  INT32_VECT3_COPY(state.ecef_pos_i, *ecef_pos);
538  state.pos_status |= (1 << POS_ECEF_I);
539  }
540  if (ned_pos != NULL) {
541  INT32_VECT3_COPY(state.ned_pos_i, *ned_pos);
542  state.pos_status |= (1 << POS_NED_I);
543  }
544  if (enu_pos != NULL) {
545  INT32_VECT3_COPY(state.enu_pos_i, *enu_pos);
546  state.pos_status |= (1 << POS_ENU_I);
547  }
548  if (lla_pos != NULL) {
549  LLA_COPY(state.lla_pos_i, *lla_pos);
550  state.pos_status |= (1 << POS_LLA_I);
551  }
552 }
553 
555 static inline void stateSetPositionUtm_f(struct UtmCoor_f* utm_pos) {
556  memcpy(&state.utm_pos_f, utm_pos, sizeof(struct UtmCoor_f));
557  /* clear bits for all position representations and only set the new one */
558  state.pos_status = (1 << POS_UTM_F);
559 }
560 
562 static inline void stateSetPositionEcef_f(struct EcefCoor_f* ecef_pos) {
563  VECT3_COPY(state.ecef_pos_f, *ecef_pos);
564  /* clear bits for all position representations and only set the new one */
565  state.pos_status = (1 << POS_ECEF_F);
566 }
567 
569 static inline void stateSetPositionNed_f(struct NedCoor_f* ned_pos) {
570  VECT3_COPY(state.ned_pos_f, *ned_pos);
571  /* clear bits for all position representations and only set the new one */
572  state.pos_status = (1 << POS_NED_F);
573 }
574 
576 static inline void stateSetPositionEnu_f(struct EnuCoor_f* enu_pos) {
577  VECT3_COPY(state.enu_pos_f, *enu_pos);
578  /* clear bits for all position representations and only set the new one */
579  state.pos_status = (1 << POS_ENU_F);
580 }
581 
583 static inline void stateSetPositionLla_f(struct LlaCoor_f* lla_pos) {
584  LLA_COPY(state.lla_pos_f, *lla_pos);
585  /* clear bits for all position representations and only set the new one */
586  state.pos_status = (1 << POS_LLA_F);
587 }
588 
590 static inline void stateSetPosition_f(
591  struct EcefCoor_f* ecef_pos,
592  struct NedCoor_f* ned_pos,
593  struct EnuCoor_f* enu_pos,
594  struct LlaCoor_f* lla_pos,
595  struct UtmCoor_f* utm_pos) {
596  /* clear all status bit */
597  state.pos_status = 0;
598  if (ecef_pos != NULL) {
599  VECT3_COPY(state.ecef_pos_f, *ecef_pos);
600  state.pos_status |= (1 << POS_ECEF_F);
601  }
602  if (ned_pos != NULL) {
603  VECT3_COPY(state.ned_pos_f, *ned_pos);
604  state.pos_status |= (1 << POS_NED_F);
605  }
606  if (enu_pos != NULL) {
607  VECT3_COPY(state.enu_pos_f, *enu_pos);
608  state.pos_status |= (1 << POS_ENU_F);
609  }
610  if (lla_pos != NULL) {
611  LLA_COPY(state.lla_pos_f, *lla_pos);
612  state.pos_status |= (1 << POS_LLA_F);
613  }
614  if (utm_pos != NULL) {
615  memcpy(&state.utm_pos_f, utm_pos, sizeof(struct UtmCoor_f));
616  state.pos_status |= (1 << POS_UTM_F);
617  }
618 }
619 
620 /************************ Get functions ****************************/
621 
623 static inline struct EcefCoor_i* stateGetPositionEcef_i(void) {
624  if (!bit_is_set(state.pos_status, POS_ECEF_I))
626  return &state.ecef_pos_i;
627 }
628 
630 static inline struct NedCoor_i* stateGetPositionNed_i(void) {
631  if (!bit_is_set(state.pos_status, POS_NED_I))
633  return &state.ned_pos_i;
634 }
635 
637 static inline struct EnuCoor_i* stateGetPositionEnu_i(void) {
638  if (!bit_is_set(state.pos_status, POS_ENU_I))
640  return &state.enu_pos_i;
641 }
642 
644 static inline struct LlaCoor_i* stateGetPositionLla_i(void) {
645  if (!bit_is_set(state.pos_status, POS_LLA_I))
647  return &state.lla_pos_i;
648 }
649 
651 static inline struct UtmCoor_f* stateGetPositionUtm_f(void) {
652  if (!bit_is_set(state.pos_status, POS_UTM_F))
654  return &state.utm_pos_f;
655 }
656 
658 static inline struct EcefCoor_f* stateGetPositionEcef_f(void) {
659  if (!bit_is_set(state.pos_status, POS_ECEF_F))
661  return &state.ecef_pos_f;
662 }
663 
665 static inline struct NedCoor_f* stateGetPositionNed_f(void) {
666  if (!bit_is_set(state.pos_status, POS_NED_F))
668  return &state.ned_pos_f;
669 }
670 
672 static inline struct EnuCoor_f* stateGetPositionEnu_f(void) {
673  if (!bit_is_set(state.pos_status, POS_ENU_F))
675  return &state.enu_pos_f;
676 }
677 
679 static inline struct LlaCoor_f* stateGetPositionLla_f(void) {
680  if (!bit_is_set(state.pos_status, POS_LLA_F))
682  return &state.lla_pos_f;
683 }
684 
689 /******************************************************************************
690  * *
691  * Set and Get functions for the SPEED representations *
692  * *
693  *****************************************************************************/
697 /************* declaration of transformation functions ************/
698 extern void stateCalcSpeedNed_i(void);
699 extern void stateCalcSpeedEnu_i(void);
700 extern void stateCalcSpeedEcef_i(void);
701 extern void stateCalcHorizontalSpeedNorm_i(void);
702 extern void stateCalcHorizontalSpeedDir_i(void);
703 extern void stateCalcSpeedNed_f(void);
704 extern void stateCalcSpeedEnu_f(void);
705 extern void stateCalcSpeedEcef_f(void);
706 extern void stateCalcHorizontalSpeedNorm_f(void);
707 extern void stateCalcHorizontalSpeedDir_f(void);
708 
709 /************************ Set functions ****************************/
710 
712 static inline void stateSetSpeedNed_i(struct NedCoor_i* ned_speed) {
713  INT32_VECT3_COPY(state.ned_speed_i, *ned_speed);
714  /* clear bits for all speed representations and only set the new one */
715  state.speed_status = (1 << SPEED_NED_I);
716 }
717 
719 static inline void stateSetSpeedEnu_i(struct EnuCoor_i* enu_speed) {
720  INT32_VECT3_COPY(state.enu_speed_i, *enu_speed);
721  /* clear bits for all speed representations and only set the new one */
722  state.speed_status = (1 << SPEED_ENU_I);
723 }
724 
726 static inline void stateSetSpeedEcef_i(struct EcefCoor_i* ecef_speed) {
727  INT32_VECT3_COPY(state.ecef_speed_i, *ecef_speed);
728  /* clear bits for all speed representations and only set the new one */
730 }
731 
733 static inline void stateSetSpeed_i(
734  struct EcefCoor_i* ecef_speed,
735  struct NedCoor_i* ned_speed,
736  struct EnuCoor_i* enu_speed) {
737  /* clear all status bit */
738  state.speed_status = 0;
739  if (ecef_speed != NULL) {
740  INT32_VECT3_COPY(state.ecef_speed_i, *ecef_speed);
741  state.speed_status |= (1 << SPEED_ECEF_I);
742  }
743  if (ned_speed != NULL) {
744  INT32_VECT3_COPY(state.ned_speed_i, *ned_speed);
745  state.speed_status |= (1 << SPEED_NED_I);
746  }
747  if (enu_speed != NULL) {
748  INT32_VECT3_COPY(state.enu_speed_i, *enu_speed);
749  state.speed_status |= (1 << SPEED_ENU_I);
750  }
751 }
752 
754 static inline void stateSetSpeedNed_f(struct NedCoor_f* ned_speed) {
755  VECT3_COPY(state.ned_speed_f, *ned_speed);
756  /* clear bits for all speed representations and only set the new one */
757  state.speed_status = (1 << SPEED_NED_F);
758 }
759 
761 static inline void stateSetSpeedEnu_f(struct EnuCoor_f* enu_speed) {
762  VECT3_COPY(state.enu_speed_f, *enu_speed);
763  /* clear bits for all speed representations and only set the new one */
764  state.speed_status = (1 << SPEED_ENU_F);
765 }
766 
768 static inline void stateSetSpeedEcef_f(struct EcefCoor_f* ecef_speed) {
769  VECT3_COPY(state.ecef_speed_f, *ecef_speed);
770  /* clear bits for all speed representations and only set the new one */
772 }
773 
775 static inline void stateSetSpeed_f(
776  struct EcefCoor_f* ecef_speed,
777  struct NedCoor_f* ned_speed,
778  struct EnuCoor_f* enu_speed) {
779  /* clear all status bit */
780  state.speed_status = 0;
781  if (ecef_speed != NULL) {
782  VECT3_COPY(state.ecef_speed_f, *ecef_speed);
783  state.speed_status |= (1 << SPEED_ECEF_F);
784  }
785  if (ned_speed != NULL) {
786  VECT3_COPY(state.ned_speed_f, *ned_speed);
787  state.speed_status |= (1 << SPEED_NED_F);
788  }
789  if (enu_speed != NULL) {
790  VECT3_COPY(state.enu_speed_f, *enu_speed);
791  state.speed_status |= (1 << SPEED_ENU_F);
792  }
793 }
794 
795 /************************ Get functions ****************************/
796 
798 static inline struct NedCoor_i* stateGetSpeedNed_i(void) {
799  if (!bit_is_set(state.speed_status, SPEED_NED_I))
801  return &state.ned_speed_i;
802 }
803 
805 static inline struct EnuCoor_i* stateGetSpeedEnu_i(void) {
806  if (!bit_is_set(state.speed_status, SPEED_ENU_I))
808  return &state.enu_speed_i;
809 }
810 
812 static inline struct EcefCoor_i* stateGetSpeedEcef_i(void) {
813  if (!bit_is_set(state.speed_status, SPEED_ECEF_I))
815  return &state.ecef_speed_i;
816 }
817 
820  if (!bit_is_set(state.speed_status, SPEED_HNORM_I))
822  return &state.h_speed_norm_i;
823 }
824 
826 static inline int32_t* stateGetHorizontalSpeedDir_i(void) {
827  if (!bit_is_set(state.speed_status, SPEED_HDIR_I))
829  return &state.h_speed_dir_i;
830 }
831 
833 static inline struct NedCoor_f* stateGetSpeedNed_f(void) {
834  if (!bit_is_set(state.speed_status, SPEED_NED_F))
836  return &state.ned_speed_f;
837 }
838 
840 static inline struct EnuCoor_f* stateGetSpeedEnu_f(void) {
841  if (!bit_is_set(state.speed_status, SPEED_ENU_F))
843  return &state.enu_speed_f;
844 }
845 
847 static inline struct EcefCoor_f* stateGetSpeedEcef_f(void) {
848  if (!bit_is_set(state.speed_status, SPEED_ECEF_F))
850  return &state.ecef_speed_f;
851 }
852 
854 static inline float* stateGetHorizontalSpeedNorm_f(void) {
855  if (!bit_is_set(state.speed_status, SPEED_HNORM_F))
857  return &state.h_speed_norm_f;
858 }
859 
861 static inline float* stateGetHorizontalSpeedDir_f(void) {
862  if (!bit_is_set(state.speed_status, SPEED_HDIR_F))
864  return &state.h_speed_dir_f;
865 }
870 /******************************************************************************
871  * *
872  * Set and Get functions for the ACCELERATION representations *
873  * *
874  *****************************************************************************/
878 /************* declaration of transformation functions ************/
879 extern void stateCalcAccelNed_i(void);
880 extern void stateCalcAccelEcef_i(void);
881 extern void stateCalcAccelNed_f(void);
882 extern void stateCalcAccelEcef_f(void);
883 
884 /*********************** validity test functions ******************/
885 
887 static inline bool_t stateIsAccelValid(void) {
888  return (state.accel_status);
889 }
890 
891 /************************ Set functions ****************************/
892 
894 static inline void stateSetAccelNed_i(struct NedCoor_i* ned_accel) {
895  INT32_VECT3_COPY(state.ned_accel_i, *ned_accel);
896  /* clear bits for all accel representations and only set the new one */
897  state.accel_status = (1 << ACCEL_NED_I);
898 }
899 
901 static inline void stateSetAccelEcef_i(struct EcefCoor_i* ecef_accel) {
902  INT32_VECT3_COPY(state.ecef_accel_i, *ecef_accel);
903  /* clear bits for all accel representations and only set the new one */
905 }
906 
908 static inline void stateSetAccelNed_f(struct NedCoor_f* ned_accel) {
909  VECT3_COPY(state.ned_accel_f, *ned_accel);
910  /* clear bits for all accel representations and only set the new one */
911  state.accel_status = (1 << ACCEL_NED_F);
912 }
913 
915 static inline void stateSetAccelEcef_f(struct EcefCoor_f* ecef_accel) {
916  VECT3_COPY(state.ecef_accel_f, *ecef_accel);
917  /* clear bits for all accel representations and only set the new one */
919 }
920 
921 /************************ Get functions ****************************/
922 
924 static inline struct NedCoor_i* stateGetAccelNed_i(void) {
925  if (!bit_is_set(state.accel_status, ACCEL_NED_I))
927  return &state.ned_accel_i;
928 }
929 
931 static inline struct EcefCoor_i* stateGetAccelEcef_i(void) {
932  if (!bit_is_set(state.accel_status, ACCEL_ECEF_I))
934  return &state.ecef_accel_i;
935 }
936 
938 static inline struct NedCoor_f* stateGetAccelNed_f(void) {
939  if (!bit_is_set(state.accel_status, ACCEL_NED_F))
941  return &state.ned_accel_f;
942 }
943 
945 static inline struct EcefCoor_f* stateGetAccelEcef_f(void) {
946  if (!bit_is_set(state.accel_status, ACCEL_ECEF_F))
948  return &state.ecef_accel_f;
949 }
952 /******************************************************************************
953 * *
954 * Set and Get functions for the ATTITUDE representations *
955 * (Calls the functions in math/pprz_orientation_conversion) *
956 * *
957 *****************************************************************************/
960 /*********************** validity test functions ******************/
961 
963 static inline bool_t stateIsAttitudeValid(void) {
965 }
966 
967 /************************ Set functions ****************************/
968 
970 static inline void stateSetNedToBodyQuat_i(struct Int32Quat* ned_to_body_quat) {
972 }
973 
975 static inline void stateSetNedToBodyRMat_i(struct Int32RMat* ned_to_body_rmat) {
977 }
978 
980 static inline void stateSetNedToBodyEulers_i(struct Int32Eulers* ned_to_body_eulers) {
982 }
983 
985 static inline void stateSetNedToBodyQuat_f(struct FloatQuat* ned_to_body_quat) {
987 }
988 
990 static inline void stateSetNedToBodyRMat_f(struct FloatRMat* ned_to_body_rmat) {
992 }
993 
995 static inline void stateSetNedToBodyEulers_f(struct FloatEulers* ned_to_body_eulers) {
997 }
998 
999 /************************ Get functions ****************************/
1000 
1002 static inline struct Int32Quat* stateGetNedToBodyQuat_i(void) {
1004 }
1005 
1007 static inline struct Int32RMat* stateGetNedToBodyRMat_i(void) {
1009 }
1010 
1012 static inline struct Int32Eulers* stateGetNedToBodyEulers_i(void) {
1014 }
1015 
1017 static inline struct FloatQuat* stateGetNedToBodyQuat_f(void) {
1019 }
1020 
1022 static inline struct FloatRMat* stateGetNedToBodyRMat_f(void) {
1024 }
1025 
1027 static inline struct FloatEulers* stateGetNedToBodyEulers_f(void) {
1029 }
1033 /******************************************************************************
1034  * *
1035  * Set and Get functions for the ANGULAR RATE representations *
1036  * *
1037  *****************************************************************************/
1041 /************* declaration of transformation functions ************/
1042 extern void stateCalcBodyRates_i(void);
1043 extern void stateCalcBodyRates_f(void);
1044 
1045 /*********************** validity test functions ******************/
1046 
1048 static inline bool_t stateIsRateValid(void) {
1049  return (state.rate_status);
1050 }
1051 
1052 /************************ Set functions ****************************/
1053 
1055 static inline void stateSetBodyRates_i(struct Int32Rates* body_rate) {
1056  RATES_COPY(state.body_rates_i, *body_rate);
1057  /* clear bits for all attitude representations and only set the new one */
1058  state.rate_status = (1 << RATE_I);
1059 }
1060 
1062 static inline void stateSetBodyRates_f(struct FloatRates* body_rate) {
1063  RATES_COPY(state.body_rates_f, *body_rate);
1064  /* clear bits for all attitude representations and only set the new one */
1065  state.rate_status = (1 << RATE_F);
1066 }
1067 
1068 /************************ Get functions ****************************/
1069 
1071 static inline struct Int32Rates* stateGetBodyRates_i(void) {
1072  if (!bit_is_set(state.rate_status, RATE_I))
1074  return &state.body_rates_i;
1075 }
1076 
1078 static inline struct FloatRates* stateGetBodyRates_f(void) {
1079  if (!bit_is_set(state.rate_status, RATE_F))
1081  return &state.body_rates_f;
1082 }
1083 
1088 /******************************************************************************
1089  * *
1090  * Set and Get functions for the WIND- AND AIRSPEED representations *
1091  * *
1092  *****************************************************************************/
1096 /************* declaration of transformation functions ************/
1097 extern void stateCalcHorizontalWindspeed_i(void);
1098 extern void stateCalcAirspeed_i(void);
1099 extern void stateCalcHorizontalWindspeed_f(void);
1100 extern void stateCalcAirspeed_f(void);
1101 
1102 
1103 /************************ validity test function *******************/
1104 
1106 static inline bool_t stateIsWindspeedValid(void) {
1107  return (state.wind_air_status &= ~((1<<WINDSPEED_I)|(1<<WINDSPEED_F)));
1108 }
1109 
1111 static inline bool_t stateIsAirspeedValid(void) {
1112  return (state.wind_air_status &= ~((1<<AIRSPEED_I)|(1<<AIRSPEED_F)));
1113 }
1114 
1116 static inline bool_t stateIsAngleOfAttackValid(void) {
1117  return (state.wind_air_status &= ~(1<<AOA_F));
1118 }
1119 
1121 static inline bool_t stateIsSideslipValid(void) {
1122  return (state.wind_air_status &= ~(1<<SIDESLIP_F));
1123 }
1124 
1125 /************************ Set functions ****************************/
1126 
1128 static inline void stateSetHorizontalWindspeed_i(struct Int32Vect2* h_windspeed) {
1129  VECT2_COPY(state.h_windspeed_i, *h_windspeed);
1130  /* clear bits for all windspeed representations and only set the new one */
1131  ClearBit(state.wind_air_status, WINDSPEED_F);
1133 }
1134 
1136 static inline void stateSetAirspeed_i(int32_t* airspeed) {
1137  state.airspeed_i = *airspeed;
1138  /* clear bits for all airspeed representations and only set the new one */
1139  ClearBit(state.wind_air_status, AIRSPEED_F);
1140  SetBit(state.wind_air_status, AIRSPEED_I);
1141 }
1142 
1144 static inline void stateSetHorizontalWindspeed_f(struct FloatVect2* h_windspeed) {
1145  VECT2_COPY(state.h_windspeed_f, *h_windspeed);
1146  /* clear bits for all windspeed representations and only set the new one */
1147  ClearBit(state.wind_air_status, WINDSPEED_I);
1149 }
1150 
1152 static inline void stateSetAirspeed_f(float* airspeed) {
1153  state.airspeed_f = *airspeed;
1154  /* clear bits for all airspeed representations and only set the new one */
1155  ClearBit(state.wind_air_status, AIRSPEED_I);
1156  SetBit(state.wind_air_status, AIRSPEED_F);
1157 }
1158 
1160 static inline void stateSetAngleOfAttack_f(float* aoa) {
1161  state.angle_of_attack_f = *aoa;
1162  /* clear bits for all AOA representations and only set the new one */
1164  SetBit(state.wind_air_status, AOA_F);
1165 }
1166 
1168 static inline void stateSetSideslip_f(float* sideslip) {
1169  state.sideslip_f = *sideslip;
1170  /* clear bits for all sideslip representations and only set the new one */
1172  SetBit(state.wind_air_status, SIDESLIP_F);
1173 }
1174 
1175 /************************ Get functions ****************************/
1176 
1178 static inline struct Int32Vect2* stateGetHorizontalWindspeed_i(void) {
1179  if (!bit_is_set(state.wind_air_status, WINDSPEED_I))
1181  return &state.h_windspeed_i;
1182 }
1183 
1185 static inline int32_t* stateGetAirspeed_i(void) {
1186  if (!bit_is_set(state.wind_air_status, AIRSPEED_I))
1188  return &state.airspeed_i;
1189 }
1190 
1192 static inline struct FloatVect2* stateGetHorizontalWindspeed_f(void) {
1193  if (!bit_is_set(state.wind_air_status, WINDSPEED_F))
1195  return &state.h_windspeed_f;
1196 }
1197 
1199 static inline float* stateGetAirspeed_f(void) {
1200  if (!bit_is_set(state.wind_air_status, AIRSPEED_F))
1202  return &state.airspeed_f;
1203 }
1204 
1206 static inline float* stateGetAngleOfAttack_f(void) {
1208 // if (!bit_is_set(state.wind_air_status, AOA_F))
1209 // stateCalcAOA_f();
1210  return &state.angle_of_attack_f;
1211 }
1212 
1214 static inline float* stateGetSideslip_f(void) {
1216 // if (!bit_is_set(state.wind_air_status, SIDESLIP_F))
1217 // stateCalcSideslip_f();
1218  return &state.sideslip_f;
1219 }
1220 
1226 #endif /* STATE_H */
static void stateSetPositionEcef_f(struct EcefCoor_f *ecef_pos)
Set position from ECEF coordinates (float).
Definition: state.h:562
#define RMAT_FLOAT_OF_BFP(_ef, _ei)
Definition: pprz_algebra.h:591
static void stateSetPositionNed_i(struct NedCoor_i *ned_pos)
Set position from local NED coordinates (int).
Definition: state.h:508
#define POS_ENU_F
Definition: state.h:72
unsigned short uint16_t
Definition: types.h:16
struct EnuCoor_i enu_speed_i
Velocity in East North Up coordinates.
Definition: state.h:274
#define ACCEL_ECEF_I
Definition: state.h:100
static void stateSetNedToBodyRMat_f(struct FloatRMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (float).
Definition: state.h:990
static void stateSetNedToBodyEulers_f(struct FloatEulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (float).
Definition: state.h:995
vector in EarthCenteredEarthFixed coordinates
static void orientationSetQuat_f(struct OrientationReps *orientation, struct FloatQuat *quat)
Set vehicle body attitude from quaternion (float).
static float * stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
Definition: state.h:861
rotation matrix
static bool_t stateIsRateValid(void)
Test if rates are valid.
Definition: state.h:1048
static struct Int32RMat * orientationGetRMat_i(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (int).
#define POS_LLA_I
Definition: state.h:68
#define RATE_F
Definition: state.h:111
void stateCalcAccelNed_i(void)
Definition: state.c:1024
struct Int32Mat33 ltp_of_ecef
Rotation matrix.
#define AIRSPEED_F
Definition: state.h:121
#define WINDSPEED_I
Definition: state.h:118
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition: state.h:1027
struct FloatVect2 h_windspeed_f
Horizontal windspeed.
Definition: state.h:408
static void stateSetSpeed_f(struct EcefCoor_f *ecef_speed, struct NedCoor_f *ned_speed, struct EnuCoor_f *enu_speed)
Set multiple speed coordinates (float).
Definition: state.h:775
vector in EarthCenteredEarthFixed coordinates
static struct EcefCoor_i * stateGetPositionEcef_i(void)
Get position in ECEF coordinates (int).
Definition: state.h:623
float h_speed_dir_f
Direction of horizontal ground speed.
Definition: state.h:316
void stateCalcHorizontalWindspeed_i(void)
Definition: state.c:1180
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
Definition: state.h:1007
float airspeed_f
Norm of relative air speed.
Definition: state.h:414
void stateCalcAirspeed_i(void)
Definition: state.c:1192
angular rates
static bool_t stateIsAttitudeValid(void)
Test if attitudes are valid.
Definition: state.h:963
static void stateSetAccelEcef_f(struct EcefCoor_f *ecef_accel)
Set acceleration in ECEF coordinates (float).
Definition: state.h:915
Rotation quaternion.
struct EcefCoor_i ecef_pos_i
Position in EarthCenteredEarthFixed coordinates.
Definition: state.h:146
struct FloatRates body_rates_f
Angular rates in body frame.
Definition: state.h:379
static void stateSetHorizontalWindspeed_i(struct Int32Vect2 *h_windspeed)
Set horizontal windspeed (int).
Definition: state.h:1128
struct LtpDef_f ned_origin_f
Definition of the local (flat earth) coordinate system.
Definition: state.h:216
static struct Int32Eulers * orientationGetEulers_i(struct OrientationReps *orientation)
Get vehicle body attitude euler angles (int).
#define SPEED_ENU_F
Definition: state.h:90
static void stateSetAngleOfAttack_f(float *aoa)
Set angle of attack (float).
Definition: state.h:1160
static struct FloatRMat * orientationGetRMat_f(struct OrientationReps *orientation)
Get vehicle body attitude rotation matrix (float).
static struct EcefCoor_f * stateGetAccelEcef_f(void)
Get acceleration in ECEF coordinates (float).
Definition: state.h:945
void stateCalcSpeedEnu_f(void)
Definition: state.c:877
struct LlaCoor_i lla_pos_i
Position in Latitude, Longitude and Altitude.
Definition: state.h:153
#define POS_UTM_F
Definition: state.h:74
#define RATES_COPY(_a, _b)
Definition: pprz_algebra.h:301
static void stateSetSpeedEcef_f(struct EcefCoor_f *ecef_speed)
Set ground speed in ECEF coordinates (float).
Definition: state.h:768
static float * stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
Definition: state.h:854
struct LlaCoor_f lla_pos_f
Position in Latitude, Longitude and Altitude.
Definition: state.h:201
struct EcefCoor_f ecef_pos_f
Position in EarthCenteredEarthFixed coordinates.
Definition: state.h:207
float h_speed_norm_f
Norm of horizontal ground speed.
Definition: state.h:310
#define M_OF_MM(_mm)
struct FloatMat33 ltp_of_ecef
rotation from ECEF to local frame
#define SPEED_NED_I
Definition: state.h:84
struct EcefCoor_i ecef_accel_i
Acceleration in EarthCenteredEarthFixed coordinates.
Definition: state.h:339
bool_t ned_initialized_f
True if local float coordinate frame is initialsed.
Definition: state.h:219
struct NedCoor_i ned_speed_i
Velocity in North East Down coordinates.
Definition: state.h:268
uint8_t rate_status
Holds the status bits for all angular rate representations.
Definition: state.h:367
static void stateSetNedToBodyQuat_f(struct FloatQuat *ned_to_body_quat)
Set vehicle body attitude from quaternion (float).
Definition: state.h:985
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA coordinates (float).
Definition: state.h:679
static void stateSetPositionEcef_i(struct EcefCoor_i *ecef_pos)
Set position from ECEF coordinates (int).
Definition: state.h:501
static float * stateGetSideslip_f(void)
Get sideslip (float).
Definition: state.h:1214
#define POS_NED_F
Definition: state.h:71
void stateCalcPositionEcef_f(void)
Definition: state.c:349
static int32_t * stateGetHorizontalSpeedNorm_i(void)
Get norm of horizontal ground speed (int).
Definition: state.h:819
struct Int32Vect2 h_windspeed_i
Horizontal windspeed in north/east.
Definition: state.h:396
void stateCalcBodyRates_i(void)
Definition: state.c:1147
int32_t h_speed_dir_i
Direction of horizontal ground speed.
Definition: state.h:287
struct LlaCoor_i lla
Reference point in lla.
static void stateSetPosition_i(struct EcefCoor_i *ecef_pos, struct NedCoor_i *ned_pos, struct EnuCoor_i *enu_pos, struct LlaCoor_i *lla_pos)
Set multiple position coordinates (int).
Definition: state.h:529
vector in Latitude, Longitude and Altitude
static bool_t stateIsSideslipValid(void)
test if sideslip is available.
Definition: state.h:1121
#define POS_NED_I
Definition: state.h:66
static void stateSetSpeedNed_i(struct NedCoor_i *ned_speed)
Set ground speed in local NED coordinates (int).
Definition: state.h:712
void stateCalcHorizontalSpeedNorm_i(void)
Definition: state.c:739
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
Definition: state.h:672
euler angles
static struct EcefCoor_f * stateGetPositionEcef_f(void)
Get position in ECEF coordinates (float).
Definition: state.h:658
static struct Int32Quat * stateGetNedToBodyQuat_i(void)
Get vehicle body attitude quaternion (int).
Definition: state.h:1002
static int32_t * stateGetHorizontalSpeedDir_i(void)
Get dir of horizontal ground speed (int).
Definition: state.h:826
static bool_t stateIsWindspeedValid(void)
test if wind speed is available.
Definition: state.h:1106
static void orientationSetQuat_i(struct OrientationReps *orientation, struct Int32Quat *quat)
Set vehicle body attitude from quaternion (int).
static struct EcefCoor_f * stateGetSpeedEcef_f(void)
Get ground speed in ECEF coordinates (float).
Definition: state.h:847
void stateCalcSpeedNed_f(void)
Definition: state.c:820
struct EcefCoor_f ecef
origin of local frame in ECEF
vector in Latitude, Longitude and Altitude
static struct EcefCoor_i * stateGetSpeedEcef_i(void)
Get ground speed in ECEF coordinates (int).
Definition: state.h:812
static struct FloatQuat * stateGetNedToBodyQuat_f(void)
Get vehicle body attitude quaternion (float).
Definition: state.h:1017
static bool_t stateIsGlobalCoordinateValid(void)
Test if global coordinates are valid.
Definition: state.h:494
static float * stateGetAirspeed_f(void)
Get airspeed (float).
Definition: state.h:1199
static void stateSetSpeedEnu_i(struct EnuCoor_i *enu_speed)
Set ground speed in local ENU coordinates (int).
Definition: state.h:719
static bool_t stateIsAirspeedValid(void)
test if air speed is available.
Definition: state.h:1111
static struct FloatRMat * stateGetNedToBodyRMat_f(void)
Get vehicle body attitude rotation matrix (float).
Definition: state.h:1022
#define POS_GLOBAL_COORD
Definition: state.h:76
vector in North East Down coordinates
static void stateSetPositionUtm_f(struct UtmCoor_f *utm_pos)
Set position from UTM coordinates (float).
Definition: state.h:555
static void stateSetAccelNed_i(struct NedCoor_i *ned_accel)
Set acceleration in NED coordinates (int).
Definition: state.h:894
Paparazzi floating point math for geodetic calculations.
void stateInit(void)
Definition: state.c:43
Roation quaternion.
struct NedCoor_f ned_pos_f
Position in North East Down coordinates.
Definition: state.h:238
struct NedCoor_i ned_accel_i
Acceleration in North East Down coordinates.
Definition: state.h:333
static struct Int32Vect2 * stateGetHorizontalWindspeed_i(void)
Get horizontal windspeed (int).
Definition: state.h:1178
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
Definition: state.h:798
static void stateSetSpeedNed_f(struct NedCoor_f *ned_speed)
Set ground speed in local NED coordinates (float).
Definition: state.h:754
static void orientationSetEulers_i(struct OrientationReps *orientation, struct Int32Eulers *eulers)
Set vehicle body attitude from euler angles (int).
void stateCalcSpeedEnu_i(void)
Definition: state.c:657
definition of the local (flat earth) coordinate system
#define ACCEL_ECEF_F
Definition: state.h:102
static struct Int32Rates * stateGetBodyRates_i(void)
Get vehicle body angular rate (int).
Definition: state.h:1071
static int32_t * stateGetAirspeed_i(void)
Get airspeed (int).
Definition: state.h:1185
uint16_t speed_status
Holds the status bits for all ground speed representations.
Definition: state.h:256
#define ECEF_FLOAT_OF_BFP(_o, _i)
#define SPEED_HNORM_I
Definition: state.h:86
Paparazzi floating point algebra.
static void orientationSetRMat_i(struct OrientationReps *orientation, struct Int32RMat *rmat)
Set vehicle body attitude from rotation matrix (int).
#define SIDESLIP_F
Definition: state.h:123
vector in North East Down coordinates Units: meters
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Definition: state.h:833
void stateCalcHorizontalSpeedNorm_f(void)
Definition: state.c:959
static void stateSetPosition_f(struct EcefCoor_f *ecef_pos, struct NedCoor_f *ned_pos, struct EnuCoor_f *enu_pos, struct LlaCoor_f *lla_pos, struct UtmCoor_f *utm_pos)
Set multiple position coordinates (float).
Definition: state.h:590
#define SPEED_HDIR_I
Definition: state.h:87
static void stateSetPositionLla_i(struct LlaCoor_i *lla_pos)
Set position from LLA coordinates (int).
Definition: state.h:522
#define AIRSPEED_I
Definition: state.h:119
static void stateSetLocalOrigin_i(struct LtpDef_i *ltp_def)
Set the local (flat earth) coordinate frame origin (int).
Definition: state.h:440
void stateCalcPositionEnu_i(void)
Definition: state.c:190
static void stateSetPositionEnu_f(struct EnuCoor_f *enu_pos)
Set position from local ENU coordinates (float).
Definition: state.h:576
#define SPEED_ECEF_I
Definition: state.h:83
static struct NedCoor_f * stateGetAccelNed_f(void)
Get acceleration in NED coordinates (float).
Definition: state.h:938
static bool_t stateIsLocalCoordinateValid(void)
Test if local coordinates are valid.
Definition: state.h:489
position in UTM coordinates Units: meters
float sideslip_f
Sideslip angle Unit: rad.
Definition: state.h:426
void stateCalcPositionLla_i(void)
Definition: state.c:282
uint8_t accel_status
Holds the status bits for all acceleration representations.
Definition: state.h:327
void stateCalcSpeedEcef_i(void)
Definition: state.c:714
static void stateSetAirspeed_f(float *airspeed)
Set airspeed (float).
Definition: state.h:1152
void stateCalcPositionUtm_f(void)
Definition: state.c:327
void stateCalcPositionNed_f(void)
Definition: state.c:382
static void stateSetSideslip_f(float *sideslip)
Set angle of attack (float).
Definition: state.h:1168
void stateCalcHorizontalSpeedDir_i(void)
Definition: state.c:789
Paparazzi fixed point math for geodetic calculations.
struct EnuCoor_f enu_speed_f
Velocity in East North Up coordinates.
Definition: state.h:304
int32_t h_speed_norm_i
Norm of horizontal ground speed.
Definition: state.h:280
static bool_t stateIsAccelValid(void)
Test if accelerations are valid.
Definition: state.h:887
void stateCalcAccelEcef_f(void)
Definition: state.c:1113
static void stateSetBodyRates_i(struct Int32Rates *body_rate)
Set vehicle body angular rate (int).
Definition: state.h:1055
static void stateSetPositionNed_f(struct NedCoor_f *ned_pos)
Set position from local NED coordinates (float).
Definition: state.h:569
angular rates
struct UtmCoor_f utm_origin_f
Definition of the origin of Utm coordinate system.
Definition: state.h:228
void stateCalcAccelNed_f(void)
Definition: state.c:1081
struct OrientationReps ned_to_body_orientation
Definition: state.h:357
static float * stateGetAngleOfAttack_f(void)
Get angle of attack (float).
Definition: state.h:1206
#define INT32_VECT3_COPY(_o, _i)
void stateCalcBodyRates_f(void)
Definition: state.c:1158
static struct FloatRates * stateGetBodyRates_f(void)
Get vehicle body angular rate (float).
Definition: state.h:1078
signed long int32_t
Definition: types.h:19
float alt_agl_f
Altitude above ground level.
Definition: state.h:194
static void stateSetNedToBodyQuat_i(struct Int32Quat *ned_to_body_quat)
Set vehicle body attitude from quaternion (int).
Definition: state.h:970
static void stateSetNedToBodyEulers_i(struct Int32Eulers *ned_to_body_eulers)
Set vehicle body attitude from euler angles (int).
Definition: state.h:980
#define ACCEL_NED_F
Definition: state.h:103
#define TRUE
Definition: imu_chimu.h:144
#define POS_ECEF_I
Definition: state.h:65
struct LtpDef_i ned_origin_i
Definition of the local (flat earth) coordinate system.
Definition: state.h:162
void stateCalcAccelEcef_i(void)
Definition: state.c:1056
int32_t airspeed_i
Norm of horizontal ground speed.
Definition: state.h:402
#define SPEED_ENU_I
Definition: state.h:85
#define WINDSPEED_F
Definition: state.h:120
void stateCalcSpeedEcef_f(void)
Definition: state.c:934
#define POS_LLA_F
Definition: state.h:73
bool_t utm_initialized_f
True if utm origin (float) coordinate frame is initialsed.
Definition: state.h:231
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
Definition: state.h:651
unsigned char uint8_t
Definition: types.h:14
static void stateSetAirspeed_i(int32_t *airspeed)
Set airspeed (int).
Definition: state.h:1136
static struct Int32Quat * orientationGetQuat_i(struct OrientationReps *orientation)
Get vehicle body attitude quaternion (int).
struct Int32Rates body_rates_i
Angular rates in body frame.
Definition: state.h:373
int32_t hmsl
Height above mean sea level in mm.
static void stateSetSpeed_i(struct EcefCoor_i *ecef_speed, struct NedCoor_i *ned_speed, struct EnuCoor_i *enu_speed)
Set multiple speed coordinates (int).
Definition: state.h:733
static void stateSetAccelEcef_i(struct EcefCoor_i *ecef_accel)
Set acceleration in ECEF coordinates (int).
Definition: state.h:901
void stateCalcPositionEnu_f(void)
Definition: state.c:459
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
Definition: state.h:840
static struct EnuCoor_i * stateGetSpeedEnu_i(void)
Get ground speed in local ENU coordinates (int).
Definition: state.h:805
uint8_t wind_air_status
Holds the status bits for all wind- and airspeed representations.
Definition: state.h:390
#define LLA_FLOAT_OF_BFP(_o, _i)
static void stateSetPositionLla_f(struct LlaCoor_f *lla_pos)
Set position from LLA coordinates (float).
Definition: state.h:583
static struct FloatVect2 * stateGetHorizontalWindspeed_f(void)
Get horizontal windspeed (float).
Definition: state.h:1192
void stateCalcHorizontalSpeedDir_f(void)
Definition: state.c:986
static struct FloatEulers * orientationGetEulers_f(struct OrientationReps *orientation)
Get vehicle body attitude euler angles (float).
struct NedCoor_f ned_accel_f
Acceleration in North East Down coordinates.
Definition: state.h:345
struct EcefCoor_i ecef
Reference point in ecef.
definition of the local (flat earth) coordinate system
struct LlaCoor_f lla
origin of local frame in LLA
static bool_t orienationCheckValid(struct OrientationReps *orientation)
Test if orientations are valid.
#define SPEED_NED_F
Definition: state.h:89
struct UtmCoor_f utm_pos_f
Position in UTM coordinates.
Definition: state.h:188
struct EcefCoor_f ecef_speed_f
Velocity in EarthCenteredEarthFixed coordinates.
Definition: state.h:293
rotation matrix
#define VECT3_COPY(_a, _b)
Definition: pprz_algebra.h:111
#define SPEED_LOCAL_COORD
Definition: state.h:93
struct EcefCoor_i ecef_speed_i
Velocity in EarthCenteredEarthFixed coordinates.
Definition: state.h:262
static void orientationSetRMat_f(struct OrientationReps *orientation, struct FloatRMat *rmat)
Set vehicle body attitude from rotation matrix (float).
void stateCalcPositionNed_i(void)
Definition: state.c:98
Structure holding vehicle state data.
Definition: state.h:130
static void stateSetSpeedEcef_i(struct EcefCoor_i *ecef_speed)
Set ground speed in ECEF coordinates (int).
Definition: state.h:726
void stateCalcAirspeed_f(void)
Definition: state.c:1215
void stateCalcSpeedNed_i(void)
Definition: state.c:600
struct NedCoor_f ned_speed_f
speed in North East Down coordinates
Definition: state.h:298
struct EnuCoor_i enu_pos_i
Position in East North Up coordinates.
Definition: state.h:181
vector in East North Up coordinates Units: meters
float angle_of_attack_f
Angle of attack Unit: rad.
Definition: state.h:420
uint16_t pos_status
Holds the status bits for all position representations.
Definition: state.h:140
#define SPEED_HDIR_F
Definition: state.h:92
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
Definition: state.h:630
bool_t ned_initialized_i
true if local int coordinate frame is initialsed
Definition: state.h:167
static void stateSetSpeedEnu_f(struct EnuCoor_f *enu_speed)
Set ground speed in local ENU coordinates (float).
Definition: state.h:761
#define AOA_F
Definition: state.h:122
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
Definition: state.h:637
void stateCalcPositionEcef_i(void)
Definition: state.c:64
#define POS_LOCAL_COORD
Definition: state.h:75
Generic orientation representation and conversion.
struct EnuCoor_f enu_pos_f
Position in East North Up coordinates.
Definition: state.h:245
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
Definition: state.h:1012
static void stateSetBodyRates_f(struct FloatRates *body_rate)
Set vehicle body angular rate (float).
Definition: state.h:1062
void stateCalcPositionLla_f(void)
Definition: state.c:544
struct EcefCoor_f ecef_accel_f
Acceleration in EarthCenteredEarthFixed coordinates.
Definition: state.h:351
static void stateSetPositionEnu_i(struct EnuCoor_i *enu_pos)
Set position from local ENU coordinates (int).
Definition: state.h:515
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
Definition: state.h:665
vector in East North Up coordinates
static void stateSetNedToBodyRMat_i(struct Int32RMat *ned_to_body_rmat)
Set vehicle body attitude from rotation matrix (int).
Definition: state.h:975
#define POS_ECEF_F
Definition: state.h:70
static void stateSetAccelNed_f(struct NedCoor_f *ned_accel)
Set acceleration in NED coordinates (float).
Definition: state.h:908
float hmsl
Height above mean sea level in meters.
#define VECT2_COPY(_a, _b)
Definition: pprz_algebra.h:43
static struct EcefCoor_i * stateGetAccelEcef_i(void)
Get acceleration in ECEF coordinates (int).
Definition: state.h:931
static void stateSetLocalUtmOrigin_f(struct UtmCoor_f *utm_def)
Set the local (flat earth) coordinate frame origin from UTM (float).
Definition: state.h:459
#define SPEED_ECEF_F
Definition: state.h:88
#define RATE_I
Definition: state.h:110
#define ACCEL_NED_I
Definition: state.h:101
#define POS_ENU_I
Definition: state.h:67
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
Definition: state.h:644
struct NedCoor_i ned_pos_i
Position in North East Down coordinates.
Definition: state.h:174
#define SPEED_HNORM_F
Definition: state.h:91
struct State state
Definition: state.c:36
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
Definition: state.h:924
static struct FloatQuat * orientationGetQuat_f(struct OrientationReps *orientation)
Get vehicle body attitude quaternion (float).
static bool_t stateIsAngleOfAttackValid(void)
test if angle of attack is available.
Definition: state.h:1116
Paparazzi fixed point algebra.
void stateCalcHorizontalWindspeed_f(void)
Definition: state.c:1203
#define LLA_COPY(_pos1, _pos2)
Definition: pprz_geodetic.h:17
static void stateSetHorizontalWindspeed_f(struct FloatVect2 *h_windspeed)
Set horizontal windspeed (float).
Definition: state.h:1144
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).
euler angles