-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug.py
44 lines (35 loc) · 1.43 KB
/
debug.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
import sys,time
from os import path,getenv
PPRZ_HOME = getenv("PAPARAZZI_HOME", path.normpath(path.join(path.dirname(path.abspath(__file__)), '../../../../')))
sys.path.append(PPRZ_HOME+ "/var/lib/python")
from pprzlink.ivy import IvyMessagesInterface
from pprzlink.message import PprzMessage
# Function called when a PING message is received
def recv_callback(ac_id, pprzMsg):
out = open("/home/finkensim/finken/paparazzi/sw/tools/ovgu_swarm/WP_Mover.debug","a")
# Print the message and the sender id
out.write("Received message %s from %s\n" % (pprzMsg,ac_id))
out.close()
def main():
# Creation of the ivy interface
ivy = IvyMessagesInterface(
agent_name="Debug_Move_WP", # Ivy agent name
start_ivy=False, # Do not start the ivy bus now
ivy_bus="127.255.255.255:2010") # address of the ivy bus
try:
# starts the ivy interface
ivy.start()
# Subscribe to PING messages and sets recv_callback as the callback function.
ivy.subscribe(recv_callback,PprzMessage("ground", "MOVE_WAYPOINT"))
# Wait untill terminated
while True:
time.sleep(10)
except:
ivy.shutdown()
if __name__=='__main__':
time.sleep(10)
out = open("/home/finkensim/finken/paparazzi/sw/tools/ovgu_swarm/WP_Mover.debug","w")
out.write("Start Debugger...\n")
out.close()
main()