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

Teleop works for turtlebot but publishing to /cmd_vel does not for turtle bot

asked 2020-04-13 13:37:47 -0600

Hulkthehunter gravatar image

updated 2020-04-13 13:42:28 -0600

When I am running roslaunch turtlebot_teleop keyboard_teleop.launch it works just fine. But when I try to publish to /cmd_vel node with rostopic pub /cmd_vel geometry_msgs/Twist '[1.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]' it doesn't do anything. What am I doing wrong?

Edit 1 : I also tried rostopic pub /cmd_vel_mux/input/navi geometry_msgs/Twist '{linear: {x: 10, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-04-13 14:56:36 -0600

updated 2020-04-14 11:02:01 -0600

The topic name has been remapped from turtlebot_teleop_keyboard/cmd_vel to cmd_vel_mux/input/teleop. See keyboard_teleop.launch. So try /cmd_vel_mux/input/teleop instead of /cmd_vel.


Edit:
Since you’ve asked another question- #q349325 and you've referred to this tutorial, I assume you are also referring to that link here.

Have you terminated your keyboard_teleop.launch before running

rostopic pub /cmd_vel_mux/input/navi geometry_msgs/Twist '{linear: {x: 10, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'

A very possible reason that your turtlebot did not move is your teleop command (/cmd_vel_mux/input/teleop) published by node turtlebot_teleop_keyboard overwrote your navi stack’s command (/cmd_vel_mux/input/navi). Kobuki's control system uses cmd_vel_mux to manage multiple incoming velocity commands and to determine which input is going to be prioritized according to a YAML file- mux.yaml (in this case):

subscribers:
  - name:        "Safe reactive controller"
    topic:       "input/safety_controller"
    timeout:     0.2
    priority:    10
  - name:        "Teleoperation"
    topic:       "input/teleop"
    timeout:     1.0
    priority:    7
  - name:        "Switch"
    topic:       "input/switch"
    timeout:     1.0
    priority:    6
  - name:        "Navigation"
    topic:       "input/navi"
    timeout:     1.0
    priority:    5

As you can see, the topic input/navi has lower priority than input/teleop. Therefore, you either terminate thekeyboard_teleop.launch and then use one among these four topics, or publish velocity command only to/cmd_vel_mux/input/safety_controller or /cmd_vel_mux/input/teleop to control your turtlebot while running turtlebot_teleop_keyboard node. For more information about control system of Kobuki/Turtlebot2, please see kobuki/Tutorials/Kobuki's Control System.

In fact, if you only have velocity commands from one source, you don’t really need cmd_vel_mux to multiplex your velocity commands. You can publish velocity-command messages directly to /mobile_base/commands/velocity which is the topic gazebo node receives/subscribes.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-04-13 13:37:47 -0600

Seen: 1,838 times

Last updated: Apr 14 '20