paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] Reading messages in python from a replayed log


From: Hector Garcia de Marina
Subject: Re: [Paparazzi-devel] Reading messages in python from a replayed log
Date: Fri, 19 Aug 2016 13:54:35 +0200

I guess I have fixed it,

within ivy.py I have added (in blue) the following lines

if msg_class == "telemetry":
            try:
                sdata = data[0]
                if(sdata[0:6] == 'replay'):
                    ac_id = int(sdata[6:])
                else:
                    ac_id = int(sdata)
            except ValueError:
                print("ignoring message " + ivy_msg)
                sys.stdout.flush()
        else:
            ac_id = 0


before, if the guy received a telemetry msg from the replay agent, the id was "replayXXX", triggering the exception and no assigning any value to ac_id.
Now the agents based on python work during the replays.




On Fri, Aug 19, 2016 at 10:54 AM, Hector Garcia de Marina <address@hidden> wrote:
Hi guys,

I have the following problem and I do not know whether it has a straightforward solution.

I am replaying a log, everything looks find (GCS, messages, real time plot, etc). I also have
an agent written in python that works fine for simulation and real flights but not with replays.

In particular, it complains about:

Exception happened during processing of request from ('127.0.0.1', 50024)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 596, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
    self.handle()
  File "/usr/lib/python2.7/dist-packages/ivy/ivy.py", line 1268, in handle
    keep_connection_alive = self.process_ivymessage(msg, client)
  File "/usr/lib/python2.7/dist-packages/ivy/ivy.py", line 1334, in process_ivymessage
    self.server.handle_msg(client, num_id, *params)
  File "/usr/lib/python2.7/dist-packages/ivy/ivy.py", line 1088, in handle_msg
    return self._get_fct_for_subscription(int(idx))(client, *params)
  File "/home/noether/Workspace/paparazzi/sw/ext/pprzlink/lib/v1.0/python/pprzlink/ivy.py", line 95, in <lambda>
    bind_id = IvyBindMsg(lambda agent, *larg: self.parse_pprz_msg(callback, larg[0]), regex)
  File "/home/noether/Workspace/paparazzi/sw/ext/pprzlink/lib/v1.0/python/pprzlink/ivy.py", line 156, in parse_pprz_msg
    callback(ac_id, msg)
UnboundLocalError: local variable 'ac_id' referenced before assignment

This error is triggered by

self.interface.subscribe(self.message_recv)
--->  message_recv(self, ac_id, msg): 

The same error can be reproduced by replaying a log and trying to run the python versions of the agents Messages and RealTimePlot.

It seems it is related with the following? the aircraft now it is "replay3" instead of "3" by
inspecting the format of the messages?

replay3 ATTITUDE 0.68112 -2.240519 0.333095

instead of

3 ATTITUDE xxx xxx


Cheers!

--
Héctor




--

reply via email to

[Prev in Thread] Current Thread [Next in Thread]