No me reconoce el paquete ROS creado por mi

Cuando quiero ejecutar un programa en Python que utiliza el paquete ROS que cree no me lo reconoce, segui todos los pasos del curso para crearlo bien(modificando el CMakeLists.txt, el package.xml, compilando). Ejecuto el comando rospack list y el paquete esta ahi entonces nose porque Python no me lo reconoce.

Hi @FranROS99

The possible reasons why your python executable file is not found:

  • You have to source:
source ~/catkin_ws/devel/setup.bash
  • You have to make your python file executable
chmod +x path/to/myFile.py

Sii hice todo lo que me decis, pero tampoco me reconoce el paquete creado por mi.

Hi @FranROS99,

I suppose you are using a rosject that you created. Is that right?
If so, could you share the rosject share link here and tell us the exact commands you issued?

If it is in a course, could you tell us in which Course and Unit you are?

El curso es el de ROS Basics in 5 days(python). Estoy en la unidad 6 en el cual vemos los servicios en ROS y voy por la última parte en el cual es el service_quiz. Cree un paquete llamado services_quiz con un mensaje de servicio dentro de ese paquete y un ejecutable para iniciar el servicio. Una vez hecho todo esto compilo y tipeo el comando source devel/setup.bash. Cuando termino de hacer eso ejecuto el ejecutable y no me reconoce el paquete creado por mi, la otra vez me paso lo mismo y la verdad nose como lo hize solucionar. Agradeceria mucho su ayuda.
El paquete que cree es este:
services_quiz /home/user/catkin_ws/src/services_quiz

Hi @FranROS99 ,

I think the problem may be because you compiled your package with catkin build, but it should have been compiled with catkin_make

A possible way of solving this, if this is the problem, is to remove the current devel and build folders, and recompile your catkin_workspace again.
Example:

# Removing the build and devel folders
cd ~/catkin_ws
rm build/ devel/ -rf

# Now, compile the workspace again
catkin_make

# Now, source devel/setup.bash so that ROS can find your pkg
source devel/setup.bash

# You should now be able to run your service. Example:
rosrun my_custom_srv_msg_pkg custom_service_server.py

# If you now list the services in another terminal, you should be able to see your "my_service"
rosservice list

# If your service is there, you can then call it with:
rosservice call /my_service "duration: 7"

If for any reason there are any errors in any of your CMakeLists.txt files, just fix the errors and compile the catkin_ws again with catkin_make.

Example of errors in CMakeLists.txt files. You may have:

add_message_file
   FILES
   age.msg
 )

instead of the correct one shown below, for example:

add_message_files(
   FILES
   age.msg
 )

Please let us know how things are going with your ROS Learning.

Muchas gracias!! Pude solucionar el error!!

1 Like