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

ROS could not find the executable file

asked 2018-07-09 04:07:33 -0600

Rick gravatar image

Hi,
I made all the steps of the ROS tutorial that are described in the ROS Wiki (create a catkin workspace and a listener and talker node). Now I tried to Use the programme presented here: https://github.com/ros-teleop/teleop_... .
I copied the files into the src foldeer in my catkin workspace. This one includes now the folder with the named files and a folder "beginner_tutorials" with all the files of the tutorials. After using catkin_make and source devel/setup.bash, I started the node with "rosrun teleop_twist_keyboard teleop_twist_keyboard.py" but then ROS told me that "Couldn't find executable named teleop_twist_keyboard.py below ...".
I tried some other locations for the folder but nothing works. Could you give me an advice how to solve this Problem?

Regards,
Rick

edit retag flag offensive close merge delete

Comments

1

Please post the CMakeLIsts.txt and package.xml. Most probably you forgot to adapt this... (Edit your question and format the copied files, obviously removing any comments, with the preformatted text button 1010101).

mgruhler gravatar image mgruhler  ( 2018-07-09 04:45:07 -0600 )edit

Could you tell me how I have to do this? I did not changed anything.These both files are like in the example above.

Rick gravatar image Rick  ( 2018-07-09 06:03:17 -0600 )edit

What? Posting the CMakeLists.txt? Also include the output of tree -d <PATH/TO/YOUR/WORKSPACE>/src.

mgruhler gravatar image mgruhler  ( 2018-07-09 06:33:56 -0600 )edit

The CMakeLists in the project folder is like in the example above. I think that I don't need to paste it again. In the src folder is also a CMakeLists file. Should I include these lines in this one or in the file that is located in the project folder?

Rick gravatar image Rick  ( 2018-07-09 06:40:19 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-07-09 05:19:05 -0600

pavel92 gravatar image

updated 2018-07-09 05:19:51 -0600

Did you edit your CMakeLists.txt file to add it as an executable? You should have the following in your CMakeLists.txt:

catkin_install_python(PROGRAMS
   teleop_twist_keyboard.py
   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Also the suitable dependencies in package.xml
Look at both the CMakeLists.txt and package.xml files from the teleop package that you presented.

Also be more specific on how you added the teleop_twist_keyboard package. You said "I copied the files into the src foldeer in my catkin workspace". Did you clone/copy the whole package or just the files from it? The ROS structure is that you should have packages inside your catkin_ws/src . In your case you should have 2 packages there. One being beginner_tutorials and the other teleop_twist_keyboard. If this is the case, delete both devel and build folders, then do a catkin_make and source devel/setup.bash

edit flag offensive delete link more

Comments

Hi,the four lines (catkin_install...) are already in the CMakeLists file that is located in the folder where also the python-file is located. I downloaded the files and put them in a folder without changing any file of it. Could you tell me which lines I have to add to the files of the example?

Rick gravatar image Rick  ( 2018-07-09 05:53:43 -0600 )edit

The structure of the folders is like you already said. That's why I deleted the build and the devel folder and used catkin_make and source devel/setup.bash, but I get the same errors.

Rick gravatar image Rick  ( 2018-07-09 06:00:31 -0600 )edit

open a new terminal and try:

source /opt/ros/your_distribution/setup.bash

Replace the your_distribution with the ROS distribution that you are using (kinetic, indigo, jade or else) in the above command. Then source your catkin_ws/devel/setup.bash and try to run the teleop node

pavel92 gravatar image pavel92  ( 2018-07-09 07:01:30 -0600 )edit

Aslo, make sure the python script is executable (chmod +x teleop_twist_keyboard.py).

pavel92 gravatar image pavel92  ( 2018-07-09 07:08:06 -0600 )edit

This was the problem. Thanks!

Rick gravatar image Rick  ( 2018-07-09 07:11:42 -0600 )edit

can you please tell me command for making a cpp file to executable file as you said for python?

prabakaran gravatar image prabakaran  ( 2021-09-22 02:04:42 -0600 )edit
0

answered 2018-07-09 09:56:13 -0600

jayess gravatar image

updated 2018-07-09 10:01:53 -0600

Have you set your file to be executable? If not, run

chmod +x teleop_twist_keyboard.py

With C++ you need to compile to get an executable, for Python you need to run the above command to make the file executable. You don't need to use the CMakeLists.txt file just to run some nodes written in Python.

edit flag offensive delete link more

Comments

Note that it should be in somewhere in your package, such as in your src folder as an example for rosrun to find it.

jayess gravatar image jayess  ( 2018-07-09 09:57:54 -0600 )edit

Ok, this solved my problem. Thanks!

Rick gravatar image Rick  ( 2018-07-10 02:02:35 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-09 04:07:33 -0600

Seen: 3,707 times

Last updated: Jul 09 '18