How could I use python script to control Joint controller

According to the ros with python course, I have learned how to use python to control the robot. At that time what I need is to publish a info to “/”, and than the robot can automatically move it thelf.
So I just according what I learned find a urdf on the Internet, and add the necessory “transmission” and “controller” even the python script.But when I rosrun the script,here just show me wait for serverice. What should I do now to use my python script to controll my robot.Finally I have to say, without online enviroment of you, there are always so many problem if I try it on my pc.

Here is a part of my python script, in a addition to the launch and controller of xacro Document I have already writted.I could use "rostopic pub -1 /uarm/joint2_position_controller/command std_msgs/Float64 “data: 1”
"to controll that.

Hi @weizhenyu1556,

you have to make sure you are publishing to the right topic, the one that the robot is subscribed to.

You can see all the topics with:

rostopic list

Knowing the topics, you can easily inspect then with:

rostopic info /topic_name

That would show you who are the publishers and subscribers of a given topic.

If you publish the messages and the robot doesn’t move, it’s very likely publishers and subscribers use different topics.

Please let us know the topic names, as well as who are the publishers and subscribers. That would make it easy to identify the issues.


This is the "rostopic list”result of joint controller.How could I modify my python script to control it.
And my urdf model is about uarm-pro, I have already writted all the transmission and controller.and they can also be controlled by "rostopic pub -1 /slideruarm/joints_position_controller/command std_msgs/Float64 “data: 0.3"” how could I use python to publish a current positon and target position to these controllers.I have find a example, but not work.

I firget to say what s the publisher and subscriber. I think the joint1_controller is the subscriber, and
geometry_msgs.msg as well as sensor_msgs.msg are the publisher.
Could you show me a example so that I can easy to understand how it works .Here is a part of my python script

Hi @weizhenyu1556,

in the first image I can see the topics are prefixed by /slideruarm and also the command you use to publish uses the topic /slideruarm/joints_position_controller/command, but the second image shows that the topic name does not contain slideruarm. You have to put the right topic names in your script.