state.py
Go to the documentation of this file.
00001 import numpy as np
00002 from generic import get_header_time
00003 from starmac_tools.timeseries import quaternion_to_eulerypr
00004 
00005 def process_state(bag, topic, output_var):
00006     """
00007     Process the state data in a given (nav_msgs/Odom) topic and place results in the
00008     north, east, up, {north,east,up}_vel, ori_quat and ori_ypr (yaw/pitch/roll) attributes
00009     of the provided output_var argument
00010     """
00011     output_var.t = get_header_time(bag, topic)
00012     output_var.north, output_var.east, output_var.up = \
00013         (mult*bag._data[topic+'/pose/pose/position/%s' % ax] for (ax, mult) in zip('xyz',(1.,1.,-1.)))
00014     output_var.north_vel, output_var.east_vel, output_var.up_vel = (bag._data[topic+'/twist/twist/linear/%s' % ax] for ax in 'xyz')
00015     output_var.ori_quat = np.array(tuple(bag._data[topic+'/pose/pose/orientation/%s' % ax] for ax in 'wxyz')).T
00016     output_var.ori_ypr = np.degrees(np.array(quaternion_to_eulerypr(output_var.ori_quat.T)).T)
00017     


starmac_tools
Author(s): bouffard
autogenerated on Sun Jan 5 2014 11:38:35