当前位置:网站首页>ROS scattered knowledge points and error resolution
ROS scattered knowledge points and error resolution
2022-07-28 17:53:00 【Zhang Feifei~】
One 、 Knowledge point
1.rviz Set the point cloud color
Remove use rainbow, Set up min_color and max_color Relevant point clouds can be displayed according to the set color .
2.C++ Time calculation
#include<ctime>
clock_t startTime,endTime;
startTime = clock();// Timing begins
for (int i = 0; i < 2147483640; i++)
{
i++; }
endTime = clock();// End of the timing
cout << "The run time is: " <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;
3.ros NodeHandle and ros NodeHandle("~")
Private node handles can generally be used to obtain node configuration parameters , from launch Get in file
ros::init (argc, argv, "ply_load");
ros::NodeHandle nh;
ros::NodeHandle pri_nh("~")
ros::Publisher pcl_pub = nh.advertise<sensor_msgs::PointCloud2> ("pcl_output", 1);// The published topic has no node name namespace , Topic name is /pcl_output
ros::Publisher pcl_pub = nh.advertise<sensor_msgs::PointCloud2> ("pcl_output", 1);// The topic is called /ply_load/pcl_output
- explicit keyword
Role is : about The constructor of a parameter , Cancel its implicit conversion .
Implicit conversion :
class CxString // Not used explicit Class declaration for keyword , That is, implicitly declaring
{
public:
char *_pstr;
int _size;
CxString(int size)
{
_size = size; // string Default size for
_pstr = malloc(size + 1); // Distribute string Of memory
memset(_pstr, 0, size + 1);
}
}
When called :
CxString string2 = 10; // This is a OK Of , by CxString Pre allocation 10 Byte size memory
CxString string6 = 'c'; // This is also OK Of , It's actually calling theta CxString(int size), And size be equal to 'c' Of ascii code
Because of the implicit conversion :
CxString string2 = 10;
Equivalent to :
CxString tem(10);
CxString string2 = tem;
Added explicit after , This implicit conversion is canceled :
explicit CxString(int size)
{
_size = size;
// Same code as above , Omit ...
}
When called :
CxString string2 = 10; // That's not good
CxString string6 = 'c'; // It doesn't work
5.std::iota
Used to generate continuous numbers
// from 0 Start generating a set of numbers to fill the array
std::iota(unassigned_objects.begin(), unassigned_objects.end(), 0);
Two 、 Error resolution
2.
sudo apt-get update Report errors
W: Error checking digital signature . This warehouse has not been updated , So still use the previous index file .GPG error :http://packages.ros.org/ros/ubuntu bionic InRelease: The following signature is invalid : EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected].org>
E: Warehouse “http://ppa.launchpad.net/zarquon42/meshlab/ubuntu bionic Release” No, Release file .
N: Cannot safely update with this source , So the source is disabled by default .
resolvent :
Note that the last number corresponds to the above
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv F42ED6FBAB17C654
E: Warehouse “http://ppa.launchpad.net/zarquon42/meshlab/ubuntu bionic Release” No, Release file .
N: Cannot safely update with this source , So the source is disabled by default .
resolvent :
stay etc/apt/sources.list.d Delete the corresponding... From the directory ppa
cd etc/apt/sources.list.d
sudo mv zarquon42-ubuntu-meshlab-bionic.list zarquon42-ubuntu-meshlab-bionic.list.bak
3. stay ros There is no source Generally, you will report an error and cannot find the package . such source once bash Just file it , There is also a real lack of a package , Install it.
ResourceNotFound: rgbd_launch
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share
sudo apt-get install ros-kinetic-rgbd-launch
4.ROS There is an error when defining subscribers in invalid use of non-static member function
initialization subscriber Solution of time problems
The wrong way to write :
datasub = nh.subscribe("/objects", 10, &track_processor::process);
After the modification :
datasub = nh.subscribe("/objects", 10, &track_processor::process, this);
And note that the callback function must return a value of void In the form of .
边栏推荐
- [unity] how to play sprite Jiugongge?
- 数字滤波器(六)--设计FIR滤波器
- An article takes you closer to the overview and principle of kubernetes
- 如何安装ps的滤镜插件
- [advanced C language] - Advanced pointer [i]
- Jerry ac692x --- matrix keyboard addition
- [p5.js learning notes] basic knowledge of code drawing
- ROS custom message and use
- Leetcode systematic question brushing (3) -- binary tree, binary search
- Ros自定义消息及使用
猜你喜欢

Mmcv installation method

IDEA报错Error running ‘Application‘ Command line is too long解决方案

点云处理---二叉树

PCA reports error in eigen (crossprod (t (x), t (x)), symmetric = true): 'x' has infinite value or missing value
![[machine learning notes] regularization: ridge regression](/img/94/9d1e126554fac0713937381253f9c9.png)
[machine learning notes] regularization: ridge regression

【p5.js学习笔记】码绘的基础知识

【p5.js学习笔记】鼠标交互事件

【Unity】Timeline学习笔记(七):自定义片段(Clip)

【p5.js学习笔记】局部变量(let)与全局变量(var)声明
![[p5.js] practical exercise - irregular symmetry](/img/b0/d5ce69db2304e5045e6e4fca43b478.png)
[p5.js] practical exercise - irregular symmetry
随机推荐
【C语言必看】哟写BUG呢,我敢保证你踩过坑
.net动态调用webservice的三种方式
leetcode系统性刷题(三)-------二叉树、二分查找
阿里云天池大赛赛题解析(深度学习篇)--阅读笔记1--赛题一
Jerry ac692x --- matrix keyboard addition
LeetCode--45. 跳跃游戏Ⅱ(贪心)
es6 Promise
JVM performance tuning
【Unity】Sprite九宫格到底怎么玩?
Please make sure you have the correct access rights and the repository exists.
PyTorch中grid_sample的使用方法
Understanding of virtual (virtual method) in C and its difference from abstract (abstract method)
Point cloud processing -- binary tree
[阅读笔记] For Paper:R-CNN系列的三篇论文总结
Collection collection
【C语言笔记分享】自定义类型:结构体,枚举,联合(建议收藏)
【p5.js实战】我的自画像
【C语言进阶】——指针进阶[Ⅰ]
.net MVC的理解
电工学下册自学笔记1.23