0
$\begingroup$

Rosanswers logo

I try to send odom message: The code is, but it gives me an error:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
File "/opt/ros/indigo/lib/python2.7/dist-packages/tf/listener.py", line 237, in run
    self.last_update_ros_time = rospy.Time.now()   
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/rostime.py", line 155, in now
    return get_rostime()   
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/rostime.py", line 209, in get_rostime
    raise rospy.exceptions.ROSInitException("time is not initialized. Have you called init_node()?")
ROSInitException: time is not initialized. Have you called init_node()?

[INFO] [WallTime: 1436785911.264067]
Starting odom node Traceback (most recent call last):
   File "/home/robotics/Documents/ros/src/navigation_car/odom_sender.py", line 49, in <module>
    trans,rot = tf_listener.lookupTransform(odom_frame, base_frame, current_time )
tf.LookupException: "odom" passed to lookupTransform argument target_frame does not exist.

Tf-tree is normal, tf-echo odom base_link works properly

Edit 0:

Traceback (most recent call last):
File "/home/robotics/Documents/ros/src/navigation_car/odom_sender.py", line 51, in trans,rot = tf_listener.lookupTransform(odom_frame, base_frame, rospy.Time() ) tf.LookupException: "odom" passed to lookupTransform argument target_frame does not exist.

Edit 1: new error:

Traceback (most recent call last):
File "/home/robotics/Documents/ros/src/navigation_car/odom_sender.py", line 66, in odom_pub.publish(odom) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 843, in publish self.impl.publish(data) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 1027, in publish serialize_message(b, self.seq, message) File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/msg.py", line 152, in serialize_message msg.serialize(b) File "/opt/ros/indigo/lib/python2.7/dist-packages/nav_msgs/msg/_Odometry.py", line 167, in serialize buff.write(_struct_7d.pack(_x.pose.pose.position.x, _x.pose.pose.position.y, _x.pose.pose.position.z, _x.pose.pose.orientation.x, _x.pose.pose.orientation.y, _x.pose.pose.orientation.z, _x.pose.pose.orientation.w)) AttributeError: 'tuple' object has no attribute 'x'

Edit 2: All is well) This is code


Originally posted by flaminga on ROS Answers with karma: 5 on 2015-07-13

Post score: 0


Original comments

Comment by mgruhler on 2015-07-13:
please be more specific. This is not a question.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Well, there are two errors.

the one with init_node() is coming from your tf_listener() being a global variable. Put this one after the init_node() call, then it shoudl work.

I'm not sure about the other one. Does this still occur after having the tf_listener setup correctly?


Originally posted by mgruhler with karma: 12390 on 2015-07-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by flaminga on 2015-07-13:
i corrected the code. Now it give on error (see edit).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.