Ask Your Question
0

no cyclical dependencies but finding bug

asked 2013-04-02 06:04:55 -0500

Rizqa gravatar image

updated 2013-04-05 02:55:04 -0500

Hi.. I try to rosrun a ROS node in terminal, but it does not work.. I get this error in my terminal.

RuntimeError: maximum recursion depth exceeded in cmp 
[INFO][WallTime: 1364916569.855552] Shutting down Tracker Node.

How fix the problem ? There is no cyclical dependencies in my package. I hope anyone will be able to help me.. Thanks..

Installed: ubuntu 11.10 x32 electric

This is the code :

#!/usr/bin/env python

import roslib; roslib.load_manifest('robocop')
import rospy

from sensor_msgs.msg import JointState
from robocop.msg import Skeleton

import PyKDL
import xml.dom.minidom

class tracksendi():

    def __init__(self):
        rospy.init_node('track_sendi')
        rospy.on_shutdown(self.shutdown)
        rospy.loginfo("Init..")

        rate = rospy.Rate(10)
        rospy.Subscriber('skeleton', Skeleton, self.update_skeleton)

        self.send_ke_servo_pub = rospy.Publisher('/servo_joints',JointState)

        self.send_ke_servo =self.get_joints()
        self.save_send_ke_servo = self.get_joints()

    def get_joints(self):
        """ This function is taken from the joint_state_publisher package written by David Lu!!
            http://www.ros.org/wiki/joint_state_publisher
        """
        description = rospy.get_param("robot_description")
        robot = xml.dom.minidom.parseString(description).getElementsByTagName('robot')[0]
        self.free_joints = {}
        self.joint_list = [] # for maintaining the original order of the joints
        self.dependent_joints = rospy.get_param("dependent_joints", {})

        # Find all non-fixed joints.

        for child in robot.childNodes:
                if child.nodeType is child.TEXT_NODE:
                   continue
                if child.localName == 'joint':
                    jtype = child.getAttribute('type')
                    if jtype == 'fixed':
                        continue
                    name = child.getAttribute('name')
                    if jtype == 'continuous':
                        minval = -pi
                        maxval = pi
                    else:
                        limit = child.getElementsByTagName('limit')[0]
                        minval = float(limit.getAttribute('lower'))
                        maxval = float(limit.getAttribute('upper'))

                    if name in self.dependent_joints:
                        continue
                    if minval > 0 or maxval < 0:
                        zeroval = (maxval + minval)/2
                    else:
                         zeroval = 0

                    joint = {'min':minval, 'max':maxval, 'zero':zeroval, 'value':zeroval }
                    self.free_joints[name] = joint
                    self.joint_list.append(name)

        joint_state = JointState()
        joint_state.header.stamp = rospy.Time.now()

            # Add Free Joints.
            for (name, joint) in self.free_joints.items():
                joint_state.name.append(str(name))
                joint_state.position.append(joint['value'])
                joint_state.velocity.append(0)


        while not rospy.is_shutdown():

              self.get_joints()
              self.send_ke_servo_pub.publish(self.kirim_ke_servo)
              self.send_ke_servo.header.stamp = rospy.Time.now()
              self.save_send_ke_servo = self.kirim_ke_servo

    def joint_state_handler(self, msg):
            for joint in msg.name:  
                self.kirim_ke_urdf = msg

    def shutdown(self):
            rospy.loginfo('Shutting down Tracker Node.')


if __name__ == '__main__':
    try:
        tracksendi()
    except rospy.ROSInterruptException:
        pass
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-04-05 06:54:26 -0500

A couple of obvious problems, in __init__ you call self.get_joints() twice, but it never returns anything (gets stuck in the while loop). You define self.update_skeleton as the callback for your subscriber to the skeleton topic, but there is no update_skeleton function.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-02 06:04:55 -0500

Seen: 94 times

Last updated: Apr 05 '13