Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #! /usr/bin/env python
  2.  
  3. """ A script for reading rosbag data. """
  4.  
  5. import rosbag
  6. import math
  7.  
  8. if __name__ == '__main__':
  9. bag = rosbag.Bag('b-zgrada-minimal.bag')
  10.  
  11. x_vel = [Pose.pose.pose.position.x for (topic, Pose, t) in bag.read_messages(topics=['/pioneer/pose'])]
  12.  
  13. y_vel = [Pose.pose.pose.position.y for (topic, Pose, t) in bag.read_messages(topics=['/pioneer/pose'])]
  14.  
  15.  
  16.  
  17. t = [t.to_time() for (topic, Pose, t) in bag.read_messages(topics=['/pioneer/pose'])]
  18.  
  19.  
  20. s = 0
  21.  
  22. for i in range(0, len(x_vel)):
  23. s=s + (pow((x_vel[i]-x_vel[i - 1]),2) + pow((y_vel[i] - y_vel[i - 1]),2))**(0.5)
  24. print s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement