树莓派3B+安装raspbian ros opencv笔记

https://blog.csdn.net/qq_35297619/article/details/75445896

安装opencv

https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/

启动BOOT相关知识

https://blog.csdn.net/gddxz_zhouhao/article/details/52919853

安装ros kinetic

ros wiki上只有raspbian jessie的,stretch按jessie的步骤安装

http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi

添加 ros repositories报错 no dirmngr,安装dirmngr

sudo apt install software-properties-common dirmngr然后继续

wstool init src kinetic-robot-wet.rosinstall报错

执行wstool update -j4 -t src再init

rosdep install -y --from-paths src --ignore-src --rosdistro kinetic -r --os=debian:jessie

jessie改为对应版本stretch

在编译时卡死,应该是默认swap空间设置过低,拓展swap空间:

第一步:选择在/opt/image中添加2G的swap交换文件

cd /opt

sudo mkdir image

sudo touch swap

第二步:添加交换文件并设置其大小为2G,使用如下命令

sudo dd if=/dev/zero of=/opt/image/swap bs=1024 count=1024000

等待...

第三步:创建(设置)交换空间,使用命令mkswap
sudo mkswap /opt/image/swap

Setting up swapspace version 1, size = 2 GiB (2097147904 bytes)

第四步:检查现有的交换空间大小,使用命令free
free -m

或者检查meminfo文件
grep SwapTotal  /proc/meminfo

第五步:启动新增加的2G的交换空间,使用命令swapon

sudo swapon /opt/image/swap

第六步:确认新增加的2G交换空间已经生效,使用命令free -m

或者检查meminfo文件
grep SwapTotal  /proc/meminfo

第七步:修改/etc/fstab文件,使得新加的2G交换空间在系统重新启动后自动生效
sudo vim /etc/fstab

在文件最后加入:
/opt/image/swap    /swap    swap    defaults 0 0

编译过程中,仍然可能遇到大文件时卡死或cmake报segment fault等情况,重启重新编译可以通过

安装VNC

https://blog.csdn.net/lu_embedded/article/details/50621203

x11vnc,可访问真实桌面x11,但是仍然不能显示raspistill的图像?

https://blog.csdn.net/tstarrow/article/details/38238203

使用树莓派摄像头

树莓派csi摄像头硬件安装:

https://linux.cn/article-3650-1.html

进入树莓派设置sudo raspi-config打开camera,enable后需要重启reboot

此时还没有/dev/video0.

raspicam有三个工具raspivid raspistill raspistillyuv,vid捕捉视频,yuv是still的raw版

raspistill是树莓派提供的捕获图像工具.raspistill --help

raspistill 常用参数:

-v:调试信息查看。
-w:图像宽度
-h:图像高度
-rot:图像旋转角度,只支持 0、90、180、270 度
-o:图像输出地址,例如image.jpg,如果文件名为“-”,将输出发送至标准输出设备
-t:获取图像前等待时间,默认为5000,即5秒
-tl:多久执行一次图像抓取。

各种参数使用:

https://blog.csdn.net/u013162035/article/details/78580486

找不到/dev/video0设备
树莓派中的camera module是放在/boot/目录下以固件的形式加载的,不是一个标准的v4l2的摄像头ko驱动,所以加载起来之后会找不到/dev/video0的设备节点,这是因为这个驱动是在底层的,v4l2这个驱动框架还没有加载,

所以要在配置文件,也就是 /etc/下面的modules-load.d / rpi-camera.conf (如果没有则新建文件,这个文件名可能不是叫modules-load.d/rpi-camera.conf,也有可能直接就是/etc/modules,)

打开文件在里面添加一行  
bcm2835-v4l2

这句话意思是在系统启动之后会加载这个文件中模块名,这个模块会在树莓派系统的/lib/modules/xxx/xxx/xxx下面,

添加之后重启系统,就会在/dev/下面发现video0设备节点了。

修改时间

设置时区

sudo raspi-config

然后localisation ... time zone...找到not above ...设置GMT +8 时区.这里有BUG,设置GMT-8时区实际才是+8时区

时间不准.安装ntp.同步时间

sudo apt-get install ntp

sudo ntpd -s -d

date查看时间和时区设置是否正确

sudo date  --s="2014-08-31 14:42:00"强制设置时间

sudo vim /etc/ntp.conf 在#server ntp.your.provider.example下添加时间同步服务器:

server ntp.fudan.edu.cn iburst perfer

server time.asia.apple.com iburst

server asia.pool.ntp.org iburst

server ntp.nict.jp iburst

server time.nist.gov iburst

修改国内更新源

源的文件

软件更新源 /etc/apt/sources.list

系统更新源 /etc/apt/sources.list.d/raspi.list

原来的源里已经有aliyun 清华等 ...

sources.list 添加 deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ stretch main contrib non-free$

raspi.list 添加 deb http://mirrors.ustc.edu.cn/archive.raspberrypi.org/debian/ stretch main ui

然后在 apt update. apt upgrade更新软件

无法输入#等

因为默认为英式键盘,应改为美式键盘,安装小企鹅输入法

sudo apt-get install fcitx

reboot

找到preferences-fcitx configuration,修改uk键盘为us键盘

修改用户名密码

sudo passwd

输入root密码

sudo passwd pi

安装raspbian

ubuntu mate有硬件或者软件驱动不行的问题,下载raspbian.img,win32 disk imager直接刻录在sd卡上即可进入系统 

 

安装ubuntu mate 16.04

1.格式化SD卡

2.下载ubuntu mate 16.04

3.使用win32 disk imager烧录系统

将下载的系统文件解压得到.img文件,需将该文件放在英文目录下,点Write按钮进行烧录

4.sd卡插入树莓派启动,彩虹屏无法进入系统.原因是官方ubuntu mate的镜像是使用树莓派2的uboot,不能在树莓派3B+上运行.

5.解决方法:sd卡插入读卡器,进入pi_boot盘,此处存放ubuntu引导文件,另外不能读的盘是ubuntu系统文件

    1、下载最新的树莓派官方Boot

    2、更改pi_boot中的config文件

    kernel = vmlinuz

    initramfs initrd.img followkernel

    #device_tree_address = 0x0200000

    3、替换pi_boot中的Boot文件 bootcode.bin fixup.dat start.elf

boot问题:

https://github.com/raspberrypi/firmware/commits/master?before=0b6fd4f1e887ad3883e139abe2ee114a7a8f82d5+35&path%5B%5D=boot

https://wiki.ubuntu.com/ARM/RaspberryPi#Booting_the_official_Pi_2_image_on_the_Pi_3B.2F3B.2B-

6.正常安装,安装完毕后配置网络

猜你喜欢

转载自blog.csdn.net/fantasysolo/article/details/82419807