Small update to the circular formation script (#2046)

* sigmas are in degrees now. We print all the errors correctly for logging purposes. The conversion to floats from the gvf msg has been changed since it complained for some machines.

* example added

* do not forcing a particular path

* cleaner demo flight plan. Now it also includes the gvf module

* correct usage msg

* [GVF] Example for the wiki and README
This commit is contained in:
Hector Garcia de Marina
2017-03-24 13:19:45 +01:00
committed by Gautier Hattenberger
parent cdf9b2247e
commit b9e71e9fa4
7 changed files with 27 additions and 11 deletions
+9
View File
@@ -0,0 +1,9 @@
For details about how to employ the python scripts check the wiki entry
https://wiki.paparazziuav.org/wiki/Module/guidance_vector_field
gvfApp draws an aircraft following the guidance vector vield, ex:
python gvfApp 80 , draws for the aircraft with id 80.
gvfFormation control several aircraft in a circular formation, ex:
python gvfFormation ./formation/topology.txt ./formation/sigmas.txt
./formation/ids.txt 80 10
@@ -0,0 +1 @@
14 56 34
@@ -0,0 +1 @@
0 90
@@ -0,0 +1,3 @@
1 0
-1 1
0 -1
+1 -1
View File
@@ -18,7 +18,7 @@ class MessagesApp(wx.App):
def main():
if len(sys.argv) != 2:
print "Usage: gvfFormationApp id_aircraft"
print "Usage: gvfApp id_aircraft"
return
id_ac = int(sys.argv[1])
application = MessagesApp(0, id_ac)
+7 -7
View File
@@ -42,11 +42,11 @@ def message_recv(ac_id, msg):
if msg.name == 'GVF':
if int(msg.get_field(1)) == 1:
param = [float(x) for x in msg.get_field(3).split(',')]
ac.XYc[0] = param[0]
ac.XYc[1] = param[1]
ac.a = param[2]
ac.b = param[3]
param = msg.get_field(3).split(',')
ac.XYc[0] = float(param[0])
ac.XYc[1] = float(param[1])
ac.a = float(param[2])
ac.b = float(param[3])
if msg.name == 'BAT':
ac.time = float(msg.get_field(3))
@@ -86,7 +86,7 @@ def formation(B, ds, radius, k):
u = -k*B.dot(error_sigma)
print list_aircraft[0].time, " ", error_sigma[0], " ", error_sigma[1]
print list_aircraft[0].time, " ", str(error_sigma*180.0/np.pi).replace('[','').replace(']','')
i = 0
for ac in list_aircraft:
@@ -112,7 +112,7 @@ def main():
return
B = np.loadtxt(sys.argv[1])
desired_sigmas = np.loadtxt(sys.argv[2])
desired_sigmas = np.loadtxt(sys.argv[2])*np.pi/180.0
ids = np.loadtxt(sys.argv[3])
radius = float(sys.argv[4])
k = float(sys.argv[5])