how do you send publish to specific joint using python3?

asked 2021-08-21 04:11:44 -0500

kak13 gravatar image

updated 2021-08-21 04:24:02 -0500

In my terminal, it looks like this:

bwuk@robots:~/my_robot/my_robot_description$ ros2 topic echo /joint_states 
header:
  stamp:
    sec: 1629536818
    nanosec: 633569535
  frame_id: ''
name:
- joint_rear_left_wheel
- joint_rear_right_wheel
- joint_front_right_wheel
- joint_front_left_wheel
- head_attach
- head_attach2
position:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
velocity: []
effort: []
---
header:
  stamp:
    sec: 1629536818
    nanosec: 656484369
  frame_id: ''
name:
- joint_rear_left_wheel
- joint_rear_right_wheel
- joint_front_right_wheel
- joint_front_left_wheel
- head_attach
- head_attach2
position:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
velocity: []
effort: []
---

As you can see that joint_states has 6 joints inside. How do I run each joint inside the /joint_states?

I wanted to send like, for example, 5 m/s velocity to joint_front_left_wheel only so it can move in gazebo/rviz2.

How do I do that in python3?

Keywords: Foxy ubuntu 20.04 ros2 python python3 publisher joint one wheel single

edit retag flag offensive close merge delete

Comments

I'm sorry to have to do this for something so seemingly unimportant, but please don't post screenshots of terminal text in question on ROS Answers. It's all text, so there is no need. Just copy-paste the text from the terminal into your question text. Do make sure to format it properly by selecting the text and pressing ctrl+k (or clicking the Preformatted Text button (the one with 101010 on it)).

You don't need to post a new question, just edit your curent one. You can use the edit button/link for this.

After you replace the screenshot with the error message itself, we can re-open your question.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-21 04:20:39 -0500 )edit

Understood! I will do it from now on. Thanks!

Fixed :D

kak13 gravatar image kak13  ( 2021-08-21 04:22:29 -0500 )edit