Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
POLLIEN Baptiste
paparazzi-frama-c
Commits
0c0d1cd7
Commit
0c0d1cd7
authored
Mar 25, 2021
by
POLLIEN Baptiste
Browse files
Verification of the conversion quat to rmat
parent
1824d063
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
7 deletions
+59
-7
.gitignore
.gitignore
+2
-2
.vscode/settings.json
.vscode/settings.json
+5
-0
sw/airborne/frama-c-analysis.sh
sw/airborne/frama-c-analysis.sh
+1
-1
sw/airborne/math/pprz_algebra_float.c
sw/airborne/math/pprz_algebra_float.c
+36
-0
sw/airborne/math/pprz_algebra_float.h
sw/airborne/math/pprz_algebra_float.h
+12
-1
sw/airborne/math/pprz_algebra_float_frama_c.h
sw/airborne/math/pprz_algebra_float_frama_c.h
+2
-2
sw/airborne/output-frama-c-analysis.py
sw/airborne/output-frama-c-analysis.py
+1
-1
No files found.
.gitignore
View file @
0c0d1cd7
...
...
@@ -196,8 +196,8 @@ tests/results/*
*.kate-swp
# Frama-C
**/.frama-c
!sw/airborne/.frama-c/wp/script
**/.lia.cache
**/tmp_wp_analysis.txt
sw/airborne/.frama-c/wp/cache
\ No newline at end of file
sw/airborne/.frama-c/wp/cache
sw/airborne/.frama-c/frama_c_journal.ml
.vscode/settings.json
View file @
0c0d1cd7
...
...
@@ -8,4 +8,9 @@
"[python]"
:
{
"editor.tabSize"
:
4
,
},
"files.associations"
:
{
"array"
:
"cpp"
,
"string_view"
:
"cpp"
,
"type_traits"
:
"cpp"
},
}
\ No newline at end of file
sw/airborne/frama-c-analysis.sh
View file @
0c0d1cd7
...
...
@@ -24,7 +24,7 @@ FRAMAC=$FRAMAC_PREFIX"frama-c"
FRAMACGUI
=
$FRAMAC_PREFIX
"frama-c-gui"
EVA
=
"-eva -lib-entry -main"
WP
=
"-wp-fct"
WP_ARGS
=
"-wp-cache update -wp-model real+Cast -wp-prover alt-ergo,cvc4-strings-ce,tip -wp-log r:"
$TMP_FILE_RES
WP_ARGS
=
"-wp-cache update -wp-model real+Cast -wp-prover alt-ergo,cvc4-strings-ce,
z3,z3-ce,z3-nobv,
tip -wp-log r:"
$TMP_FILE_RES
RTE
=
"-rte -no-warn-left-shift-negative"
# To stop de script with ctrl+C
...
...
sw/airborne/math/pprz_algebra_float.c
View file @
0c0d1cd7
...
...
@@ -235,6 +235,7 @@ void float_rmat_of_eulers_312(struct FloatRMat *rm, struct FloatEulers *e)
/* C n->b rotation matrix */
void
float_rmat_of_quat
(
struct
FloatRMat
*
rm
,
struct
FloatQuat
*
q
)
{
#ifndef FRAMA_C_ANALYSIS
const
float
_a
=
M_SQRT2
*
q
->
qi
;
const
float
_b
=
M_SQRT2
*
q
->
qx
;
const
float
_c
=
M_SQRT2
*
q
->
qy
;
...
...
@@ -255,6 +256,32 @@ void float_rmat_of_quat(struct FloatRMat *rm, struct FloatQuat *q)
RMAT_ELMT
(
*
rm
,
2
,
0
)
=
bd
+
ac
;
RMAT_ELMT
(
*
rm
,
2
,
1
)
=
cd
-
ab
;
RMAT_ELMT
(
*
rm
,
2
,
2
)
=
a2_1
+
_d
*
_d
;
#else
const
float
_a
=
q
->
qi
;
const
float
_b
=
q
->
qx
;
const
float
_c
=
q
->
qy
;
const
float
_d
=
q
->
qz
;
const
float
a2_1
=
2
*
_a
*
_a
-
1
;
const
float
ab
=
2
*
_a
*
_b
;
const
float
ac
=
2
*
_a
*
_c
;
const
float
ad
=
2
*
_a
*
_d
;
const
float
bc
=
2
*
_b
*
_c
;
const
float
bd
=
2
*
_b
*
_d
;
const
float
cd
=
2
*
_c
*
_d
;
RMAT_ELMT
(
*
rm
,
0
,
0
)
=
a2_1
+
2
*
_b
*
_b
;
RMAT_ELMT
(
*
rm
,
0
,
1
)
=
bc
+
ad
;
RMAT_ELMT
(
*
rm
,
0
,
2
)
=
bd
-
ac
;
RMAT_ELMT
(
*
rm
,
1
,
0
)
=
bc
-
ad
;
RMAT_ELMT
(
*
rm
,
1
,
1
)
=
a2_1
+
2
*
_c
*
_c
;
RMAT_ELMT
(
*
rm
,
1
,
2
)
=
cd
+
ab
;
RMAT_ELMT
(
*
rm
,
2
,
0
)
=
bd
+
ac
;
RMAT_ELMT
(
*
rm
,
2
,
1
)
=
cd
-
ab
;
RMAT_ELMT
(
*
rm
,
2
,
2
)
=
a2_1
+
2
*
_d
*
_d
;
//@assert \at(q->qi, Pre) == q->qi;
//@assert \at(q->qx, Pre) == q->qx;
//@assert \at(q->qy, Pre) == q->qy;
//@assert \at(q->qz, Pre) == q->qz;
#endif
}
/** in place first order integration of a rotation matrix */
...
...
@@ -619,6 +646,15 @@ void float_quat_of_rmat(struct FloatQuat *q, struct FloatRMat *rm)
/*printf("m22 largest\n");*/
}
}
//@ assert \at(rm->m[0], Pre) == rm->m[0];
//@ assert \at(rm->m[1], Pre) == rm->m[1];
//@ assert \at(rm->m[2], Pre) == rm->m[2];
//@ assert \at(rm->m[3], Pre) == rm->m[3];
//@ assert \at(rm->m[4], Pre) == rm->m[4];
//@ assert \at(rm->m[5], Pre) == rm->m[5];
//@ assert \at(rm->m[6], Pre) == rm->m[6];
//@ assert \at(rm->m[7], Pre) == rm->m[7];
//@ assert \at(rm->m[8], Pre) == rm->m[8];
}
...
...
sw/airborne/math/pprz_algebra_float.h
View file @
0c0d1cd7
...
...
@@ -242,6 +242,8 @@ struct FloatRates {
while (_a < -M_PI) _a += (2.*M_PI); \
}
#include "pprz_algebra_float_convert_rmat_frama_c.h"
/*
* Returns the real part of the log of v in base of n
*/
...
...
@@ -598,9 +600,14 @@ extern void float_rmat_of_eulers_312(struct FloatRMat *rm, struct FloatEulers *e
/*@
requires valid_FloatRMat(rm);
requires rvalid_FloatQuat(q);
requires unary_quaterion(q);
requires \separated(rm, q);
ensures transpose(l_RMat_of_FloatRMat(rm)) == l_RMat_of_FloatQuat(q);
ensures rotation_matrix(l_RMat_of_FloatRMat(rm));
assigns *rm;
*/
extern
void
float_rmat_of_quat
(
struct
FloatRMat
*
rm
,
struct
FloatQuat
*
q
);
/** in place first order integration of a rotation matrix */
/*@
requires valid_FloatRMat(rm);
...
...
@@ -871,9 +878,13 @@ extern void float_quat_of_axis_angle(struct FloatQuat *q, const struct FloatVect
extern
void
float_quat_of_orientation_vect
(
struct
FloatQuat
*
q
,
const
struct
FloatVect3
*
ov
);
/// Quaternion from rotation matrix.
/*
@
/*
requires valid_FloatQuat(q);
requires rvalid_FloatRMat(rm);
requires rotation_matrix(l_RMat_of_FloatRMat(rm));
requires \separated(rm, q);
ensures unary_quaterion(q);
ensures transpose(l_RMat_of_FloatRMat(rm)) == l_RMat_of_FloatQuat(q);
assigns *q;
*/
extern
void
float_quat_of_rmat
(
struct
FloatQuat
*
q
,
struct
FloatRMat
*
rm
);
...
...
sw/airborne/math/pprz_algebra_float_frama_c.h
View file @
0c0d1cd7
#ifndef PPRZ_ALGEBRA_FLOAT_FRAM_C_H
#define PPRZ_ALGEBRA_FLOAT_FRAM_C_H
#ifndef PPRZ_ALGEBRA_FLOAT_FRAM
A
_C_H
#define PPRZ_ALGEBRA_FLOAT_FRAM
A
_C_H
#ifdef __cplusplus
extern
"C"
{
...
...
sw/airborne/output-frama-c-analysis.py
View file @
0c0d1cd7
...
...
@@ -36,7 +36,7 @@ if __name__ == '__main__':
proved_goals
,
nb_goals
=
get_result_from_file
(
output_file
)
if
(
proved_goals
!=
nb_goals
):
print
(
"Function {} in {} file not proved ({}/{})"
.
format
(
function_name
,
analysed_file
,
proved_goals
,
nb_goals
))
print
(
"
\033
[31;01m[File Not Proved]
\033
[00m
Function {} in {} file
is
not proved ({}/{})"
.
format
(
function_name
,
analysed_file
,
proved_goals
,
nb_goals
))
# Get previous result
f
=
open
(
res_file
,
"r"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment