ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Quang Le's profile - activity

2020-12-30 10:18:18 -0500 received badge  Taxonomist
2019-05-20 02:31:46 -0500 marked best answer ROSSerializationException while publishing TFMessage

Hi everyone,

When I'm trying to publish tf2_msgs/TFMessage message, I got the following error:

0.966600119221
0.967081379774
0.968426689557
0.968817018408 
0.970126572275
0.970582148198
0.971705996452
0.972002006677
Traceback (most recent call last):
File "laser_scan.py", line 103, in <module>
  Laser_reading()
File "laser_scan.py", line 35, in __init__
  self.lc_tf.handle() 
File "laser_scan.py", line 93, in tf_handler
  self.tf_pub.publish(tf_msg)
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 856, in publish
raise ROSSerializationException(str(e))
rospy.exceptions.ROSSerializationException: field transforms must be a list or tuple type

It seems that my node can run for a while (I tried to print some field of the messages as you guys can see above), then suddenly get this error. The message is generated by my script below:

tf_msg = TFMessage()
tf_msg.transforms = TransformStamped()

tf_msg.transforms.header = Header()
tf_msg.transforms.header.stamp.secs =  float(msg.utime)/1e6
tf_msg.transforms.header.frame_id = "camera"

tf_msg.transforms.child_frame_id = "base_laser"
tf_msg.transforms.transform = Transform()

tf_msg.transforms.transform.translation = Vector3()
tf_msg.transforms.transform.translation.x = msg.trans[0]
tf_msg.transforms.transform.translation.y = msg.trans[1]
tf_msg.transforms.transform.translation.z = msg.trans[2]

tf_msg.transforms.transform.rotation = Quaternion()
tf_msg.transforms.transform.rotation.x = msg.quat[0]
tf_msg.transforms.transform.rotation.y = msg.quat[1]
tf_msg.transforms.transform.rotation.z = msg.quat[2]
tf_msg.transforms.transform.rotation.w = msg.quat[3]
print msg.quat[3]

Does anybody have a idea about this? and how can I do to fix this?

2019-04-09 05:50:01 -0500 received badge  Famous Question (source)
2018-12-03 04:10:10 -0500 received badge  Famous Question (source)
2018-02-27 13:14:23 -0500 received badge  Popular Question (source)
2018-02-27 13:14:23 -0500 received badge  Notable Question (source)
2017-10-28 08:11:24 -0500 received badge  Notable Question (source)
2017-08-06 06:36:20 -0500 received badge  Popular Question (source)
2017-08-03 01:05:38 -0500 asked a question Error when add executable .cpp script

Error when add executable .cpp script Hi everyone, When I'm trying to add executable node from my .cpp scrpit, i got th

2017-08-02 00:00:29 -0500 asked a question ROSSerializationException while publishing TFMessage

ROSSerializationException while publishing TFMessage Hi everyone, When I'm trying to publish tf2_msgs/TFMessage message