I'm trying to figure out a way to timestamp log entries. I'm able to generate a client-side timestamp when each row in the log is written, but would much prefer to have the time when the sensor measurements were made. Is this something that I might be able to accomplish?
Thanks!
Timestamp log entries?
Timestamp log entries?
Crazyflie system identification (Master's thesis): https://github.com/andykee/uclathesis
Re: Timestamp log entries?
The log packets are time-stamped in the FW in milliseconds but currently this is not used in the cfclient so it shouldn't be to difficult to implement it.
Re: Timestamp log entries?
Do I need to add timestamp to the TOC? It seems like since it's always being written into the packet in the FW, I shouldn't need to, but when I print the contents of pk.data on the client, the timestamp isn't there.
Crazyflie system identification (Master's thesis): https://github.com/andykee/uclathesis
Re: Timestamp log entries?
In the later version of the cflib and the crazyflie firmware the timestamp (in ms) is sent together with each logging packet. The callbacks for all the logging has changed so now you get the data and a timestamp for each log packet.
Re: Timestamp log entries?
I still can't get this working. As far as I can tell, I should be able to access the timestamp as follows (see the gyroData method):
but the callback only seems to be sending 'data' and not 'timestamp' as well. I built and flashed the new FW. Where am I going wrong?
Code: Select all
# Callback called when the connection is established to the Crazyflie
def connected(linkURI):
gyroconf = LogConfig("Gyro", 10)
gyroconf.addVariable(LogVariable("gyro.x", "float"))
gyroconf.addVariable(LogVariable("gyro.y", "float"))
gyroconf.addVariable(LogVariable("gyro.z", "float"))
# crazyflie is an instance of the Crazyflie class that has been instantiated and connected
gyrolog = crazyflie.log.newLogPacket(gyroconf)
if (gyrolog != None):
gyrolog.data_received.addCallback(gyroData)
gyrolog.startLogging()
else:
print "gyro.x/y/z not found in log TOC"
def gyroData(data, timestamp):
print "Gyrodata: timestamp=%d x=%.2f, y=%.2f, z=%.2f" % (timestamp, data["gyro.x"], data["gyro.y"], data["gyro.z"])
Crazyflie system identification (Master's thesis): https://github.com/andykee/uclathesis
Re: Timestamp log entries?
You will also need the latest version of the cflib/cfclient that can be downloaded here otherwise the timestamp might be ignored.