[fc_rotor] fix include and use python3

This commit is contained in:
xp31
2020-09-01 16:19:06 +02:00
committed by Gautier Hattenberger
parent 06cb3e4d78
commit ba931c0315
4 changed files with 10 additions and 8 deletions
+2
View File
@@ -0,0 +1,2 @@
<program name="FC Rotorcraft" command="sw/ground_segment/python/multi/fc_rotor/fc_rotor.py"/>
@@ -20,7 +20,7 @@
*/ */
#include "math/pprz_algebra_float.h" #include "math/pprz_algebra_float.h"
#include "subsystems/abi.h" #include "subsystems/abi.h"
//#include "subsystems/datalink/datalink.h" // dl_buffer #include "subsystems/datalink/datalink.h"
#include "autopilot.h" #include "autopilot.h"
#include "modules/multi/fc_rotor/fc_rotor.h" #include "modules/multi/fc_rotor/fc_rotor.h"
#include "firmwares/rotorcraft/navigation.h" #include "firmwares/rotorcraft/navigation.h"
@@ -32,7 +32,7 @@ void fc_rotor_init(void)
void fc_read_msg(uint8_t *buf) void fc_read_msg(uint8_t *buf)
{ {
struct FloatVect3 u; struct FloatVect3 u;
uint8_t ac_id = DL_DESIRED_SETPOINT_ac_id(); uint8_t ac_id = DL_DESIRED_SETPOINT_ac_id(buf);
if (ac_id == AC_ID) { if (ac_id == AC_ID) {
// 0: 2D control, 1: 3D control // 0: 2D control, 1: 3D control
@@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# #
# Copyright (C) 2017 Hector Garcia de Marina <hgdemarina@gmail.com> # Copyright (C) 2017 Hector Garcia de Marina <hgdemarina@gmail.com>
# Gautier Hattenberger <gautier.hattenberger@enac.fr> # Gautier Hattenberger <gautier.hattenberger@enac.fr>
@@ -28,7 +28,7 @@ def make_Bd(B):
return Bd return Bd
def make_Zh(Z, m): def make_Zh(Z, m):
edges = Z.size/m edges = int(Z.size/m)
Zh = np.zeros(Z.size) Zh = np.zeros(Z.size)
for i in range(0, edges): for i in range(0, edges):
@@ -39,7 +39,7 @@ def make_Zh(Z, m):
return Zh return Zh
def make_Dz(Z, m): def make_Dz(Z, m):
edges = Z.size/m edges = int(Z.size/m)
Dz = np.zeros((Z.size, edges)) Dz = np.zeros((Z.size, edges))
j = 0 j = 0
@@ -51,7 +51,7 @@ def make_Dz(Z, m):
return Dz return Dz
def make_Dzt(Z, m, l): def make_Dzt(Z, m, l):
edges = Z.size/m edges = int(Z.size/m)
if l == 2: if l == 2:
return np.eye(edges) return np.eye(edges)
@@ -78,7 +78,7 @@ def make_Dztstar(d, m, l):
return np.diag(Ztstar) return np.diag(Ztstar)
def make_DPzh(Z, m): def make_DPzh(Z, m):
edges = Z.size/m edges = int(Z.size/m)
DPzh = np.zeros((2*edges, 2*edges)) DPzh = np.zeros((2*edges, 2*edges))
Zt = np.diag(make_Dzt(Z, m, 1)) Zt = np.diag(make_Dzt(Z, m, 1))
@@ -93,7 +93,7 @@ def make_DPzh(Z, m):
return DPzh return DPzh
def make_E(Z, d, m, l): def make_E(Z, d, m, l):
edges = Z.size/m edges = int(Z.size/m)
E = np.zeros(edges) E = np.zeros(edges)
if edges == 1: if edges == 1:
E[0] = la.norm(Z)**l - d**l E[0] = la.norm(Z)**l - d**l