1. 程式人生 > >ros學習問題(一)

ros學習問題(一)

問題1:rospack depends1 beginner_tutorials

I have the following error :

[rospack] Error: no such package beginner_tutorials

**解答1:**You might need to rebuild your workspace before your new package is findable:

cd ~/catkin_ws
catkin_make
. devel/setup.bash
rospack depends1 beginner_tutorials

問題2:rospack depends1 beginner_tutorials

[rospack] Error: the rosdep view is empty: call ‘sudo rosdep init’ and ‘rosdep update’
輸入sudo rosdep init之後
[sudo] qinhaidong 的密碼:
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list


Website may be down.報錯
**解答2:**這種網路問題,等等再次輸入 sudo rosdep init即可,出現
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
接著輸入
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
重新sudo rosdep init
Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run rosdep update
接著輸入
rosdep update

問題3

在按照教程http://wiki.ros.org/cn/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29進行時catkin_make報錯

add_subdirectory(beginner_tutorials)
– Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /opt/ros/kinetic/share/genmsg/cmake/genmsg-extras.cmake:94 (message):
add_message_files() directory not found:
/home/qinhaidong/catkin_ws/src/beginner_tutorials/msg
Call Stack (most recent call first):
beginner_tutorials/CMakeLists.txt:8 (add_message_files)

– Configuring incomplete, errors occurred!
See also “/home/qinhaidong/catkin_ws/build/CMakeFiles/CMakeOutput.log”.
See also “/home/qinhaidong/catkin_ws/build/CMakeFiles/CMakeError.log”.
Makefile:528: recipe for target ‘cmake_check_build_system’ failed
make: *** [cmake_check_build_system] Error 1
Invoking “make cmake_check_build_system” failed
解答3
ROS教程出錯了,要把/home/qinhaidong/catkin_ws/src/beginner_tutorials路徑下的cmakelists.txt中以下部分註釋掉即可:
##Declare ROS messages and services
#add_message_files(FILES Num.msg)
#add_service_files(FILES AddTwoInts.srv)
##Generate added messages and services
#generate_messages(DEPENDENCIES std_msgs)

問題4

在按ROS入門教程(點選開啟連結)行進過程中到了執行

rosmsg show beginner_tutorials/Num

命令時,出現提示

The manifest (with format version 2) must not contain the following tags: run_depend

的警告,這個的主要解決方法是使用catkin方式時在package.xml檔案中將教程中新增的兩行語句

<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>

要改成

<build_depend> message_generation </build_depend>

<exec_depend> message_runtime </exec_depend>

問題5

在這一講http://wiki.ros.org/cn/ROS/Tutorials/CreatingMsgAndSrv執行 catkin_make時報錯
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:108 (message):
catkin_package() called with unused arguments: …

解答5
If the posted code is actually what you have in your CMake file:
catkin_package( … CATKIN_DEPENDS message_runtime … …)
then … is clearly not a valid argument. If … is mentioned in the tutorial it is meant as an example and the dots have to be replaced with whatever else you need to pass.
意思就是說…是額外路徑,沒用的話就去掉。
改為catkin_package( CATKIN_DEPENDS message_runtime )