sph@sph-All-Series:~/CLionProjects/ros2_first_demo$ colcon build --symlink-install
Starting >>> ros1_talker
Starting >>> ros2_listener
--- stderr: ros1_talker
CMake Error at CMakeLists.txt:10 (find_package):
By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "catkin", but
CMake did not find one.
Could not find a package configuration file provided by "catkin" with any
of the following names:
catkinConfig.cmake
catkin-config.cmake
Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
"catkin_DIR" to a directory containing one of the above files. If "catkin"
provides a separate development package or SDK, be sure it has been
installed.
---
Failed <<< ros1_talker [ Exited with code 1 ]
Aborted <<< ros2_listener
Summary: 0 packages finished [2.58s]
1 package failed: ros1_talker
1 package aborted: ros2_listener
1 package had stderr output: ros1_talker
[7.165s] ERROR:concurrent.futures:exception calling callback for
Traceback (most recent call last):
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
callback(self)
File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
dest_loop.call_soon_threadsafe(_set_state, destination, source)
File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
handle = self._call_soon(callback, args)
File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
self._check_closed()
File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[7.165s] ERROR:concurrent.futures:exception calling callback for
Traceback (most recent call last):
File "/usr/lib/python3.5/concurrent/futures/_base.py", line 297, in _invoke_callbacks
callback(self)
File "/usr/lib/python3.5/asyncio/futures.py", line 442, in _call_set_state
dest_loop.call_soon_threadsafe(_set_state, destination, source)
File "/usr/lib/python3.5/asyncio/base_events.py", line 532, in call_soon_threadsafe
handle = self._call_soon(callback, args)
File "/usr/lib/python3.5/asyncio/base_events.py", line 506, in _call_soon
self._check_closed()
File "/usr/lib/python3.5/asyncio/base_events.py", line 334, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[7.242s] ERROR:asyncio:Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>
[7.242s] ERROR:asyncio:Task was destroyed but it is pending!
task: wait_for=._call_check_cancel() at /usr/lib/python3.5/asyncio/futures.py:431, Task._wakeup()]> cb=[_wait.._on_completion() at /usr/lib/python3.5/asyncio/tasks.py:414]>
原因是你的talker是用ros1的catkin_make生成的,CMakeList和package.xml文件里面的内容也是ros1风格
解决办法:重新用ros2的风格来生成,这样就不会错啦。
Starting >>> src
--- stderr: src
Traceback (most recent call last):
File "/home/sph/CLionProjects/ros2_first_demo/build/src/catkin_generated/generate_cached_setup.py", line 12, in
from catkin.environment_cache import generate_environment_script
ImportError: No module named 'catkin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sph/CLionProjects/ros2_first_demo/build/src/catkin_generated/generate_cached_setup.py", line 20, in
from catkin.environment_cache import generate_environment_script
ImportError: No module named 'catkin'
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python3
"/home/sph/CLionProjects/ros2_first_demo/build/src/catkin_generated/generate_cached_setup.py")
returned error code 1
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/all.cmake:198 (safe_execute_process)
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
---
Failed <<< src [ Exited with code 1 ]
Summary: 0 packages finished [1.94s]
1 package failed: src
1 package had stderr output: src
原因是这个workspace都是用ros1里面的catkin_make和catkin_init_workspace来建的,colcon当然无法正确连接啦。
解决办法:把ws里面相关的初始化文件删除,重新搞过。
colon.colcon_ros.prefix_path.catkin:the path '/home/sph/catkin_ws/devel' in
ros distro was set to kinetic before. Please make sure that the environment does not mix paths from different distributions
原因是系统source了~/.bashrc之后,会把你之前的ROS_PATH啊一堆系统变量重新写成kinetic相关的。
解决办法:把~/.bashrc和ros1相关的东西屏蔽掉,在需要用的时候再在终端里面临时source 一次就好了。