Commit 254bf114 authored by stanlew's avatar stanlew
Browse files

adding decode_log.py

parent c70be89d
import sys
import numpy as np
import matplotlib.pyplot as plt
sys.path.append("lcmtypes")
import lcm
from lcmtypes import odometry_t
if len(sys.argv) < 2:
sys.stderr.write("usage: decode_log.py <logfile>")
sys.exit(1)
log = lcm.EventLog(sys.argv[1],"r")
data = np.empty((0,4), dtype=float)
init = 0
for event in log:
if event.channel == "ODOMETRY":
msg = odometry_t.decode(event.data)
if init==0:
start_utime = msg.utime
init = 1
data = np.append(data, np.array([[ \
(msg.utime-start_utime)/1.0E6, \
msg.x, \
msg.y, \
msg.theta
]]), axis=0)
plt.plot(data[:,1], data[:,2], 'r')
plt.show()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment