下载emacs 29.1

  • gi t clone的方式,需要autogen一下

install dependencies

树莓派源

cat /etc/apt/sources.list

1
2
deb http://mirrors.aliyun.com/raspbian/raspbian/ bullseye  main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ bullseye main non-free contrib rpi

安装emacs依赖

1
sudo apt install libxpm-dev libgif-dev libgnutls28-dev libgtk-3-dev libjpeg-dev libtiff-dev libncurses-dev libgccjit-10-dev

编译

1
2
3
./configure --with-native-compilation
make -j
sudo make install

树莓派小电台

参考炬峰的视频,来搞个电台玩玩。

r pi t x

1
2
3
4
5
6
7
8
git clone https://github.com/F5OEO/rpitx
cd rpitx
./install.sh

sudo reboot

cd rpitx
./easytest.sh # FmRds

windows安装SDR软件

  • 淘宝买一个软件无线电R820T2+RTL2832U
  • 下载地址

树莓派设置

audio输入输出设置

  • Audio Inputs - USB Audio Device
  • Audio Outputs - Analog

验证输入输出

1
arecord -f cd - | aplay -V sterio -

修改testfmrds.sh脚本

1
sudo arecord -f cd -D plughw:2,0 -c 2 - | sudo ./pifmrds -freq "$1" -audio -

修改/boot/config.txt

1
2
# Enable audio (loads snd_bcm2835)
dtparam=audio=off

测试

1
./testfmrds.sh 434

rplidar

build on the pi and dev machine

1
2
3
4
5
6
cd ~/code/dep_ws/src
git clone https://github.com/Slamtec/sllidar_ros2.git
cd ..
colcon build --symlink-install
source install/setup.bash
ros2 launch sllidar_ros2 view_sllidar_launch.py

for normal rplidar

1
sudo apt install ros-foxy-rplidar-ros

enable image

flowchart
    A[Driver Node] ---> B["/image_raw
    sensor_msgs/Image"] ---> C[Algorithms & Stuff]
    E["/image_raw/compressed
    sensor_msgs/CompressedImage"]
    B <-- image_transport_library/nodes --> E

install dependencies

on the dev machine

1
2
sudo apt-get install ros-foxy-v4l2-camera
sudo apt install ros-foxy-rqt-image-view

on the pi, add start_x=1 to /boot/firmware/config.txt

1
2
3
4
5
6
7
8
9
sudo apt install libtheora-dev libogg-dev v4l-utils
cd ~/code/dev_dep/src
git clone -b foxy https://gitlab.com/boldhearts/ros2_v4l2_camera.git
git clone https://github.com/ros-perception/image_transport_plugins.git -b foxy-devel
git clone https://github.com/ros-perception/image_common.git -b foxy
git clone https://github.com/ros-perception/vision_opencv.git -b foxy
git clone https://github.com/ros-drivers/usb_cam.git -b ros2
cd ..
colcon build --symlink-install

Launch the camera

1
2
3
cd ~/code/dev_ws
source install/setup.bash
ros2 launch articubot_one camera.launch.py

on the dev machine

1
2
3
4
cd ~/code/dev_ws
source install/setup.bash
rviz2 -d src/articubot_one/config/main.rviz
ros2 run rqt_image_view rqt_image_view

ros2 flow

stateDiagram-v2
    Command_Velocity --> Diff_Dirve_Controller
    state ros2_control {
        Diff_Dirve_Controller --> Hardware_interface: Req. Motor Velocities Velocity Cmd Interfaces
        Controller_Manager
        Hardware_interface --> Joint_State_Broadcaster: Encoder position state
    }
    Hardware_interface --> Car
    Joint_State_Broadcaster --> /joint_states
    /joint_states --> Off_to_robot_state_publisher

install packages

install ros2 controll

要注意的是如果ubuntu20.04都是源码编译ros,需要跳过这一步,因为会失败。总之我是通过源码编译的,因为树莓派在20.04系统64位的暂时没法烧录成功。

1
sudo apt install ros-foxy-ros2-control ros-foxy-ros2-controllers ros-foxy-xacro

需要从这里开始源码编译。

1
2
3
4
5
6
7
8
9
git clone https://github.com/ros/angles.git -b foxy-devel
git clone -b ros2 https://github.com/ros-drivers/ackermann_msgs.git
git clone https://github.com/ros-controls/control_toolbox.git -b foxy
git clone https://github.com/ros-controls/realtime_tools.git -b foxy-devel
git clone https://github.com/ros-controls/control_msgs.git -b foxy-devel
git clone https://github.com/ros-controls/ros2_controllers.git -b foxy
git clone https://github.com/ros-controls/ros2_control.git -b foxy
git clone https://github.com/ros/xacro.git
git checkout 2.0.7

~/.bashrc

1
2
source ~/ros2_foxy/ros2-linux/setup.bash
source /opt/ros/foxy/setup.bash

install joystick test

1
2
3
sudo apt install ros-foxy-joy joystick jstest-gtk evtest
evtest
jstest-gtk

install libserial

1
sudo apt install libserial-dev

joystick flow

stateDiagram-v2
    [*] --> Linux_Joystick_Driver
    Linux_Joystick_Driver --> Joy_Node
    Joy_Node --> /Joy
    /Joy --> /Other_Nodes
    /Other_Nodes --> /whatever
    /Joy --> e.g.teleop_twist_joy
    e.g.teleop_twist_joy --> /cmd_vel

ros2 joy

1
2
3
ros2 run joy joy_enumerate_devices
ros2 run joy joy_node
ros2 topic echo /joy

dev_ws

1
2
3
4
5
6
7
8
9
10
11
mkdir ~/code/dev_ws
mkdir src && cd src
git clone https://github.com/joshnewans/joy_tester
git clone https://github.com/joshnewans/diffdrive_arduino
git clone https://github.com/joshnewans/articubot_one
git checkout 174b3f31
git clone https://github.com/joshnewans/serial
git clone https://github.com/joshnewans/teleop_twist_joy
colcon build --symlink-install
source install/setup.bash
ros2 run joy_tester test_joy

config/my_controllers.yaml

1
2
wheel_separation: 0.177
wheel_radius: 0.042

description/ros2_control.xacro

1
<param name="enc_counts_per_rev">1321</param>

端午节到了,👨👩带我和妹妹一起去朱家尖。到了以后,我们在楼下的🍴里吃饭。吃完饭我们在酒店里睡觉。睡觉起来以后,我们一起到🏖️堆起了沙堡。第一步我先画好了我们的地盘。第二步,我们挖出了一条护城河。👨拿着大铲子,挖出了很深的一个坑。我想到了一个好主意,我把👨挖出来的土,都放在地盘的边缘上。第三步,我叫妹妹拿着🪣,打好多水倒进护城河里,我叫妈妈把这些泥土弄结实。而我把所有的泥土都弄到边线上。

后来我拿着大耙子,画出了一条护城河的边缘,然后我拿了一个小🔧,帮👨一起挖护城河。挖了一半,我感觉水不太够了。我和妹妹赶紧跑到海边,拿小🪣灌了一大桶水。我们赶紧跑回来,把水洒在护城河里。然后我赶紧拿起小工具继续挖呀挖。我们挖呀挖,挖呀挖,堆呀堆,堆呀堆,堆好了大半个沙堡。水又不够了,我和妹妹赶紧跑到海边,拿起水桶,刚准备灌水,忽然一阵🌊飘来,我和妹妹一起把水都给接了过来。我和妹妹大喊起来:“爸爸妈妈,马上就要涨潮啦!”我和妹妹急忙提起🪣,跑了回去。我们几个赶紧搭呀搭,搭呀搭,快速地搭了起来。只剩最后一点了,我们几个飞快地搭了起来。终于搭完了,只剩最后一个,就是挖护城河。我和妹妹赶紧来到海边,拿起🪣,这是又有一阵🌊飘来了。我和妹妹跑了回来,刚好👨👩挖好了护城河。我和妹妹把水都洒了进去。天色已经差不多了,我们也该吃饭了。我们到了🏨楼下,开始吃饭。吃完饭,我们准备去🚶‍♀️。

沙堡

🚶‍♀️的时候,我们走到了隔壁一家🏨里,到了那边,我看见了三只🐱。第一只🐱叫做“🍮”,第二只🐱叫做“咪咪”,第三只🐱叫做“小小”。那三只🐱真的好可爱。那三只🐱颜色各不相同。🍮的颜色是黑白相间的,咪咪的颜色是灰白色的,小小的颜色是跟🍮一样,是黑白相间的。🍮它喜欢吃猫粮和鱼条。咪咪喜欢吃狗尾巴草。小小它喜欢吃猫粮。我们跟🐱拜拜了以后就去🏨睡觉了。

咪咪

第二天,我们先到楼下吃了早饭。早饭非常丰富,有🍜,炒粉,粽子,还有好多好多好吃的。吃完早饭,我们去看了🐱。只看到了咪咪,剩下的🐱全没有看到。我们给咪咪喂了好多好多的草。后来我在那边知道,咪咪抓过很多很多的🐭。因为没有看到其他的🐱,所以👩带我们到海边去挖沙了。👩在旁边的🪨上,抓到了一只小🦀️。我和妹妹把沙子放在磨具里,做出了好多个冰淇凌。我们还在旁边堆了个小山,也就是沙子山。

到了中午,我们一起去吃完了午饭。吃完午饭,我们到🛏️准备睡觉。妹妹在🛏️唱了一首“找朋友”,找呀找呀找画人,找到一个画画人,敬个礼呀握握手,你是我滴画画人。起床了以后,我在楼下写作业,妹妹在旁边吵吵闹闹地玩。写完作业,我们一起玩,然后等雨停了,我们又来到了海边。我跟妹妹在旁边挖了一个大水坑。我和妹妹一起把水给填满,我和妹妹在水坑里蹦来蹦去,跳来跳去。

果果跳泥坑
可可跳泥坑

到了🌃,我们在旁边的店里吃了一顿晚餐。👩点了🦪,🐙,🐚,海瓜子,扇贝。我还喝了北冰洋,可乐。👨喝了🍺,杨梅酒。

我们吃完饭,回到家,躺在🛏️就睡着了。

第三天,我们刚起床,外面就哗哗哗地下了大雨,我发现了一句👩‍🏫叫我们的谚语:“有雨山戴帽,无雨半山腰”。我们准备回家了。我们告别了大海、🏖️,还有小🦀️,🐱。我们来到🚗上,高兴地回到了🏠。

真是一个快乐的端午啊!下一次🤷‍♀️👨👩还会带我们去哪里⛱️。我相信下次还会带我们去更好的地方玩!

Prepare the repo

1
2
3
4
cd ~/code
git clone https://github.com/joshnewans/serial_motor_demo.git
cd serial_motor_demo
colcon build --symlink-install

Client gui at the ubuntu22

1
2
source install/setup.bash
ros2 run serial_motor_demo gui

run at the pi

1
2
source install/setup.bash
ros2 run serial_motor_demo driver --ros-args -p serial_port:=/dev/ttyUSB0 -p baud_rate:=57600 -p loop_rate:=30 -p encoder_cpr:=1321

Build the motor

motor

Assemble the car

car v0.1
car v0.2

网络搭建

首先配置raspberry pi和ubuntu 20.04(开发机)到一个网络,建议买一个GL-MT300N-V2,然后把两台ip都配置到192.168.3.*

1
2
192.168.3.119 pi
192.168.3.120 robot

robot is the dev machine, and pi is my raspberry pi.

config /etc/netplan/50-cloud-init.yaml on dev machine.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
network:
version: 2
ethernets:
renderer: networkd
enp0s5:
dhcp4: no
addresses:
- 192.168.3.120/24
routes:
- to: default
via: 192.168.3.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
optional: true

ubuntu server 20.04 connect to wifi

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
network:
version: 2
ethernets:
eth0:
dhcp4: true
optional: true
wifis:
renderer: networkd
wlan0:
dhcp4: no
addresses:
- 192.168.3.119/24
routes:
- to: default
via: 192.168.3.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
access-points:
"gl":
password: "4da86c9782081b654f1cca03590bebf374da6084aad4c2e471aa99cdb33a144f"
optional: true

树莓派(Raspberry Pi) 设置静态IP/连接Wi-Fi

安装ros2相关工具

目前humble有点问题,所以装foxy,可以的镜像是ubuntu-20.04.5-preinstalled-server-armhf+raspi.img.xz

初始化项目

登录开发机。

1
2
3
4
5
mkdir ~/code/dev_ws/src -p
cd ~/code/dev_ws/src
git clone git@github.com:joshnewans/my_bot.git
cd ..
colcon build --symlink-install

launch

1
2
3
cd ~/code/dev_ws/
source install/setup.bash
ros2 launch my_bot rsp.launch.py

今天我们去湖州玩,我们一👀,哇是农村。一进酒店我和妹妹就开心地在楼下玩了起来。玩了一会,我们就去吃中饭。我尝了一口饭,好美味啊。吃完了午饭,我们就去外公、外婆的房间里去👀了👀。看完了,我该回自己房间去了,妹妹在外公外婆的房间里睡觉了。

我和👨👩一起去了一个地方,那边有一个小咖啡馆,然后👨👩就去买了两杯咖啡,而我却买了一根棒冰吃了起来。我坐在一个位置上👀起了书,👨也👀起了书,👩👀起了电视剧。我把书看完了,👨给我了一张纸,我开始画起了画。我画的画就是一个参加下午茶话会的人,我画完了妈妈就带我去旁边的一个地方逛了逛。回到酒店,就开始了茶话会。

👨👩,外公、外婆在打牌,而我和妹妹在沙发上玩管宝宝的游戏。玩好我们就去吃晚饭。到了睡觉时间,妹妹哭了很久,因为她想要外公来陪她睡觉。过了一会她就不哭了,因为看了小🐷佩奇。

第二天早上,我们吃完了早饭,妈妈提议,我们今天去🧗‍♀️吧。我高兴地说,好。于是我们就去🧗‍♀️了。⛰️上有好多好多的竹子。我和👩一路上都在剥竹皮。爬到一半,妹妹先和外公外婆下山了。而我、👨👩却一直往上爬。我们爬到了“点兵台”,那里有一个亭子,我们坐在里面休息了一会。来了一个🧍‍♂️和🧍‍♀️。👩和他们聊了一会天,那个🧍‍♀️说她在上面看到了一条🐍,被🐍吓到了,所以就没有继续往上爬,就下来来到了“点兵台”。🧍‍♀️拿了一根棒子,她把那根棒子给我,说这个棒子可以用来当拐杖。我也被🐍吓到了,所以赶紧拉着爸爸妈妈往下跑。

我们刚回到酒店,就吃了中饭。吃完中饭,就回去休息了一会。妹妹起床了,我和妹妹就在楼下客厅里,找个一个休闲的榻榻米。我们就在里面玩起了妈妈宝宝的游戏。等太阳快落山的时候,我、👨👩和妹妹一起去早晨去的一个路上,那边有很多的溪水。我们找到了一个地方开始玩水。而妈妈却在旁边的桥上摘了很多很多的野草莓,准备带回去给我们吃。我们回去了,👩把野草莓给我们每人分了好多。吃完野草莓,我和妹妹到外公外婆的房间边上的大蹦床,我和妹妹玩起了一个蹦床游戏,名字叫做“🐰蹦蹦跳跑”。玩了一会就到了吃饭时间,我们吃完了晚饭,就到旁边的游客栈道散步。我摘了一朵🌻和一片银杏叶。过了一会我们就回来了,然后就睡觉去了。

第三天早上,我们还是同样吃了早饭,吃完了早饭,我和妹妹又到楼下的休闲的榻榻米上玩起了👩👶游戏。玩了一会之后,我和妹妹就去蹦蹦床了。我们还是同样玩起了蹦蹦床的游戏。那个游戏就是“🐰蹦蹦跳跑”。玩好了一会,妈妈就去退房了。可是我们退完房的时候,我和外公外婆说了一声再见,因为他们要去其他地方吃中饭,先走了。我和妹妹又到了休闲的榻榻米,玩起了👩👶的游戏。过了一会,我们也要走了,我们理好了行李,带好了自己所需的东西,上了🚗。我特别的高兴,对👩说:“妈妈,这个农村真好玩,到了暑假的时候,我还要来玩!”我跟老板娘说了一声“再见”,我们就坐着🚗走了。

这次去农村,可是玩了三天,真好玩啊!我不知道下次还会去哪里,比这个更好玩,不过我觉得下一个假期,也就是暑假了,我说过暑假的时候还要来,我感觉下次的旅途还来这里,如果是新的么,我就🤷‍♀️了。这次的旅途可真愉快,我好高兴呀,这一次是五一劳动节噢!

下面我们来构造第一个半导体应用,二极管,只需要把n-type和p-type连接起来即可,是不是很简单。只有简单的基础件,才能更好的“集成”。

depletion region1

When the p-type and the n-type materials are kept in contact with each other, the junction between them behaves differently from either side of the material alone. The electrons and holes are close to each other at the junction. According to coulomb’s law, there is a force between the negative electrons and the positive holes. When the p-n junction is formed a few electrons from the n-type diffuse through the junction and combines with the holes in the p-side to form negative ions and leaves behind positive ions in the n-side. This results in the formation of the depletion layer, which acts as the barrier and does not allow any further flow of electrons from the n region to the p region.

No Applied Bias(V = 0V)

no-bias

在没有外部电压的情况下,depletion region正常存在。n type这边主要载流子是电子,但是如果要流向p type,需要克服正电子的吸引,所以只有一小部分能够过去,这个数量和从p type流过来的电子(少数载流子)数目接近,也就是图12 c 左上的和右下的正好差不多抵消。同理两个也差不多。所以总体电流为0。

In the absence of an applied bias across a semiconductor diode, the net flow of charge in one direction is zero.

Reverse-Bias Condition()

reverse-bias

在反向电压的情况下,n type里面的电子会被“抽走”,所以原来图12 c右下的向右的会几乎为0。depletion region会加厚。p type的不会有影响,所以存在的电流就是 Minority-carrier flow.

The current that exists under reverse-bias conditions is called the reverse saturation current and is represented by .

Foward-Bias Condition()

foward-bias

当正向电压的时候,首先depletion region会变薄,因为n type这边会有大量电子注入,重新和正电子结合,p type的电子会被“抽走”。当电压加到一定程度,突然大量电子从n涌入p,图12 c 右下的是会不断增大。

  • is the reverse saturation current
  • is the applied forward-bias voltage across the diode
  • n is an ideality factor, which is a function of the operating conditions and physical construction; it has a range between 1 and 2 depending on a wide variety of factors (n =1 will be assumed throughout this text unless otherwise noted).

  • k is Boltzmann’s constant =
  • is the absolute temperature in kelvins = 273 + the temperature in
  • q is the magnitude of electronic charge =
diode-characteristics

虚线是理想的曲线,实现是实际的情况。

The actual reverse saturation current of a commercially available diode will normally be measurably larger than that appearing as the reverse saturation current in Shockley’s equation.

反向的饱和电流实际会在理想的下方,主要原因是:

  • – leakage currents

  • – generation of carriers in the depletion region

  • – higher doping levels that result in increased levels of reverse current

  • – sensitivity to the intrinsic level of carriers in the component materials by a squared

    factor—double the intrinsic level, and the contribution to the reverse current could

    increase by a factor of four.

  • – a direct relationship with the junction area—double the area of the junction, and

    the contribution to the reverse current could double. High-power devices that have

    larger junction areas typically have much higher levels of reverse current.

  • – temperature sensitivity—for every 5°C increase in current, the level of reverse sat- uration current in Eq. 1 will double, whereas a 10°C increase in current will result in

    doubling of the actual reverse current of a diode.

0%