更改ros默认依赖的opencv
https://blog.csdn.net/qq_33161084/article/details/90914366
ros melodic使用full安装后会自动安装opencv3.2,但cmake配置文件中的依赖添加并不完整,很多时候需要手动添加需要的依赖。如果系统中存在多个版本opencv,切换版本时也可以使用接下来的方法修改配置。
配置文件地址为:/opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake
catkin_make不编译某些package
https://answers.ros.org/question/54181/how-to-exclude-one-package-from-the-catkin_make-build/
catkin_make -DCATKIN_BLACKLIST_PACKAGES="foo;bar"
catkin_make指定编译某个package
catkin_make -DCATKIN_WHITELIST_PACKAGES=" 你的包名"
查看cmake相关变量
比如查看CATKIN变量
在build目录
cmake -L|grep CATKIN
CATKIN_BLACKLIST_PACKAGES:STRING=vps_detect
CATKIN_DEVEL_PREFIX:PATH=/home/nano/***/devel
CATKIN_ENABLE_TESTING:BOOL=ON
CATKIN_SKIP_TESTING:BOOL=OFF
CATKIN_SYMLINK_INSTALL:BOOL=OFF
CATKIN_WHITELIST_PACKAGES:STRING=
日志相关
rosconsole will load a config file from $ROS_ROOT/config/rosconsole.config when it initializes.
rosconsole also lets you define your own configuration file that will be used by log4cxx, defined by the ROSCONSOLE_CONFIG_FILE environment variable. Anything defined in this config file will override the default config file.
A simple example:
# Set the default ros output to warning and higher
log4j.logger.ros=WARN
# Override my package to output everything
log4j.logger.ros.my_package_name=DEBUG
cd $ROS_ROOT/config
vi rosconsole.config
#
# rosconsole will find this file by default at $ROS_ROOT/config/rosconsole.config
#
# You can define your own by e.g. copying this file and setting
# ROSCONSOLE_CONFIG_FILE (in your environment) to point to the new file
#
log4j.logger.ros=INFO
log4j.logger.ros.roscpp.superdebug=WARN
拷贝文件到xx目录,配置ROSCONSOLE_CONFIG_FILE环境变量=xx/rosconsole.config
日志级别分为
- DEBUG
- INFO
- WARN
- ERROR
- FATAL
launch file相关
todo
catkin_make编译相关
要让ros将某个目录认为是一个package.则在该目录下需要有package.xml文件
rostopic
查看当前有哪些topic
查看某一topic具体内容
roslaunch file注意事项
<param name="image_detected_topic" default="$(arg image_detected_topic)"/>
不要写成
<param name="image_detected_topic" default="$(arg_image_detected_topic)"/>
python3中使用rospy
rospy在安装ros时被默认安装到了/opt/ros/kinetic/lib/python2.7/dist-packages
python3中使用需要指定PYTHONPATH.并安装 rospkg catkin_pkg
https://stackoverflow.com/questions/49758578/installation-guide-for-ros-kinetic-with-python-3-5-on-ubuntu-16-04
pip install pyyaml
pip install rospkg catkin_pkg
代码里:
import sys
print(sys.path)
sys.path.append('/opt/ros/kinetic/lib/python2.7/dist-packages')
print(sys.path)
指定了PYTHONPATH的话,会把$PYTHONPATH加到sys.path的最前面.导致某些python3的库无法使用,比如cv2.