LIMITI_SUMMER_CAMP_CV
github:GitHub - Zzzingzzz/LIMITI_SUMMER_CAMP_CV: 2023电子科技大学LIMITI机器人队夏令营视觉组线上学习内容
2023电子科技大学LIMITI机器人队夏令营视觉组线上学习内容,基于2022年视觉组经验编写
请参照mkd文件夹中夏令营培训文档依次学习
需要使用的设备:
- 电脑一台(
大家应该都有) - 摄像头一个,可以是如笔记本自带的摄像头,也可以是外接的usb摄像头,如果都没有可以使用手机摄像头
- CH340 USB转TTL模块两个,可以在淘宝上搜索购买,一个大概五六元
请夏令营开营前,务必完成夏令营培训1~4(直到滤波)的内容
前面4章的内容是实现视觉功能的基础
第5章PCL是使用激光雷达的基础,如果有想申请并使用激光雷达的同学可以进行学习
第6章ROS是一个机器人操作系统,有很多项目(不止于视觉、雷达有关的)依赖于该ROS的开发,故学习ROS可以更好的运用一些更新的项目功能
本次培训仅作为视觉的入门引导,帮助各位初步了解学习视觉组的功能。
夏令营培训1——配置部分
0. C++
请自行进行C++基础学习,特别如常用STL库和面向对象语法
Hello, World! - OI Wiki 这是C++的一些简单介绍
0.1. Markdown
下载阅读器阅读Markdown文件(推荐使用typora,注:typora最近开始收费,觉得不贵的可以支持一下,也可以找一个早期的免费版本)
简单学习Markdown编写的语法
1. Ubuntu
安装ubuntu操作系统,推荐安装版本20.04(或18.04)
- 学习目标:后续的学习均会基于ubuntu操作系统进行,需要简单了解一些终端的命令行操作等,ubuntu会有大量基于终端的操作,在后续使用学习中逐渐掌握
可以安装虚拟机,如果有后续想更进一步的学习推荐安装实体机(虚拟机最大的问题不能调用独显);如果有安装实体机、且有NVIDIA显卡的同学,可以再安装cuda和cudnn,方便后续调用独显加速运算
虚拟机推荐使用VMW
推荐安装时至少预留40GB,如果有后续想更进一步的学习推荐至少至少预留128GB,ubuntu系统想要扩容比较麻烦
设置密码时推荐设置一个简单的密码(如1这种),ubuntu系统需要频繁使用密码故设置简单点好
- 注:安装完ubuntu后,请更换国内镜像源,避免因墙难以下载东西,参考更换国内源
2. CMake
cmake的安装可以在更换完镜像源后直接使用命令行进行安装:
sudo apt-get install cmake cmake-gui
参考CMake_Practice.pdf (264.3 KB)学习CMake
- 学习目标:CMake只是辅助编译使用的工具,要求能看懂理解,并且能完成一些debug工作,打下一些基础不影响后续编译文件就行
学习完CMake后,请阅读以下CMake文件,若能基本理解即可进行后续的学习
后续的学习中,请均基于CMake编译运行文件
## 注:这份文件包含了一些我们机器人队常用的库
## 如:ZED——双目摄像头库 OpenCV——图像处理库 CUDA——显卡加速库 Threads——多线程库
## PCL——点云处理库 Slamtec——思岚雷达库
## 各位后续可以基于此CMake文件稍作修改作为自己的CMake文件使用,不需要重复造轮子
## 但是需要能根据自己编写的代码进行调整
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(lidar)
option(LINK_SHARED_ZED "Link with the ZED SDK shared executable" ON)
option(ENABLE_CUDA "" ON)
if (NOT LINK_SHARED_ZED AND MSVC)
message(FATAL_ERROR "LINK_SHARED_ZED OFF : ZED SDK static libraries not available on Windows")
endif()
SET(EXECUTABLE_OUTPUT_PATH ".")
SET(CUDA_NVCC_FLAGS -gencode arch=compute_53,code=sm_53)
set(CMAKE_CXX_FLAGS "-lstdc++ -pthread" )
#set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "-std=c++17 -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++17 -O3")
find_package(ZED 3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(CUDA 11.2)
find_package(Threads REQUIRED)
find_package(PCL 1.10 REQUIRED COMPONENTS common io visualization)
find_package(PCL 1.10 REQUIRED)
IF(NOT WIN32)
add_definitions(-Wno-format-extra-args)
SET(SPECIAL_OS_LIBS "pthread" "X11")
ENDIF()
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${PROJECT_SOURCE_DIR}/slamtec/include/)
include_directories(include)
link_directories(${ZED_LIBRARY_DIR})
link_directories(${CUDA_LIBRARY_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
link_directories(${PROJECT_SOURCE_DIR}/slamtec/share/)
add_definitions(${PCL_DEFINITIONS})
LIST(APPEND CUDA_NVCC_FLAGS -std=c++14;-O2)
LIST(APPEND CUDA_NVCC_FLAGS -Xcompiler;-fPIC)
SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_50,code=sm_50)
LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_60,code=sm_60)
FILE(GLOB_RECURSE SRC_FILES src/*.cpp)
FILE(GLOB_RECURSE HDR_FILES include/*.hpp)
CUDA_ADD_EXECUTABLE(r2 main.cpp ${HDR_FILES} ${SRC_FILES})
add_definitions(-std=c++14 -O2)
if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
else()
SET(ZED_LIBS ${ZED_STATIC_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_LIBRARY})
endif()
target_link_libraries(r2 ${ZED_LIBS})
target_link_libraries(r2 ${OpenCV_LIBS})
target_link_libraries(r2 Threads::Threads)
target_link_libraries(r2 ${PCL_LIBRARIES})
target_link_libraries(r2 ${PROJECT_SOURCE_DIR}/slamtec/share/libsl_lidar_sdk.a)
ubuntu20.04换国内源
Ubuntu默认的内置国外源,受到国外下载限制,下载速度较慢,因此需更换为国内源。
可能出现某些时候国内源仍有抽风的情况,如正在使用阿里源发现还是下载较慢,可以换清华源等多试试
更换源
打开源文件
sudo gedit /etc/apt/sources.list
将阿里源,清华源等源复制粘贴到该文件的开头
以阿里源为例
## 阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
更新源和软件
sudo apt-get update
sudo apt-get upgrade
完成
以下为常见的国内源
注意版本codename,检查版本codename: ==lsb_release -a==
ubuntu18.04的codename是bionic,ubuntu20.04的codename是focal
阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
网易163源
deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse