BUG List
人类从历史中学到的唯一教训,就是人类无法从历史中学到任何教训。
——黑格尔
Linux
常见
-
gedit ~/.bashrc
.bashrc
是home目录下的一个shell文件,用于储存用户的个性化设置。在bash每次启动时都会加载.bashrc
文件中的内容,并根据内容定制当前bash的配置和环境。.bashrc介绍。gedit ~/.bashrc
可以读取.bashrc
并进入修改模式。
shell
-
first value:100 second value:200 ./test.sh: 第 5 行: test: 100: 需要一元表达式 相等:2 ./test.sh: 第 8 行: test: 100: 需要一元表达式 greater:2 ./test.sh: 行 11: [100: 未找到命令 less:127
把
data2
写成了date2
-
./test.sh 1's value :100 2's value :200 和的最大值为:0
#!/bin/bash function my_max() { if [ $1 -gt $2 ]; then return $1 else return $2 fi } read -p "1's value :" data1 #键盘读入,这里不用`$data1` read -p "2's value :" data2 my_max $data1 $data2 echo "$data1和$data2的最大值为:$?"
-
ps -ef |grep helloworld.cpp
搜索到PID,但是kill
和top
显示无进程。$ ps -ef | grep helloworld.cpp suyu 27031 25827 0 09:05 pts/0 00:00:00 grep --color=auto helloworld.cpp $ ps -ef | grep helloworld suyu 26961 26704 0 09:04 pts/3 00:00:00 /home/suyu/week01/helloworld suyu 27173 25827 0 09:08 pts/0 00:00:00 grep --color=auto helloworld #UID PID PPID C STIME TTY TIME CMD
UID 该进程执行的用户id PID 进程id PPID 该进程的父进程id;若无进程,则称为僵尸进程(parent process ID) C CPU的占用率,其形式是百分数 STIME 进程的启动时间 TTY 发起该进程的设备识别符号(本次中,该终端为pts/0,VS Code中的终端为pts/3) TIME 进程执行时间 CMD 进程名称或路径
问题一:文件名与进程名
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Lnoq67oS-1665800488132)(/home/suyu/桌面/Typora/image/BUG List/20201208211600568.png)]
hello.c
是文件,hello
是进程。
本次中,helloworld.cpp的路径是/home/suyu/week01/helloworld.cpp
helloworld进程的路径是/home/suyu/week01/helloworld
问题二:
两次查找均出现了一个相似的东西
$ ps -ef | grep helloworld.cpp
suyu 27031 25827 0 09:05 pts/0 00:00:00 grep --color=auto helloworld.cpp
$ ps -ef | grep helloworld
suyu 27173 25827 0 09:08 pts/0 00:00:00 grep --color=auto helloworld
这里找到的,应该都是“本次搜索”(TTY均为pts/0)。我的理解是,像清点人数不要忘了自己,在查找含helloworld.cpp
或helloworld
的进程时,不要忘了本次搜索**“本身”**也含有helloworld.cpp
或helloworld
。其中--color=auto
的意思是:对匹配内容高亮显示。
ROS
-
RLExceplition:[xx.launch] is neither a …
需要设置环境变量。
gedit ~/.bashrc source ~/catkin_ws/devel/setup.bash
-
Could not find the GUI
升级
joint_state_publish_gui
把launch文件中的joint_state_publisher
修改为joint_state_publish_gui
。 -
一定要在相关目录下运行
check_urdf
才能正确的检查urdf文件。 -
编译空间时,确保工作变量可以找到功能包。可以用
rospack
去寻找。rospack+roscd+rosls
$ rospack find [pack_name]
-
Invoking “cmake” failed
-
ROSModel报错
改
Frame
为base_link
-
Invoking “make cmake_check_build_system” failed
不同功能包里不有重名的节点。
-
Make sure file exists in package path and permission is set to excutable (chmod + x)
注意文件的属性 ,本次是"scripts >> mrobot_teleop.py",“属性>>可执行”
-
创建功能包
cd ~/catkin_ws/src catkin_create_pkg <package_name> [depend1] [depend2] cd ~/catkin_ws/src catkin_make
-
rviz中不能设置碰撞参数
-
urdf第一行不能修改,尽量去掉注释
-
Error reading end tag
检查标签是否成对
-
Couldn’t save project < invalid path >
设置路径
-
注意
oarm6.xacro
本身就是宏,引用时要加上</xacro:macro
-
maximum recursion depth exceeded
-
- Resource not found: The following package was not found in : oarm6_moveit_config
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/opt/ros/melodic/share
Building Common MoveIt Dependencies from Source in Catkin
当使用
rospack
去寻找oarm6_moveit_config
时,发现找不到这个功能包,原因是没有写入路径,用gedit ~/.bashrc
打开.bashrc
,设置ROS功能包路径,然后检查,找到。rospack oarm6_description //寻找功能包 gedit ~/.bashrc //打开.bashrc,设置ROS功能包路径 source ~/.bashrc //终端输入,让配置在当前终端生效 echo $ROS_PACKAGE_PATH //检查环境变量
-
通过
rospack list
,发现找不到oarm6_descrption
,rospack list
显示所有的功能包,发现只有改动之前的
oarm6
。记得要在
package.xml
和CMakeList.txt
中同步修改名称
- Resource not found: The following package was not found in : oarm6_moveit_config
-
Invalid tag: moveit_config
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/spark/my_ws/src
ROS path [2]=/home/spark/catkin_ws/src
ROS path [3]=/opt/ros/indigo/share
ROS path [4]=/opt/ros/indigo/stacks.Arg xml is
The traceback for the exception was written to the log file
moveit_config是一个类似元功能包,不能递归的编译,需要在src 根目录下编译 -
: oarm6_moveit_config
$(find oarm6_moveit_config)
是该包的路径,从/home开始写(不加$)就算绝对路径。 -
env | grep ros
查看和ros相关的环境变量,关注 ROS_PACKAGE_PATH的日志信息。
-
RLException: error loading tag:
file does not exist [3]
XML is <rosparam command=“load” file=“3” ns=“manipulator”/ >报错意思是没有kinematics.yaml文件,因此在设置组的时候填上3是不对的,点击后面的浏览文件按钮,选择在solidworks插件生成的config文件
(oarm6_descrption/config)
,而不是填3。古月书里moveit setup assistant助手设置 planning groups中,设置的是Kin.Solver Attempts
,而现在是Kin.parameters file
。 -
ROS目录用途解释
-
RLException: Invalid roslaunch XML syntax: no element found: line 42, column 0 The traceback for the exception was written to the log file
检查标签是非完整对称。
<launch> ... </launch>
-
RLException: error loading tag:
file does not exist [/home/suyu/catkin_ws/src/oarm6_description/config/oarm.yaml]
XML isoarm
错写成oram
-
roscd
-
RLException: error loading tag:
file /home/suyu/catkin_ws/src/oarm6_description/config/oarm.yaml contains invalid YAML:
while parsing a flow mapping
in “”, line 13, column 14:
controllers: {
^
expected ‘,’ or ‘}’, but got ‘’
in “”, line 15, column 1:^
XML is
The traceback for the exception was written to the log file删去
{
-
No tf data. Actual error: Fixed Frame [map] does not exist
rosrun tf static_transform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 map xxx 100 //把xxx换掉
-
[ERROR] [1656077235.365596]: Unrecognized controller: follow_controller
-
先执行订阅者,后执行发布者,发现不是从第一条数据开始接受,原因是发布者在发布前几条数据时,也在向ROS Master注册,注册后,才可以订阅
ros::Duration(3.0).sleep()//加入休眠,延迟第一条数据的发送
比赛
-
opencv
-
python
-
Realsense d435i
-
yolo(知道怎么调用就行)
-
机器人学基础 正逆运动学
C++
-
VSCode中先生成了testFunc1.c,后生成了testFunc1.h(testFunc1.c中引用了testFunc1.h),报错无源文件。
重新写一遍testFunc1.c即可。
-
/home/suyu/week03/src/copy_image.cpp:1:9: warning: #pragma once in main file #pragma once ^~~~
.cpp
文件中不能加#pragma once
-
段错误 (核心已转储)
一旦一个程序发生了越界访问,cpu 就会产生相应的保护,于是 segmentation fault 就出现了,通过上面的解释,段错误应该就是访问了不可访问的内存,这个内存区要么是不存在的,要么是受到系统保护的,还有可能是缺少文件或者文件损坏。
-
Warning: 'typedef' was ignored in this declaration.
Delete
typedef
. It’s the C way of declaring structs, C++ does it automatically for you. -
不要函数名和变量名重名!!!
-
#include <unistd.h>
ubuntu里没有<Windows.h>头文件,在<unistd.h>里有usleep()
CMake
-
learncmake
根目录已经cmake
过,在build
中make
时,显示无Makefile
删去根目录中的除
CMakeList.txt
的其他文件 -
$ cmake .. CMake Warning: Ignoring extra path from command line: ".." CMake Error: The source directory "/home/suyu/learncmake" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.
-
必须有
cmake_minimum_required
-
引用变量
${SRC_LIST}
-
CMake Warning (dev) at CMakeLists.txt:5: Syntax Warning in cmake code at column 37 Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it.
MESSAGE(STATUS "This is BINARY dir " ${HELLO_BINARY_DIR})
引用参数加一个空格
-
CMake Error at CMakeLists.txt:3 (ADD_SUBDIRECTORY): ADD_SUBDIRECTORY given source "~/learncmake/t3/lib" which is not an existing directory.
cmake时,想让
libhello.so
生成在lib
目录中,而不是在build
下再生成一个lib
两种处理
-
在主工程文件 CMakeLists.txt 中修
改 ADD_SUBDIRECTORY(lib)指令来指定一个编译输出位置ADD_SUBDIRECTORY(lib ~/learncmake/t3/lib)
含义是定义了将 lib子目录加入工程,并指定编译输出(包含编译中间结果)路径为lib目录
-
在 lib/CMakeLists.txt 中添加
SET(LIBRARY_OUTPUT_PATH <路径>)来指定一个新的位置(推荐)
-
-
像生成两个同名的动态库和静态库
ADD_LIBRARY(hello SHARED ${LIBHELLO_SRC})#生成libhello.so ADD_LIBRARY(hello_static STATIC ${LIBHELLO_SRC})#生成libhello_static.a,与libhello.so来自同一个源文件。 SET_TARGET_PROPERTIES(hello_static PROPERTIES OUTPUT_NAME "hello")#将libhello_static.a改为libhello.a
-
cpp.cpp:5:18: error: cast from ‘int*’ to ‘int’ loses precision [-fpermissive] cout << (int)arr << endl;
(int)arr //显示会丢失精度 (long)arr//OK
-
warning: ‘typedef’ was ignored in this declaration typedef struct Mat { ^~~~~~~
//给Mat类加上别名 typedef struct Mat { int width; int length; float image_point[1023][1023]; } Mat;
-
# cmake version CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # project name PROJECT(opencvcourse) # find OpenCV FIND_PACKAGE(OpenCV REQUIRED) # show the message of OpenCV MESSAGE(STATUS "OpenCV library status:") MESSAGE(STATUS " version: ${OpenCV_VERSION}") MESSAGE(STATUS " headers: ${OpenCV_INCLUDE_DIRS}") MESSAGE(STATUS " libraries: ${OpenCV_LIBS}") # link headers INCLUDE_DIRECTORIES({OpenCV_INCLUDE_DIRS} ./include) #设置输出路径 SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) #SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # 添加源代码文件到SRC_LIST变量中 AUX_SOURCE_DIRECTORY(src SRC_LIST) # 生成可执行文件 ADD_EXECUTABLE(opencv ${SRC_LIST}) # after ADD_EXECUTABLE,为生成文件target添加库 TARGET_LINK_LIBRARIES(opencv ${OpenCV_LIBS})
按完整工程格式编译模板
-
删去build中的所有文件,再打开VSCode,选择第二个(Let CMake guess what compilers and environment to use)
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nSIO9hct-1665800488134)(/home/suyu/2022-10-11 20-01-33 的屏幕截图.png)]
OpenCV
-
命名空间 "cv" 没有成员 "imshow"
#include<opencv2/opencv.hpp>
-
terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.5.5) /home/suyu/opencv-4.5.5/modules/core/src/array.cpp:2494: error: (-206:Bad flag (parameter or structure field)) Unrecognized or unsupported array type in function 'cvGetMat'
每次运行完成后都会报错,因为没有更多图像可以显示
-
what(): OpenCV(4.5.5) /home/suyu/opencv-4.5.5/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' 已放弃 (核心已转储)
imread
未正常读取图片 -
Opencv中Mat数据类型定义为指向uchar的指针
typedef Vec<uchar, 3> Vec3b;//像素的数据值由三个数组成,这三个数的数据类型为uchar
-
,at方法取图像中的点的用法:
image.at(i,j):取出灰度图像中i行j列的点。
image.at(i,j)[k]:取出彩色图像中i行j列第k通道的颜色点。其中uchar,Vec3b都是图像像素值的类型,不要对Vec3b这种类型感觉害怕,其实在core里它是通过typedef Vec<T,N>来定义的,N代表元素的个数,T代表类型。
注意是先行后列,先y坐标后先坐标
-
opencv中,由于使用Mat.at访问数据时,必须正确填写相应的数据类型,因此必须弄清楚opencv中的数据类型与我们常用
数据类型一一对应关系。
Mat_<uchar>
---------CV_8U
Mat_<char>
-----------CV_8S
Mat_<short>
---------CV_16S
Mat_<ushort>-
-------CV_16U
Mat_<int>
-----------CV_32S
Mat_<float>
----------CV_32FMat_<double>
--------CV_64F
C1 | C2 | C3 | C4 | C6 | |
---|---|---|---|---|---|
uchar | uchar | cv::Vec2b | cv::Vec3b | cv::Vec4b | |
short | short | cv::Vec2s | cv::Vec3s | cv::Vec4s | |
int | int | cv::Vec2i | cv::Vec3i | cv::Vec4i | |
float | float | cv::Vec2f | cv::Vec3f | cv::Vec4f | cv::Vec6f |
double | double | cv::Vec2d | cv::Vec3d | cv::Vec4d | cv::Vec6d |
- OpenCV中的at函数
srcImage.at<uchar>(x, y) //表示的是 x 行 y 列 的这个像素
srcImage.at<uchar>(Point(x, y)) //表示的是 坐标(x,y)的像素
at(i,j) 是opencv中图像遍历函数,它是一个模板函数,可以取到任何类型的图像上的点。
image.at(i,j)[k]:是指取出彩色图像中i行j列第k通道的颜色点。
其中Vec3b是图像像素值的类型,如果还不太明白,可以选中右键转到其定义: typedef Vec<uchar, 3> Vec3b; 是通过typedef Vec<T,N>来定义的,N代表元素的个数,T代表类型,unchar是类型,3是元素的个数。
.at<>()返回一个值,.ptr<>()返回一个地址
Git
-
fatal: Not possible to fast-forward, aborting.
git pull origin master --rebase