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

"Have you called init_node()?"

asked 2012-04-12 02:15:43 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

hi everyone, when I'm trying to do the tutorial in http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28python%29 , I have a problem when I try to execute

rosrun beginner_tutorials talker.py

The error message is :

luigi@luigi-pc:~/ros_workspace/beginner_tutorials$ rosrun beginner_tutorials talker.py
Traceback (most recent call last):
  File "/home/luigi/ros_workspace/beginner_tutorials/nodes/talker.py", line 11, in <module>
    str = "hello world %s"%rospy.get_time()
  File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/rostime.py", line 222, in get_time
    return Time.now().to_sec()
  File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/rostime.py", line 150, in now
    raise rospy.exceptions.ROSInitException("time is not initialized. Have you called init_node()?")
rospy.exceptions.ROSInitException: time is not initialized. Have you called init_node()?

Anyone Can help me??

Thank you in advance

Luigi

edit retag flag offensive close merge delete

Comments

1

Can you please post your python code? It at least differs somehow since the error comes in line 11 and not in line 9 which should be the str = ... line when you directly copy-pasted the code from the tutorial.

Lorenz gravatar image Lorenz  ( 2012-04-12 05:48:44 -0500 )edit

yes Lorenz, here it is :

palmlster gravatar image palmlster  ( 2012-04-13 02:17:15 -0500 )edit

in that page you can find the used code :)

palmlster gravatar image palmlster  ( 2012-04-13 02:24:49 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-05-14 20:59:31 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

You need to indent the while loop so that it becomes part of the function talker. Right now, the while loop is getting executed, and talker is never called.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-04-12 02:15:43 -0500

Seen: 3,487 times

Last updated: May 14 '12