no response when roslaunch with python package

asked 2017-09-19 01:33:19 -0500

gary gravatar image

Hi I am running Kinetic in Ubuntu 16.04LTS.

In terminal, I run rostopic, the robot response.

rostopic pub /movej_cmd std_msgs/Float32MultiArray "layout:


- label: ''
size: 0
stride: 0
data_offset: 0
data: [0.402883, 0.001026, 0.00034, 0.000103, 0.00051, 0.001082]"

But when I run roslaunch with the launch file below, robot does not response.

    <node name="talker" pkg="test" type="" output="screen" />

This is my python file.

#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32MultiArray
from std_msgs.msg import MultiArrayDimension

def talker():
    move = Float32MultiArray()
    move.layout.dim[0].label = ''
    move.layout.dim[0].size = 0
    move.layout.dim[0].stride = 0
    move.layout.data_offset = 0 = [0.402883,0.001026,0.000340,0.000103,0.000510,0.001082]
    pub = rospy.Publisher('talker', Float32MultiArray, queue_size=10)
    rospy.init_node('talker', anonymous=True)
    rate = rospy.Rate(1) # 1hz
    while not rospy.is_shutdown():
        #hello_str = "Write to robot\n%s\n" % move
    print move

if __name__ == '__main__':
    except rospy.ROSInterruptException:

Can anyone advise why I can run rostopic but it does not work with roslaunch?


edit retag flag offensive close merge delete


Topic is incorrect, replace with below:

pub = rospy.Publisher('movej_cmd', Float32MultiArray, queue_size=10)
gary gravatar image gary  ( 2017-09-21 11:31:38 -0500 )edit

@gary: you can edit your original question, no need to post again. Just click the edit link/button below the question text.

gvdhoorn gravatar image gvdhoorn  ( 2017-09-23 16:19:15 -0500 )edit

Check if your robot is listening (subscribed) to the topic movej_cmd with rostopic info /movej_cmd

Also, try to add / when instantiating the publisher, using /movej_cmd instead of movej_cmd.

Ruben Alves gravatar image Ruben Alves  ( 2017-09-29 15:42:17 -0500 )edit