currently I do the extra tour in “ROS2 Basics Python Real Robot Project”
I kind of solved section one and worked on section two.
Now it looks like there is some error left when starting
ros2 launch wall_follower wall_follower.launch.py
it shows
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2022-11-27-14-03-25-912356-4_xterm-7002
[INFO] [launch]: Default logging verbosity is set to INFO[INFO] [wall_follower-1]: process started with pid [7063]
[wall_follower-1] Traceback (most recent call last):
[wall_follower-1] File "/home/user/ros2_ws/install/wall_follower/lib/wall_follower/wall_follower", line 33, in <
module>
[wall_follower-1] sys.exit(load_entry_point('wall-follower==0.0.0', 'console_scripts', 'wall_follower')())
[wall_follower-1] File "/home/user/ros2_ws/install/wall_follower/lib/wall_follower/wall_follower", line 25, in importlib_load_entry_point
[wall_follower-1] return next(matches).load()
[wall_follower-1] File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
[wall_follower-1] module = import_module(match.group('module'))
[wall_follower-1] AttributeError: 'NoneType' object has no attribute 'group'
[ERROR] [wall_follower-1]: process has died [pid 7063, exit code 1, cmd '/home/user/ros2_ws/install/wall_follower/
lib/wall_follower/wall_follower --ros-args'].
not sure why it should not work again. Any hint how to isolate the problem ?
I think you need to check your setup.py file again. The error says that your entry points is a ‘NoneType’, basically indicating that your entry points list is empty.
I hope this tip helps you fix your issue.
In case, this does not fix your issue, then:
Post your package folder structure with filenames visible - a screenshot from your IDE left panel.
Post the contents of your package’s setup.py file as a code-block.
I have checked that and it looked ok. But than to make sure I have removed build and install folder and restarted the whole build again.
It looks actually that the wall_follower_srv which just contains the message for the wall_finder service contains the break. it was created with ros2 pkg create --build-type ament_cmake and looks like that
Just by looking at your folder structure and the file contents that you included in your post, I understood the following:
Your FindWall.srv service message file is correct.
You do not have to create a package specifically for srv message - because you will be creating a custom action message in Part 3 and you can keep both the custom messages (service and action) as one single ament_cmake package. If you make separate packages you must make sure that you include these packages in your main package’s dependencies.
You have not added rosidl_default_generators as a dependency of your wall_follower_srv package.
You must rebuild your wall_follower_srv package after adding rosidl dependencies to your package.xml file and CMakeLists.txt file.
In your CMakeLists.txt file you must also add the rosidl_generate_interfaces() block to identify tour custom message during colcon build.
Since you have not posted the setup.py file that I wanted to see, I am assuming that you have it correct.
So, do these modifications and try running your program. If anything still fails, let me know!
Starting >>> wall_follower_srv
--- output: wall_follower_srv
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ament_cmake: 0.9.9 (/opt/ros/foxy/share/ament_cmake/cmake)
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Found rclcpp: 2.4.0 (/opt/ros/foxy/share/rclcpp/cmake)
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Found rosidl_adapter: 1.2.1 (/opt/ros/foxy/share/rosidl_adapter/cmake)
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
-- Found FastRTPS: /opt/ros/foxy/include
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found rmw_implementation_cmake: 1.0.3 (/opt/ros/foxy/share/rmw_implementation_cmake/cmake)
-- Using RMW implementation 'rmw_fastrtps_cpp' as default
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found rosidl_default_generators: 1.0.1 (/opt/ros/foxy/share/rosidl_default_generators/cmake)
-- Found ament_lint_auto: 0.9.6 (/opt/ros/foxy/share/ament_lint_auto/cmake)
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.10")
-- Configuring incomplete, errors occurred!
See also "/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeOutput.log".
See also "/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeError.log".
---
Failed <<< wall_follower_srv [3.71s, exited with code 1]
Summary: 0 packages finished [3.96s]
1 package failed: wall_follower_srv
here the content of /home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeError.log
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_e6f68/fast && /usr/bin/make -f CMakeFiles/cmTC_e6f68.dir/build.makeCMakeFiles/cmTC_e6f68.dir/build
make[1]: Entering directory '/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e6f68.dir/src.c.o
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_e6f68.dir/src.c.o -c /home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_e6f68
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e6f68.dir/link.txt --verbose=1
/usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD CMakeFiles/cmTC_e6f68.dir/src.c.o -o cmTC_e6f68
/usr/bin/ld: CMakeFiles/cmTC_e6f68.dir/src.c.o: in function `main':
src.c:(.text+0x46): undefined reference to `pthread_create'
/usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
/usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_e6f68.dir/build.make:87: cmTC_e6f68] Error 1
make[1]: Leaving directory '/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_e6f68/fast] Error 2
Source file was:
#include <pthread.h>
void* test_func(void* data)
{
return data;
}
int main(void)
{
pthread_t thread;
pthread_create(&thread, NULL, test_func, NULL);
pthread_detach(thread);
pthread_join(thread, NULL);
pthread_atfork(NULL, NULL, NULL);
pthread_exit(NULL);
return 0;
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_c9b8b/fast && /usr/bin/make -f CMakeFiles/cmTC_c9b8b.dir/build.makeCMakeFiles/cmTC_c9b8b.dir/build
make[1]: Entering directory '/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c9b8b.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_c9b8b.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
Linking C executable cmTC_c9b8b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c9b8b.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_c9b8b.dir/CheckFunctionExists.c.o -o cmTC_c9b8b -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_c9b8b.dir/build.make:87: cmTC_c9b8b] Error 1
make[1]: Leaving directory '/home/user/ros2_ws/build/wall_follower_srv/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_c9b8b/fast] Error 2
This is what I did but the output said that all packages are up-to-date. Perhaps something will work for you.
Otherwise, you just have to wait for two days and it will be fine.
I would like The Construct team to check on this issue please! (In case you have been reading this post!)
Cheers,
Girish
EDIT:
You could also try this: (you may need sudo) python3 -m pip install -U setuptools wheel cmake distutils
Unpacking ros-noetic-gazebo-ros (2.9.2-1focal.20221014.230203) over (2.9.2-1focal.20210727.073131) ...
dpkg: error processing archive /var/cache/apt/archives/ros-noetic-gazebo-ros_2.9.2-1focal.20221014.230203_amd64.deb (--unpack):
unable to make backup link of './opt/ros/noetic/lib/gazebo_ros/gzserver' before installing new version: Invalid cross-device link
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/ros-noetic-gazebo-ros_2.9.2-1focal.20221014.230203_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
yes that would be a solution thought.
However I will give the friends from theconstruct a chance to analyse the problem.
I do another course in parallel and will see in a few day’s where I am with this.
So, when someone copy-pastes the message file contents from the jupyter notebook into their package’s FindWall.srv file, this problem happens!
The bad thing here is that the online IDE does not show any hidden non-ASCII characters present in the file.
This causes the problem during compilation / building.
THE FIX:
Simply remove / delete the unwanted character from the service message. @ralves and @albertoezquerro : Also, please delete this on the jupyter notebook, so new students will not have the same issue!
Sorry for the long post (picture is worth a thousand words!)
Thanks a lot for the research !
Unfortunatetly this is not the root cause in my case thought.
I have checked with cat -T to make sure the FindWall.srv does not contain any hidden characters.
However with your python iteration it shows
checked and Gris is right the hidden character was one issue !
However still the launch is having an issue. I’ll investigate later. But maybe Alberto has more insights ?
If you have the service message package successfully compiled and you still have issues with your package launch, maybe I can still help you out.
Just post the new error (as text) that your are facing.
– Girish
EDIT: I checked the outputs of cat .... Only cat -A works correctly. cat -T only shows tab characters.
The outputs look very weird, that is why I chose to use python.
launch.substitutions.substitution_failure.SubstitutionFailure: executable 'wall_following' not found on the libexec directory '/home/user/ros2_ws/install/wall_follower/lib/wall_follower'
even so that the launch file ./launch/wall_following.launch.py has