0
$\begingroup$

There is a problem of'Couldn't find executable named teleop_twist_keyboard.py'. Having examed the package,the package was installed correctly.I have tried to edit the CMakeLists.txt file,but the file is read only. enter image description here

enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. Source you environment source /opt/ros/melodic/setup.bash
  2. Try running without .py rosrun teleop_twist_keyboard teleop_twist_keyboard

It should work most probably else try running this: rospack list | grep teleop_twist_keyboard if you don't see anything its probably not installed properly.

UPDATE: The issue is with this command sudo ln -s /usr/bin/python3 /usr/bin/python, it creates a symlink between python and python3. But ROS melodic requires python2 not python 3. so you need to remove the symlink then install python 2 and create a symlink with python 2 and then run it again. I'll write the commands you need to follow.

  • sudo rm /usr/bin/python to remove the symlink from python to python 3
  • sudo apt install python2.7 check your /usr/bin/directory if python2 present skip to next step.
  • sudo ln -s /usr/bin/python2 /usr/bin/python creates symlink with python2
  • source /opt/ros/melodic/setup.bash source your ros env.
  • rosrun teleop_twist_keyboard teleop_twist_keyboard.py

EXTRA:

user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Waiting for subscriber to connect to /cmd_vel
^CGot shutdown request before subscribers connected
user:~$ sudo ln -s /usr/bin/python3 /usr/bin/python
ln: failed to create symbolic link '/usr/bin/python': File exists
user:~$ sudo rm /usr/bin/python
user:~$ sudo ln -s /usr/bin/python3 /usr/bin/python
user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
[rosrun] Couldn't find executable named teleop_twist_keyboard.py below /opt/ros/melodic/share/teleop_
twist_keyboard
user:~$ rospack list | grep teleop_twist_keyboard
teleop_twist_keyboard /opt/ros/melodic/share/teleop_twist_keyboard
user:~$ sudo rm /usr/bin/python
user:~$ sudo ln -s /usr/bin/python2 /usr/bin/python
user:~$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel 
$\endgroup$
3
  • $\begingroup$ Thank you for your answers! I followed the 2 steps you suggest. Unfortunately,I failed.Then I run the pack list order,it showed that "teleop_twist_keyboard /opt/ros/melodic/share/teleop_twist_keyboard".I cannot make head of it $\endgroup$
    – yz x
    Commented Feb 26 at 2:13
  • $\begingroup$ I have updated the answer try it. It should work now. $\endgroup$
    – nitish
    Commented Feb 26 at 5:37
  • $\begingroup$ Thank you for all your assistance!I really learned a lot! $\endgroup$
    – yz x
    Commented Feb 26 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.