RcdMathLib_doc
Open Source Library for Linear and Non-linear Algebra
pos_algos_common_test.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
3  * 2020 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser General
6  * Public License v2.1. See the file LICENSE in the top level directory for more
7  * details.
8  */
9 
24 #include <stdio.h>
25 
26 #include "DOP.h"
27 #include "matrix.h"
28 #include "trilateration.h"
29 
31 {
32  matrix_t ref_pos_matrix[4][3] = { { 0, 0, 1.67 }, // P1
33  { 4.5, 0, 0.75 }, // P2
34  { 4.5, 4.45, 0.75 }, // P3
35  { 0, 4.92, 0.86 } // P4
36  };
37 
38  uint8_t m = 4;
39  double A_matrix[m][4];
40  double true_pos[] = { 1, 1, 0 };
41 
42  double pdop_val = get_PDOP(m, ref_pos_matrix, true_pos);
43 
44  printf("pdop_val = %.7f\n", pdop_val);
45 
46  trilateration_get_A_matrix(m, ref_pos_matrix, A_matrix);
47  printf("A_matrix = ");
48  matrix_flex_print(m, 4, A_matrix, 3, 7);
49  puts("");
50 }
trilateration.h
Implement the trilateration algorithm.
trilateration_get_A_matrix
void trilateration_get_A_matrix(uint8_t m, matrix_t anchor_pos_matrix[m][3], matrix_t A_matrix[m][4])
Computes the matrix of the equation system: .
Definition: trilateration.c:256
get_PDOP
matrix_t get_PDOP(uint8_t m, matrix_t ref_Matrix[m][3], matrix_t true_pos[m])
Compute the Position Dilution of Precision (PDOP).
Definition: DOP.c:30
matrix.h
Matrix computations.
matrix_flex_print
void matrix_flex_print(uint8_t m, uint8_t n, matrix_t matrix[m][n], uint8_t before_dec, uint8_t after_dec)
Display the values of the matrix elements.
Definition: matrix.c:220
pos_algos_common_test
void pos_algos_common_test(void)
Example of common localization algorithms.
Definition: pos_algos_common_test.c:30
matrix_t
#define matrix_t
Define the data type of the matrix elements.
Definition: matrix.h:38
DOP.h
Compute the Position Dilution of Precision (PDOP).