Convert carmen log file into rosbag with rosbag api problem
Hi, i'm trying to convert a carmen log file in a rosbag file. for the moment i just tried to port the odometry information with are defined in the carmen file as: ODOM x y theta tv rv accel
the problem is that when i try to write on the bag file it gives me this error:
Traceback (most recent call last):
File "con.py", line 31, in <module>
bag.write("tf",mes)
File "/opt/ros/groovy/lib/python2.7/dist-packages/rosbag/bag.py", line 375, in write
msg.serialize(self._buffer)
File "/opt/ros/groovy/lib/python2.7/dist-packages/geometry_msgs/msg/_TransformStamped.py", line 126, in serialize
except struct.error as se: self._check_types(se)
File "/opt/ros/groovy/lib/python2.7/dist-packages/genpy/message.py", line 313, in _check_types
raise SerializationError(str(exc))
genpy.message.SerializationError: required argument is not a float
i think my message is well formatted according to api message format.
this is the script that i'm using
import rosbag,rospy
from std_msgs.msg import Int32, String,Header,Float64,Time,UInt8
from geometry_msgs.msg import TransformStamped,Transform,Vector3,Quaternion
rospy.init_node("time")
def odomlist(l,od_id):
header = Header()
#header.seq = od_id
header.frame_id = "od"
header.stamp = rospy.get_rostime()
vector=Vector3(Float64(l[1]),Float64(l[2]),Float64(0.0))
quat=Quaternion(Float64(l[3]),Float64(l[4]),Float64(l[5]),Float64(l[6]))
tr=Transform(vector,quat)
return (TransformStamped(header,"las",tr))
od_id=UInt8()
od_id.data=0
inp=open("carmen.clf","r")
inp=inp.readlines()
bag = rosbag.Bag('bag.bag','w')
for lines in inp:
l=lines.split(" ")
if l[0]=="ODOM":
print (l)
od_id.data+=1
mes=odomlist(l,od_id)
print str(mes)
bag.write("tf",mes)
bag.close()
can someone explain me why it gives me that error ? i'm not sure if this conversion can work or if there is a better way to do this so if someone have a better idea just tell me or point me to some tutoriol.