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

Trying to publish to joint with python script

asked 2022-08-11 16:18:20 -0500

PGTKing gravatar image

updated 2022-08-12 06:17:21 -0500

ljaniec gravatar image

Here is my script

#!/usr/bin/env python3
import rospy
from std_msgs.msg import String


import rospy
from std_msgs.msg import Float64

def talker():
    pub = rospy.Publisher('/rx150/wrist_rotate_controller/command', Float64, queue_size=10)
    rospy.init_node('rx150_talker', anonymous=True)
    rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        position = -1.0
        rospy.loginfo(position)
        pub.publish(position)
        rate.sleep()

if __name__ == '__main__':
    try:
        talker()
    except rospy.ROSInterruptException:
        pass

When executing this script the gazebo simulated robot doesn't respond to the joint command I give.

The simulated robot however does respond to this command when I type it in the terminal:

rostopic pub -1 /rx150/wrist_angle_controller/command std_msgs/Float64 "data: -1.0"

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-08-12 06:20:21 -0500

ljaniec gravatar image

Your ROS node talker uses different topic than your terminal command, in node you have /rx150/wrist_rotate_controller/command and in the rostopic you have /rx150/wrist_angle_controller/command.

You can check if you are publishing everything correctly with rostopic echo.

edit flag offensive delete link more

Comments

1

Thank you, sometimes you overlook small mistakes. Appreciate it.

PGTKing gravatar image PGTKing  ( 2022-08-12 13:24:03 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-08-11 16:18:20 -0500

Seen: 112 times

Last updated: Aug 12 '22