Differential Drive Quick Question

Hello All,

First of all, thanks for the provided source code, my physical robot works perfectly. But I am still concerned about one issue: When I use the teleop keyboard to control the robot, say, moving forward by having my finger staying on “i” key, what happened is that the robot keeps moving forward forever even though I removed my finger from the “i” key. I have to hit other key to stop the robot. From what I remembered in the gazebo simulation, if we use the keyboard to control a robot, the robot will move if we keep our finger on the key and it will stop if we remove our finger from the key immediately. I wonder how can we achieve this for an actual robot? Thanks!

Hi,

Sorry for the late reply. So that feature is mandatory in all robots that want to be around people and safe.
Its implementing a dead-mans switch essentially. You could create a rostopic subscriber to lets say the topic /raw_cmd_vel. In that topic the teleop should publish.
Then in this topic subscriber you implement in the callback a frequency counter or loop. If no callback is received after lest say 0.1 seconds, this subscriber will publish zero message to the real topic /cmd_vel.
Its a very basic program but would implement the solution you are looking for.