X-Git-Url: https://defiant.homedns.org/gitweb/?p=ros_wild_thumper.git;a=blobdiff_plain;f=scripts%2Fget_velocity.py;fp=scripts%2Fget_velocity.py;h=4f8a77e0d21c7fe1d9bd0cd94a9ad2e322407335;hp=0000000000000000000000000000000000000000;hb=9600299d1815cb14a3f49c72c4266adc1f471bcb;hpb=ae5417e92e700c1e4e75d5c187b6712df03ecf5b diff --git a/scripts/get_velocity.py b/scripts/get_velocity.py new file mode 100755 index 0000000..4f8a77e --- /dev/null +++ b/scripts/get_velocity.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-15 -*- +# +# rostopic echo /odom/twist/twist/linear/x > /tmp/velocity.txt + +import sys +import numpy as np + +f = open(sys.argv[1]) +l = [] +for line in f: + if "---" in line: + continue + l.append(float(line)) + +print "avg=%.2f, var=%f" % (sum(l)/len(l), np.var(l))