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

rospy publisher behaving different from rostopic pub

asked 2015-09-12 00:35:29 -0500

ck28 gravatar image

updated 2015-09-12 01:03:46 -0500

Hi,

I am trying to control my kinova mico manipulator arm through ROS python. I observed that when I use:

rostopic pub - r 10 /mico_arm_driver/in/cartesian_velocity geometry_msgs/TwistStamped "{header: {seq: 0, stamp: {secs: 0, nsecs: 0}, frame_id: ''}, 
twist: {linear: {x: 0.0, y: 0.0, z: 0.1}, angular: {x: 0.0, y: 0.0, z: 0.0}}}"

my manipulator moves smoothly. But, when I try to implement the same thing as python function, the movement is not smooth.

My function:

def worker(self):
    carvel_pub = rosy.Publisher('/mico_arm_driver/in/cartesian_velocity', geometry_msgs.msg.TwistStamped, queue_size=10)
    rate = rospy.Rate(10)
    while not rosy.is_shutdown():
        carvel_pub.publish(self._carvel_msg)
        rate.sleep()

I am using ROS Hydro with Ubuntu 12.04. I have two subscribers. I have already tried changing queue_size to None to see if it is a slowdown problem caused due to multiple subscribers.

Any help is appreciated. Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-09-12 13:12:36 -0500

ahendrix gravatar image

It looks like your rospy publisher code isn't setting the z velocity at all, which means that it probably defaults to zero.

The fact that your robot moves at all suggests that there is another publisher which is sending a non-zero command.

Is it possible that you have two publishers that are sending conflicting commands?

edit flag offensive delete link more

Comments

I have another function that sets self._carvel_msg which is a global variable. Also, I have checked the value received at subscriber and it is as desired.

ck28 gravatar image ck28  ( 2015-09-12 16:41:33 -0500 )edit

Did you checked the publishing frequence in both cases with rostopic hz /name_of_topic?

destogl gravatar image destogl  ( 2015-09-13 08:54:02 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-09-12 00:35:29 -0500

Seen: 605 times

Last updated: Sep 12 '15