Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$ rosrun roboteleop bismillah_code2.py

[INFO] [WallTime: 1364840883.883536] Inisialisasi Parameter Sendi..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker_Sendi Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$ rosrun roboteleop bismillah_code2.py

[INFO] [WallTime: 1364840883.883536] Inisialisasi Parameter Sendi..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker_Sendi Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
    self.skeleton_user['confidence'] = dict()
    self.skeleton_user['position'] = dict()
    self.skeleton_user['orientation'] = dict()

    self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
    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 take from the joint_state_publisher package written by David Lu!!
        See 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)

        return joint_state

    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 update_skeleton(self, msg):
        for joint in msg.name:  
            self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]
            self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)
            self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

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

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

if __name__ == '__main__':

try:

    tracksendi()

except rospy.ROSInterruptException:

    pass

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$ rosrun roboteleop bismillah_code2.py

[INFO] [WallTime: 1364840883.883536] Inisialisasi Parameter Sendi..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker_Sendi Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

This is the source code :

!/usr/bin/env python

#!/usr/bin/env python

import roslib; roslib.load_manifest('robocop')

roslib.load_manifest('robocop') import rospy

rospy from sensor_msgs.msg import JointState

JointState from robocop.msg import Skeleton

Skeleton import PyKDL

PyKDL import xml.dom.minidom

xml.dom.minidom class tracksendi():

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.skeleton_user = dict()
     self.skeleton_user['confidence'] = dict()
     self.skeleton_user['position'] = dict()
     self.skeleton_user['orientation'] = dict()

     self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
     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 take from the joint_state_publisher package written by David Lu!!
         See 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)

         return joint_state

     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 update_skeleton(self, msg):
         for joint in msg.name:  
             self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]
             self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)
             self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

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

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

if __name__ == '__main__':

'__main__':

    try:

     tracksendi()

 except rospy.ROSInterruptException:

     pass

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$ rosrun roboteleop bismillah_code2.py

[INFO] [WallTime: 1364840883.883536] Inisialisasi Parameter Sendi..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker_Sendi Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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 take from the joint_state_publisher package written by David Lu!!
            See 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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  
                 self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]
                 self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)
                 self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

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

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



if __name__ == '__main__':

    try:

        tracksendi()

    except rospy.ROSInterruptException:

        pass

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$ rizqa@ubuntu:~/ROS_Workspace/roboteleop/bin$ rosrun roboteleop bismillah_code2.pyrobocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Inisialisasi Parameter Sendi..Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker_Sendi Tracker Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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 take from the joint_state_publisher package written by David Lu!!
            See 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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

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

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



if __name__ == '__main__':

    try:

        tracksendi()

    except rospy.ROSInterruptException:

        pass

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/ROS_Workspace/roboteleop/bin$ rosrun robocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker Node.

rizqa@ubuntu:~/BISMILLAH_TUGAS_AKHIR/roboteleop/bin$

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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 take taken from the joint_state_publisher package written by David Lu!!
            See 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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

    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

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/ROS_Workspace/roboteleop/bin$ rosrun robocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker Node.

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

    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

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/ROS_Workspace/roboteleop/bin$ rizqa@ubuntu:~/ROS_Workspace/robocop/bin$ rosrun robocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker Node.

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

    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

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/ROS_Workspace/robocop/bin$ rosrun robocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker Node.

How that problem solved ????? -___-

This is the source 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.skeleton_user = dict()
        self.skeleton_user['confidence'] = dict()
        self.skeleton_user['position'] = dict()
        self.skeleton_user['orientation'] = dict()

        self.send_ke_urdf = rospy.Publisher('/joint_state',JointState)
        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)

            return joint_state

        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 update_skeleton(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

    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

confuse with rosrun

I try to rosrun a node in terminal.. nothing error.. but the node does not work..

rizqa@ubuntu:~/ROS_Workspace/robocop/bin$ rosrun robocop robocop_code2.py

[INFO] [WallTime: 1364840883.883536] Init..

[INFO] [WallTime: 1364840883.919665] Shutting down Tracker Node.

How that problem solved ????? -___-

This is the source 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)

            return joint_state

        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 update_skeleton(self, joint_state_handler(self, msg):
            for joint in msg.name:  

                self.skeleton_user['confidence'][joint] = msg.confidence[msg.name.index(joint)]

                self.skeleton_user['position'][joint] = PyKDL.Vector(msg.position[msg.name.index(joint)].x, msg.position[msg.name.index(joint)].y, msg.position[msg.name.index(joint)].z)

                self.skeleton_user['orientation'][joint] = PyKDL.Rotation.Quaternion(msg.orientation[msg.name.index(joint)].x, msg.orientation[msg.name.index(joint)].y, msg.orientation[msg.name.index(joint)].z, msg.orientation[msg.name.index(joint)].w)

    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