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

"time is not initialized. Have you called init_node()?" error: ROS & Baxter_interface

asked 2016-06-10 08:27:09 -0500

laurent gravatar image

I get this error whenever i run my code. the code itself is supposed to move my robot's arm in the given position. can anyone tell me what's wrong? why do i get this error when ive already called the rospy.init?

#!/usr/bin/env python
import rospy
import baxter_interface
from baxter_interface import Limb
import sys
import rospy
import numpy as np
import roslib

class arm_to_pos:

  def __init__(self):
    self.left_arm = Limb('left')

  def move_arm(self):
    self.left_arm.move_to_joint_positions(dict({'s0':0.0,'s1':-0.55,'e0':0.0,
        'e1':0.75,'w0':0.0,'w1':1.26,'w2':0.0}), timeout = 15.0)

def main():
  position = arm_to_pos()
  rospy.init_node('arm_to_pos', anonymous=True)
  position.move_arm()
  rospy.spin()

if __name__ == '__main__':
    main()
edit retag flag offensive close merge delete

Comments

Nevermind, fixed it. Had to initialize before assigning position to my class

laurent gravatar image laurent  ( 2016-06-10 10:42:55 -0500 )edit

Could you please explain to me how did you solve the problem cause I am having a similar one?

Abou-Hussein gravatar image Abou-Hussein  ( 2016-07-30 22:04:01 -0500 )edit

Place the rospy.init command before you assign you call your class. i.e. switch the order of the first two lines in the main function

laurent gravatar image laurent  ( 2016-07-30 22:58:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-03-07 19:25:52 -0500

KUMA gravatar image

def main(): position = arm_to_pos() rospy.init_node('arm_to_pos', anonymous=True) rospy.Time.now() #<<<<<<<<<<<<<<<<<< position.move_arm() rospy.spin()

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-06-10 08:27:09 -0500

Seen: 8,384 times

Last updated: Jun 10 '16