## UWB中TOF测距法的公式推导

#### UWB中TOF测距法的公式推导

UWB常用测距方法有两种：飞行时间测距法（TOF）和到达时间差法（TDOA）。这里说一下TOF。

#### TOF

TOF定位方式需要基站和标签往返通信，因此就造成了TOF功耗大大提高，续航时间相对较短.

TOF又分为两种：单边双向测距和双边双向测距。

#### 单边双向测距

$T_{prop} = \frac{1}{2}(T_{round}-T_{reply})$

$\hat{T}_{prop} = \frac{1}{2}[T_{round}(1+e_A)-T_{reply}(1+e_B)]$

$Error = \hat{T}_{prop} - T_{prop} = \frac{1}{2}(T_{round}\cdot e_A-T_{reply}\cdot e_B) = \frac{1}{2}T_{reply}(e_A-e_B) + T_{prop}\cdot e_A$

$Error = \hat{T}_{prop} - T_{prop} \approx \frac{1}{2}T_{reply}(e_A-e_B)$

#### 双边双向测距

$T_{prop} = \frac{1}{2}(T_{round1}-T_{reply1})$

$T_{prop} = \frac{1}{2}(T_{round2}-T_{reply2})$

\begin{flalign}T_{round1} \times T_{round2} = (2T_{prop}+T_{reply1})(2T_{prop}+T_{reply2}) = 4T_{prop}^2+2T_{prop}(T_{reply1}+T_{reply2})+T_{reply1}T_{reply2} \end{flalign}

\begin{flalign} T_{round1} \times T_{round2} - T_{reply1}T_{reply2} = 4T_{prop}^2+2T_{prop}(T_{reply1}+T_{reply2}) \\ = T_{prop}(4T_{prop}+2T_{reply1}+2T_{reply2}) \\ = T_{prop}(T_{round1} + T_{round2} + T_{reply1} + T_{reply2}) \end{flalign}

$T_{prop} = \frac{T_{round1} \times T_{round2} - T_{reply1} \times T_{reply2}}{T_{round1} + T_{round2} + T_{reply1} + T_{reply2}}$

\begin{flalign} \hat{T}_{prop} = \frac{T_{round1}(1+e_A) \times T_{round2}(1+e_B) - T_{reply1}(1+e_B) \times T_{reply2}(1+e_A)}{T_{round1}(1+e_A) + T_{round2}(1+e_B) + T_{reply1}(1+e_B) + T_{reply2}(1+e_A)} \\ = \frac{(4T_{prop}^2+2T_{prop}(T_{reply1}+T_{reply2}))(1+e_A)(1+e_B)} {4T_{prop}+2(T_{reply1}+T_{reply2})+(2T_{prop}+T_{reply1}+T_{reply2})(e_A+e_B)}\\ =\frac{2(1+e_A)(1+e_B)}{(1+e_A)+(1+e_B)}T_{prop} \end{flalign}

$T_{prop} = \frac{(1+e_A)+(1+e_B)}{2(1+e_A)(1+e_B)}\hat{T}_{prop}$

\begin{flalign} Error = \hat{T}_{prop} - T_{prop} = \left(1-\frac{(1+e_A)+(1+e_B)}{2(1+e_A)(1+e_B)}\right)\hat{T}_{prop} \\ = \frac{e_A+e_B+2e_A e_B}{2(1+e_A)(1+e_B)}\hat{T}_{prop} \end{flalign}

$Error \approx \frac{e_A+e_B}{2}\hat{T}_{prop}$

$T_{prop} = \frac{1}{4}(T_{round1}-T_{reply1}+T_{round2}-T_{reply2})$

\begin{flalign} \hat{T}_{prop} = \frac{1}{4}\left[T_{round1}(1+e_A)-T_{reply1}(1+e_B)+T_{round2}(1+e_B)-T_{reply2}(1+e_A)\right] \end{flalign}

\begin{flalign} Error = \hat{T}_{prop} - T_{prop} = \frac{1}{4}\left[(T_{round1}-T_{reply2})e_A +(T_{round2}-T_{reply1})e_B\right] \\ =\frac{1}{4}\left[2(e_A+e_B)T_{prop} +(e_A-e_B)(T_{reply1}-T_{reply2})\right] \end{flalign}

$Error \approx \frac{1}{4}(e_A-e_B)(T_{reply1}-T_{reply2})$

## 使用SSH Key访问服务器

#### 2. 使用 ssh-copy-id

• server：服务器的域名或者 ip 地址
• ~/.ssh/id_rsa.pub：默认的公钥地址，如果修改过 SSH Key 存储地址，请填写对应地址

## ubuntu 22.04 WARNING: [pool ***] server reached max_children, consider raising it

If you encounter such an error in the php logs, then it is time to modify max_children. The php logs are usually located in /var/log/,  and in my case they are in /var/log/php7.4-fpm.log

Search for the file where the max_children variable is located, in my case the file is www.conf and is located in the folder: /etc/php/7.4/fpm/pool.d/

Change the value pm.max_children = 8 to a larger one, 16 for example

save the .conf file and restart the web server:

or only the php-fpm service as follows:

Eventually you can check these logs, who knows, you may not even know you have such a problem!

** As I noticed, for HestiaCP (VestaCP) users max_children can be found in both the /etc/php/7.4/fpm/pool.d/www.conf file and the file /usr/local/hestia/php/etc/php-fpm.conf

** Attention, you must also have enough memory for this, otherwise the results are not as expected!

Check the memory used by each php-fpm service-child with the following command:

Then, to see the memory required for these processes, we need to add the rss parameter which is “Resident Set Size” or the physical memory. Note: Modify php-fpm7.4 to suit your version of PHP:

These numbers are in Kbytes , so we calculate an average of the displayed values and multiply by max_children, and we find approximately the memory needed only for php, but don’t forget, the server also needs memory for Apache, Nginx, mysql … maybe Varnish, HAproxy, Redish, etc. .. so, check these values carefully!

#### 参考链接

Solved! WARNING: [pool ***] server reached max_children, consider raising it

## ubuntu 22.04 Warning: apt-key is deprecated

#### 参考链接

Warning: apt-key is deprecated (SOLVED)

## ubuntu 22.04系统Docker和Nvidia-docker的安装、测试，及运行GUI应用

Docker文档：https://docs.docker.com/，Docker安装指南： Install Docker Engine on Ubuntu

Dokcer安装

Docker测试

Tips：Docker中一般Crtl+C退出，传送门：停止、删除所有的 docker 容器和镜像

Nvidia-docker安装

Github：NVIDIA/nvidia-docker

Docker 容器 GUI

Docker: gazebo: cannot connect to X server

## 使用 dart extension

#### 如何使用

dart extension 的使用场景是无法修改原类的时候，通过扩展的方式来增加原类的方法，也可以增加 getter，setters，and operators。

#### 要注意的问题

dart extension 不可以用于 dynamic 类型

dart extension 权限很大，这也意味着，很可能被过度使用。所以在使用的时候一定要再三权衡，一定要可读性，可维护性优先。

## 智能硬件Nvidia Jetson Nano B01

#### 产品参数

GPU 128-core Maxwell Quad-core ARM A57 @ 1.43 GHz 4 GB 64-bit LPDDR4 25.6 GB/s micro SD 卡 4K @ 30   |   4x 1080p @ 30   |   9x 720p @ 30 (H.264/H.265) 4K @ 60   |   2x 4K @ 30   |   8x 1080p @ 30   |   18x 720p @ 30 (H.264/H.265) 2x MIPI CSI-2 D-PHY lanes 千兆以太网，M.2 Key E 接口外扩 (可外接： AC8265 双模网卡 ) HDMI 和 DP 显示接口 4x USB 3.0，USB 2.0 Micro-B GPIO，I2C，I2S，SPI，UART 260-pin 连接器

#### Jetson Nano系统安装

1、JetPack介绍

JetPack SDK包括最新的Linux驱动程序包(L4T)，带有Linux操作系统和CUDA-X加速库，以及用于深度学习、计算机视觉、加速计算和多媒体的API。 它还包括用于主机和开发人员套件的示例、文档和开发人员工具，并支持更高级别的SDK，例如用于流式视频分析的DeepStream和用于机器人的Isaac。

2、JetPack 4.4

JetPack 目前最新版本是4.4，支持Vulkan 1.2、TensorRT 7.1.3 、cuDNN 8.0、CUDA 10.2 等。

3、下载和安装

• 下载 Jetson Nano镜像，镜像中包含提供引导加载程序、Ubuntu18.04、必要的固件、NVIDIA驱动程序、示例文件系统等。
• 使用 Etcher 或者 Raspberry Pi Imager 将镜像烧录到SD卡（建议至少32G）中。

1.执行更新

2.安装vino服务端

3.开启VNC 服务

4.配置VNC服务

#### 设置开机自启动

1.创建VNC自动启动文件

2.添加以下内容到vino-server.desktop文件中

## 解决 Only fullscreen opaque activities can request orientation

#### 问题分析

targetSDKVersion为26或者27时，在 Android 8.0 的设备上，一些设置了windowIsTranslucent标志，将背景设为透明，同事将屏幕方向锁定的Activity，会崩溃并抛出这个异常:

#### 解决方案

1. 降级targetSDKVersion到26以下(废话！！)

2. 移除mainfest文件里的screenOrientation属性

3. 取消Activity主题里的windowIsTranslucent属性或者windowSwipeToDismiss属性或者windowIsFloating属性（根据你设置了什么属性来具体分析）

4. （推荐）移除manifest文件里的screenOrientation属性，并在ActivityonCreate方法里设置屏幕方向