激光SLAM理论与实践 - 第六期 第1章 激光SLAM简介 作业与心得

2024-02-24 11:50

本文主要是介绍激光SLAM理论与实践 - 第六期 第1章 激光SLAM简介 作业与心得,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

  1. 了解 Linux 系统:阅读《鸟哥的 Linux 私房菜》自学前三部分内容,或利用互联网进行学习,简答以下问题;(3 分)

    1. 列举三个你常用的 Linux 命令,并说明他们的功能。

      1. man 指令,是manual(操作说明)的缩写,该指令用于查看其他指令的详细说明;比如 $ man date ,就会出现有关 date 的详细说明。
      2. cd 指令,是change directory(改变目录)的缩写,该指令用于改变工作目录;比如 $ cd /home/tx-ubuntu64 ,就会将当前目录变为 /home/tx-ubuntu64
      3. mkdir 指令,是make directory(创建目录)的缩写,该指令用于创建新目录;比如 $ mkdir abc ,就会创建文件夹abc。
    2. 一句话简要介绍 Vim 的功能,如何在 Vim 中进行插入和删除,如何保存并退出 Vim?

      1. Vim 是 vi 进阶版本的文本编辑器,Vim 可以用颜色或底线等方式来显示一些特殊的信息。
      2. 在一般模式中,按下 i (i, I, o, O, a, A, r, R)进入编辑模式,开始编辑(包括插入和删除)文字,按下 Esc 即可退出编辑模式。
      3. 在一般模式中,按下 :wq 保存并退出Vim。
    3. 列举两种常用的 Linux 压缩和解压缩命令。

      1. tar 指令,解压 tar zxvf FileName.tar.gz ,压缩 tar zcvf FileName.tar.gz DirName
      2. unzip 指令与 zip 指令,解压 unzip FileName.zip ,压缩 zip -q -r FileName.zip FileName
  2. 了解 ROS:观看 ROS 免费公开课或前往 ROS 官网学习官方教程,安装好 ROS,提供运行小海龟跑的截图;(3 分)

在这里插入图片描述
这里需要注意ROS更新过key,最好使用英文版安装教程。

  1. 学习机器人姿态描述入门材料,完成坐标转换推导;(3 分)
    设机器人的世界坐标为 xa, ya,其相对于世界坐标系的方向为 θa(右手坐标系)。假设机器人旁边有一物体在世界坐标系下的位姿为(xb, yb, θb),请问:

    1. 该物体相对于机器人的位置和朝向是什么,即该物体在当前机器人坐标系下的位姿是多少?

      解:设世界坐标系为 { W } \{W\} {W} ,机器人坐标系为 { A } \{A\} {A} ,物体坐标系为 { B } \{B\} {B} ,则
      在这里插入图片描述

      B A T = W A T ⋅ B W T = A W T − 1 ⋅ B W T = [ A W R T − A W R T ⋅ A W P 0 1 ] ⋅ [ B W R B W P 0 1 ] = [ A W R T ⋅ B W R A W R T ⋅ B W P − A W R T ⋅ A W P 0 1 ] = [ A W R T ⋅ B W R A W R T ⋅ ( B W P − A W P ) 0 1 ] \begin{aligned} ^A_BT&=^A_WT\cdot^W_BT \\ &=^W_AT^{-1}\cdot^W_BT \\ &=\begin{bmatrix} ^W_AR^T & -^W_AR^T\cdot^W_AP \\ 0 & 1 \\ \end{bmatrix}\cdot\begin{bmatrix} ^W_BR & ^W_BP \\ 0 & 1 \\ \end{bmatrix} \\ &=\begin{bmatrix} ^W_AR^T\cdot^W_BR & ^W_AR^T\cdot^W_BP-^W_AR^T\cdot^W_AP \\ 0 & 1 \\ \end{bmatrix} \\ &=\begin{bmatrix} ^W_AR^T\cdot^W_BR & ^W_AR^T\cdot(^W_BP-^W_AP) \\ 0 & 1 \\ \end{bmatrix} \end{aligned} BAT=WATBWT=AWT1BWT=[AWRT0AWRTAWP1][BWR0BWP1]=[AWRTBWR0AWRTBWPAWRTAWP1]=[AWRTBWR0AWRT(BWPAWP)1]
      式中:
      A W R T ⋅ B W R = [ c o s θ a − s i n θ a s i n θ a c o s θ a ] T ⋅ [ c o s θ b − s i n θ b s i n θ b c o s θ b ] = [ c o s θ a s i n θ a − s i n θ a c o s θ a ] ⋅ [ c o s θ b − s i n θ b s i n θ b c o s θ b ] = [ c o s θ a c o s θ b + s i n θ a s i n θ b − c o s θ a s i n θ b + s i n θ a c o s θ b − s i n θ a c o s θ b + c o s θ a s i n θ b s i n θ a s i n θ b + c o s θ a c o s θ b ] = [ c o s ( θ b − θ a ) − s i n ( θ b − θ a ) s i n ( θ b − θ a ) c o s ( θ b − θ a ) ] \begin{aligned} ^W_AR^T\cdot^W_BR&=\begin{bmatrix} cos\theta_a & -sin\theta_a \\ sin\theta_a & cos\theta_a \\ \end{bmatrix}^T\cdot\begin{bmatrix} cos\theta_b & -sin\theta_b \\ sin\theta_b & cos\theta_b \\ \end{bmatrix} \\ &=\begin{bmatrix} cos\theta_a & sin\theta_a \\ -sin\theta_a & cos\theta_a \\ \end{bmatrix}\cdot\begin{bmatrix} cos\theta_b & -sin\theta_b \\ sin\theta_b & cos\theta_b \\ \end{bmatrix} \\ &=\begin{bmatrix} cos\theta_acos\theta_b+sin\theta_asin\theta_b & -cos\theta_asin\theta_b+sin\theta_acos\theta_b \\ -sin\theta_acos\theta_b+cos\theta_asin\theta_b & sin\theta_asin\theta_b+cos\theta_acos\theta_b \\ \end{bmatrix} \\ &=\begin{bmatrix} cos(\theta_b-\theta_a) & -sin(\theta_b-\theta_a) \\ sin(\theta_b-\theta_a) & cos(\theta_b-\theta_a) \\ \end{bmatrix} \end{aligned} AWRTBWR=[cosθasinθasinθacosθa]T[cosθbsinθbsinθbcosθb]=[cosθasinθasinθacosθa][cosθbsinθbsinθbcosθb]=[cosθacosθb+sinθasinθbsinθacosθb+cosθasinθbcosθasinθb+sinθacosθbsinθasinθb+cosθacosθb]=[cos(θbθa)sin(θbθa)sin(θbθa)cos(θbθa)]
      A W R T ⋅ ( B W P − A W P ) = [ c o s θ a − s i n θ a s i n θ a c o s θ a ] T ⋅ ( [ x b y b ] − [ x a y a ] ) = [ c o s θ a s i n θ a − s i n θ a c o s θ a ] ⋅ [ x b − x a y b − y a ] = [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] \begin{aligned} ^W_AR^T\cdot(^W_BP-^W_AP)&=\begin{bmatrix} cos\theta_a & -sin\theta_a \\ sin\theta_a & cos\theta_a \\ \end{bmatrix}^T\cdot(\begin{bmatrix} x_b \\ y_b \\ \end{bmatrix}-\begin{bmatrix} x_a \\ y_a \\ \end{bmatrix}) \\ &=\begin{bmatrix} cos\theta_a & sin\theta_a \\ -sin\theta_a & cos\theta_a \\ \end{bmatrix}\cdot\begin{bmatrix} x_b-x_a \\ y_b-y_a \\ \end{bmatrix} \\ &=\begin{bmatrix} (x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a \\ -(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a \\ \end{bmatrix} \end{aligned} AWRT(BWPAWP)=[cosθasinθasinθacosθa]T([xbyb][xaya])=[cosθasinθasinθacosθa][xbxaybya]=[(xbxa)cosθa+(ybya)sinθa(xbxa)sinθa+(ybya)cosθa]
      代入:
      B A T = [ c o s ( θ b − θ a ) − s i n ( θ b − θ a ) ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a s i n ( θ b − θ a ) c o s ( θ b − θ a ) − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a 0 0 1 ] \begin{aligned} ^A_BT&=\begin{bmatrix} cos(\theta_b-\theta_a) & -sin(\theta_b-\theta_a) & (x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a\\ sin(\theta_b-\theta_a) & cos(\theta_b-\theta_a) & -(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a\\ 0 & 0 & 1\\ \end{bmatrix} \end{aligned} BAT=cos(θbθa)sin(θbθa)0sin(θbθa)cos(θbθa)0(xbxa)cosθa+(ybya)sinθa(xbxa)sinθa+(ybya)cosθa1
      位姿为: ( ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a , − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a , θ b − θ a ) ((x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a,-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a,\theta_b-\theta_a) ((xbxa)cosθa+(ybya)sinθa,(xbxa)sinθa+(ybya)cosθa,θbθa)

    2. 机器人此时朝它的正前方(机器人坐标系 X 轴)行进了 d 距离,然后又转了 θd角,请问物体此时在这一时刻机器人坐标系下的位姿是多少?

      解:移动后的机器人坐标系为 { A ′ } \{A'\} {A} ,则
      在这里插入图片描述

      B A ′ T = A A ′ T ⋅ B A T = A ′ A T − 1 ⋅ B A T = [ A ′ A R T − A ′ A R T ⋅ A ′ A P 0 1 ] ⋅ [ B A R B A P 0 1 ] = [ A ′ A R T ⋅ B A R A ′ A R T ⋅ B A P − A ′ A R T ⋅ A ′ A P 0 1 ] = [ A ′ A R T ⋅ B A R A ′ A R T ⋅ ( B A P − A ′ A P ) 0 1 ] \begin{aligned} ^{A'}_BT&=^{A'}_AT\cdot^A_BT \\ &=^A_{A'}T^{-1}\cdot^A_BT \\ &=\begin{bmatrix} ^A_{A'}R^T & -^A_{A'}R^T\cdot^A_{A'}P \\ 0 & 1 \\ \end{bmatrix}\cdot\begin{bmatrix} ^A_BR & ^A_BP \\ 0 & 1 \\ \end{bmatrix} \\ &=\begin{bmatrix} ^A_{A'}R^T\cdot^A_BR & ^A_{A'}R^T\cdot^A_BP-^A_{A'}R^T\cdot^A_{A'}P \\ 0 & 1 \\ \end{bmatrix} \\ &=\begin{bmatrix} ^A_{A'}R^T\cdot^A_BR & ^A_{A'}R^T\cdot(^A_BP-^A_{A'}P) \\ 0 & 1 \\ \end{bmatrix} \end{aligned} BAT=AATBAT=AAT1BAT=[AART0AARTAAP1][BAR0BAP1]=[AARTBAR0AARTBAPAARTAAP1]=[AARTBAR0AART(BAPAAP)1]
      式中:
      A ′ A R T ⋅ B A R = [ c o s θ d − s i n θ d s i n θ d c o s θ d ] T ⋅ [ c o s ( θ b − θ a ) − s i n ( θ b − θ a ) s i n ( θ b − θ a ) c o s ( θ b − θ a ) ] = [ c o s θ d s i n θ d − s i n θ d c o s θ d ] ⋅ [ c o s ( θ b − θ a ) − s i n ( θ b − θ a ) s i n ( θ b − θ a ) c o s ( θ b − θ a ) ] = [ c o s θ d c o s ( θ b − θ a ) + s i n θ d s i n ( θ b − θ a ) − c o s θ d s i n ( θ b − θ a ) + s i n θ d c o s ( θ b − θ a ) − s i n θ d c o s ( θ b − θ a ) + c o s θ d s i n ( θ b − θ a ) s i n θ d s i n ( θ b − θ a ) + c o s θ d c o s ( θ b − θ a ) ] = [ c o s ( ( θ b − θ a ) − θ d ) − s i n ( ( θ b − θ a ) − θ d ) s i n ( ( θ b − θ a ) − θ d ) c o s ( ( θ b − θ a ) − θ d ) ] = [ c o s ( θ b − θ a − θ d ) − s i n ( θ b − θ a − θ d ) s i n ( θ b − θ a − θ d ) c o s ( θ b − θ a − θ d ) ] \begin{aligned} ^A_{A'}R^T\cdot^A_BR&=\begin{bmatrix} cos\theta_d & -sin\theta_d \\ sin\theta_d & cos\theta_d \\ \end{bmatrix}^T\cdot\begin{bmatrix} cos(\theta_b-\theta_a) & -sin(\theta_b-\theta_a) \\ sin(\theta_b-\theta_a) & cos(\theta_b-\theta_a) \\ \end{bmatrix} \\ &=\begin{bmatrix} cos\theta_d & sin\theta_d \\ -sin\theta_d & cos\theta_d \\ \end{bmatrix}\cdot\begin{bmatrix} cos(\theta_b-\theta_a) & -sin(\theta_b-\theta_a) \\ sin(\theta_b-\theta_a) & cos(\theta_b-\theta_a) \\ \end{bmatrix} \\ &=\begin{bmatrix} cos\theta_dcos(\theta_b-\theta_a)+sin\theta_dsin(\theta_b-\theta_a) & -cos\theta_dsin(\theta_b-\theta_a)+sin\theta_dcos(\theta_b-\theta_a) \\ -sin\theta_dcos(\theta_b-\theta_a)+cos\theta_dsin(\theta_b-\theta_a) & sin\theta_dsin(\theta_b-\theta_a)+cos\theta_dcos(\theta_b-\theta_a) \\ \end{bmatrix} \\ &=\begin{bmatrix} cos((\theta_b-\theta_a)-\theta_d) & -sin((\theta_b-\theta_a)-\theta_d) \\ sin((\theta_b-\theta_a)-\theta_d) & cos((\theta_b-\theta_a)-\theta_d) \\ \end{bmatrix} \\ &=\begin{bmatrix} cos(\theta_b-\theta_a-\theta_d) & -sin(\theta_b-\theta_a-\theta_d) \\ sin(\theta_b-\theta_a-\theta_d) & cos(\theta_b-\theta_a-\theta_d) \\ \end{bmatrix} \\ \end{aligned} AARTBAR=[cosθdsinθdsinθdcosθd]T[cos(θbθa)sin(θbθa)sin(θbθa)cos(θbθa)]=[cosθdsinθdsinθdcosθd][cos(θbθa)sin(θbθa)sin(θbθa)cos(θbθa)]=[cosθdcos(θbθa)+sinθdsin(θbθa)sinθdcos(θbθa)+cosθdsin(θbθa)cosθdsin(θbθa)+sinθdcos(θbθa)sinθdsin(θbθa)+cosθdcos(θbθa)]=[cos((θbθa)θd)sin((θbθa)θd)sin((θbθa)θd)cos((θbθa)θd)]=[cos(θbθaθd)sin(θbθaθd)sin(θbθaθd)cos(θbθaθd)]
      A ′ A R T ⋅ ( B A P − A ′ A P ) = [ c o s θ d − s i n θ d s i n θ d c o s θ d ] T ⋅ ( [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] − [ d 0 ] ) = [ c o s θ d s i n θ d − s i n θ d c o s θ d ] ⋅ [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] = [ [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] c o s θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] s i n θ d − [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] s i n θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] c o s θ d ] \begin{aligned} ^A_{A'}R^T\cdot(^A_BP-^A_{A'}P)&=\begin{bmatrix} cos\theta_d & -sin\theta_d \\ sin\theta_d & cos\theta_d \\ \end{bmatrix}^T\cdot(\begin{bmatrix} (x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a \\ -(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a \\ \end{bmatrix}-\begin{bmatrix} d \\ 0 \\ \end{bmatrix}) \\ &=\begin{bmatrix} cos\theta_d & sin\theta_d \\ -sin\theta_d & cos\theta_d \\ \end{bmatrix}\cdot\begin{bmatrix} (x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d \\ -(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a \\ \end{bmatrix} \\ &=\begin{bmatrix} [(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]cos\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]sin\theta_d \\ -[(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]sin\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]cos\theta_d \\ \end{bmatrix} \end{aligned} AART(BAPAAP)=[cosθdsinθdsinθdcosθd]T([(xbxa)cosθa+(ybya)sinθa(xbxa)sinθa+(ybya)cosθa][d0])=[cosθdsinθdsinθdcosθd][(xbxa)cosθa+(ybya)sinθad(xbxa)sinθa+(ybya)cosθa]=[[(xbxa)cosθa+(ybya)sinθad]cosθd+[(xbxa)sinθa+(ybya)cosθa]sinθd[(xbxa)cosθa+(ybya)sinθad]sinθd+[(xbxa)sinθa+(ybya)cosθa]cosθd]
      代入:
      B A ′ T = [ c o s ( θ b − θ a − θ d ) − s i n ( θ b − θ a − θ d ) [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] c o s θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] s i n θ d s i n ( θ b − θ a − θ d ) c o s ( θ b − θ a − θ d ) − [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] s i n θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] c o s θ d 0 0 1 ] \begin{aligned} ^{A'}_BT&=\begin{bmatrix} cos(\theta_b-\theta_a-\theta_d) & -sin(\theta_b-\theta_a-\theta_d) & [(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]cos\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]sin\theta_d\\ sin(\theta_b-\theta_a-\theta_d) & cos(\theta_b-\theta_a-\theta_d) & -[(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]sin\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]cos\theta_d\\ 0 & 0 & 1\\ \end{bmatrix} \end{aligned} BAT=cos(θbθaθd)sin(θbθaθd)0sin(θbθaθd)cos(θbθaθd)0[(xbxa)cosθa+(ybya)sinθad]cosθd+[(xbxa)sinθa+(ybya)cosθa]sinθd[(xbxa)cosθa+(ybya)sinθad]sinθd+[(xbxa)sinθa+(ybya)cosθa]cosθd1
      位姿为: ( [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] c o s θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] s i n θ d , − [ ( x b − x a ) c o s θ a + ( y b − y a ) s i n θ a − d ] s i n θ d + [ − ( x b − x a ) s i n θ a + ( y b − y a ) c o s θ a ] c o s θ d , θ b − θ a − θ d ) ([(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]cos\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]sin\theta_d,-[(x_b-x_a)cos\theta_a+(y_b-y_a)sin\theta_a-d]sin\theta_d+[-(x_b-x_a)sin\theta_a+(y_b-y_a)cos\theta_a]cos\theta_d,\theta_b-\theta_a-\theta_d) ([(xbxa)cosθa+(ybya)sinθad]cosθd+[(xbxa)sinθa+(ybya)cosθa]sinθd,[(xbxa)cosθa+(ybya)sinθad]sinθd+[(xbxa)sinθa+(ybya)cosθa]cosθd,θbθaθd)

    这题需要知道转换矩阵可以是坐标系的描述,也可以表示主动变换和被动变换;这里可以发现,在二维平面中,角度直接加减就可,在上面的坐标系中也可以比较明显得看出来。

  2. 完成基础数学坐标转换的代码作业。(3 分)

    这题的原理比较简单,就是已知 A O T ^O_AT AOT B O T ^O_BT BOT ,求 A B T ^B_AT ABT A B T = O B T ⋅ A O T = B O T − 1 ⋅ A O T ^B_AT=^B_OT\cdot^O_AT=^O_BT^{-1}\cdot^O_AT ABT=OBTAOT=BOT1AOT

    // TODO 参照第一课PPT
    // start your code here (5~10 lines)
    Eigen::Matrix3d TOA;
    TOA << cos(A(2)), -sin(A(2)), A(0),sin(A(2)),  cos(A(2)), A(1),0,          0,        1;
    Eigen::Matrix3d TBA = TBO * TOA;
    cout << TBA << std::endl;
    BA << TBA(0, 2),TBA(1, 2),atan2(TBA(1, 0), TBA(0, 0));
    // end your code here
    

    运行结果为:

    $ ./basicTransformStudy 
    TBA:
    -1.83697e-16           -1            21 -1.83697e-16            10            0            1
    The right answer is BA: 2 1 1.5708
    Your answer is BA:      2      1 1.5708
    

    详见代码仓库。

这篇关于激光SLAM理论与实践 - 第六期 第1章 激光SLAM简介 作业与心得的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/742012

相关文章

Docker多阶段镜像构建与缓存利用性能优化实践指南

《Docker多阶段镜像构建与缓存利用性能优化实践指南》这篇文章将从原理层面深入解析Docker多阶段构建与缓存机制,结合实际项目示例,说明如何有效利用构建缓存,组织镜像层次,最大化提升构建速度并减少... 目录一、技术背景与应用场景二、核心原理深入分析三、关键 dockerfile 解读3.1 Docke

Spring Security简介、使用与最佳实践

《SpringSecurity简介、使用与最佳实践》SpringSecurity是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架,本文给大家介绍SpringSec... 目录一、如何理解 Spring Security?—— 核心思想二、如何在 Java 项目中使用?——

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

C++统计函数执行时间的最佳实践

《C++统计函数执行时间的最佳实践》在软件开发过程中,性能分析是优化程序的重要环节,了解函数的执行时间分布对于识别性能瓶颈至关重要,本文将分享一个C++函数执行时间统计工具,希望对大家有所帮助... 目录前言工具特性核心设计1. 数据结构设计2. 单例模式管理器3. RAII自动计时使用方法基本用法高级用法

PHP应用中处理限流和API节流的最佳实践

《PHP应用中处理限流和API节流的最佳实践》限流和API节流对于确保Web应用程序的可靠性、安全性和可扩展性至关重要,本文将详细介绍PHP应用中处理限流和API节流的最佳实践,下面就来和小编一起学习... 目录限流的重要性在 php 中实施限流的最佳实践使用集中式存储进行状态管理(如 Redis)采用滑动

ShardingProxy读写分离之原理、配置与实践过程

《ShardingProxy读写分离之原理、配置与实践过程》ShardingProxy是ApacheShardingSphere的数据库中间件,通过三层架构实现读写分离,解决高并发场景下数据库性能瓶... 目录一、ShardingProxy技术定位与读写分离核心价值1.1 技术定位1.2 读写分离核心价值二

深入浅出Spring中的@Autowired自动注入的工作原理及实践应用

《深入浅出Spring中的@Autowired自动注入的工作原理及实践应用》在Spring框架的学习旅程中,@Autowired无疑是一个高频出现却又让初学者头疼的注解,它看似简单,却蕴含着Sprin... 目录深入浅出Spring中的@Autowired:自动注入的奥秘什么是依赖注入?@Autowired

MySQL分库分表的实践示例

《MySQL分库分表的实践示例》MySQL分库分表适用于数据量大或并发压力高的场景,核心技术包括水平/垂直分片和分库,需应对分布式事务、跨库查询等挑战,通过中间件和解决方案实现,最佳实践为合理策略、备... 目录一、分库分表的触发条件1.1 数据量阈值1.2 并发压力二、分库分表的核心技术模块2.1 水平分

Java Stream 并行流简介、使用与注意事项小结

《JavaStream并行流简介、使用与注意事项小结》Java8并行流基于StreamAPI,利用多核CPU提升计算密集型任务效率,但需注意线程安全、顺序不确定及线程池管理,可通过自定义线程池与C... 目录1. 并行流简介​特点:​2. 并行流的简单使用​示例:并行流的基本使用​3. 配合自定义线程池​示

SpringBoot通过main方法启动web项目实践

《SpringBoot通过main方法启动web项目实践》SpringBoot通过SpringApplication.run()启动Web项目,自动推断应用类型,加载初始化器与监听器,配置Spring... 目录1. 启动入口:SpringApplication.run()2. SpringApplicat