当前位置:网站首页>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 .
边栏推荐
猜你喜欢

MySQL and idea connection

编译原理学习笔记1(编译原理概述与词法分析)

1.2-进制转换

Tips--解决No module named matlab.engine的问题
![[p5.js] practical exercise - irregular symmetry](/img/b0/d5ce69db2304e5045e6e4fca43b478.png)
[p5.js] practical exercise - irregular symmetry
![[advanced C language] - function pointer](/img/73/95380bb719f609e80de56985ed68fd.png)
[advanced C language] - function pointer

C#中virtual(虚方法)的理解以及和abstract(抽象方法)的区别
![[C language must see] yo, writing bugs, I'm sure you've stepped on the pit](/img/0b/6f0faeb6896824ca94ce7ca983065a.jpg)
[C language must see] yo, writing bugs, I'm sure you've stepped on the pit

点云处理---二叉树

OpenMV(六)--STM32实现物体识别与手写数字识别
随机推荐
数字滤波器(三)--模拟滤波器的设计
7-8 浪漫侧影(25分)建树+新解题思路
电工学数字电路自学笔记1.24
[p5.js actual combat] my self portrait
leetcode系统性刷题(三)-------二叉树、二分查找
分支与循环语句
How to install PS filter plug-in
How to bind idea with code cloud
Point cloud processing -- binary tree
Vscode intranet access server
es6 Promise
Jerry ac1082/1074/1090 development record
进程、线程、信号量和互斥锁
【C语言进阶】——剖析入微数据在内存中的存储 【下】(浮点数存储)
Technical aspects passed easily, HR: those with only three years of experience in large factories are not worth 20K
Ros自定义消息及使用
MySQL optimization summary
Point cloud processing - KD tree
ROS系统安装
怎样将IDEA与码云进行绑定