无人驾驶(1)概览,(2)环境配置

视频:bilibili up: 啥都会一点的研究生

知乎:王博Kings

无人驾驶系列知识入门到提高

  • 总体概览
  • 软件环境

课程评价

  • 自动驾驶相关的代码只有ROS的一部分
  • 实战==掉包

[TOC]

1、总体概览

​ 跳转【】

2、软件环境

2.1 环境配置

2.2 ROS开发环境安装

  • Ubuntu16.04 X 安装

http://wiki.ros.org/cn/Installation/Ubuntu

1
2
3
4
5
6
7
8
9
10
11
1  sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

10 sudo apt update
11 sudo apt install ros-kinetic-desktop-full

20 source /opt/ros/kinetic/setup.bash

21 cat ~/.bashrc
23 sudo gedit ~/.bashrc
24 cat /opt/ros/kinetic/setup.zsh
25 history

2.3 IDE安装

Clion(收费)

​ snap install clion –classic

VSCode

2.4 工作目录创建

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mkdir –p ~/catkin_ws/src/
cd catkin_ws
catkin_make
(现在出现了build devel两个文件)
devel文件夹下面有一个setup.bash
把setup.bash路径添加到bashrc里
vi ~/.bashrc
末尾加:source /home/xxx/catkin_ws/devel/setup.bash
source ~/.bashrc

----------------
这时可以测试了
cd -
roscd
就又回来devel目录下面了

2.5 HelloWorld

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
----------------julay_say
# 创建 julay_say项目(依赖std_msgs, roscpp)
## 现在进入catkin_ws/src文件夹中
catkin_create_pkg julay_say std_msgs roscpp

## IDE coding
catkin_make
rosrun julay_say julay_say_node

----------------ros_core_node_topic
roscore # Ros master Start
rosnode info /
rosnode list
rostopic list
rostopic echo /kk_topic


----------------julay_listen
# 创建 julay_listen项目(依赖std_msgs, roscpp)
cd src/
catkin_create_pkg julay_listen std_msgs roscpp
## IDE coding
catkin_make
rosrun julay_listen julay_listen_node

IDE Procject Cmakelist.txt

1
find

SourceCode

/home/simon/catkin_ws/src/julay_say/src/julay_say_node.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>

int main(int argc, char ** argv )
{
ros::init(argc, argv, "kk_talker");
ros::NodeHandle n;
ros::Publisher kk_pub = n.advertise<std_msgs::String>("/kk_topic", 10); // cache 10
ros::Rate loop_rate(10);
int count = 0;

while(ros::ok())
{
std_msgs::String msg;
std::stringstream ss;
ss << "Hello KK " << count;
count ++;
msg.data = ss.str();

kk_pub.publish(msg);
loop_rate.sleep();

}
}

/home/simon/catkin_ws/src/julay_listen/src/julay_listen_node.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "ros/ros.h"
#include "std_msgs/String.h"

void julayCallback(const std_msgs::String::ConstPtr& msg){
ROS_INFO("I heard %s" , msg->data.c_str());
}

int main(int argc, char ** argv)
{
ros::init(argc, argv, "july_listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/kk_topic", 10, julayCallback);
ros::spin();
return 0;
}

2.6 custom MSG

julay_msgs

1
2
3
4
5
6
7
8
catkin_create_pkg julay_msgs std_msgs roscpp
# 创建 .msg文件
# 修改项目Cmakelist
# 修改package.xml
catkin_make
# 检查生成文件位置
ls catkin_ws/devel/include/julay_msgs
JulyMsg.h
msg/JulyMsg.msg

catkin_ws/src/julay_msgs/msg/JulyMsg.msg

1
2
string detail
int32 id
CmakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs message_generation
)

## Generate messages in the 'msg' folder
add_message_files(
DIRECTORY msg
FILES
JulyMsg.msg
)

## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
)
Package.xml
1
2
<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>

julay_say(Ros Param)

src/julay_say_node.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
#include "julay_msgs/JulyMsg.h"

int main(int argc, char ** argv )
{
ros::init(argc, argv, "kk_talker");
ros::NodeHandle n;
ros::Publisher kk_pub = n.advertise<std_msgs::String>("/kk_topic", 10); // cache 10
ros::Publisher kk_pub_new = n.advertise<julay_msgs::JulyMsg>("/kk_topic_new", 10);
ros::Rate loop_rate(10);
int count = 0;

while(ros::ok())
{
std_msgs::String msg;
std::stringstream ss;
ss << "Hello KK " << count;
count ++;
msg.data = ss.str();
kk_pub.publish(msg);

std::string param_string;
n.param<std::string>("myparam", param_string, "hi julay");

julay_msgs::JulyMsg julyMsg;
julyMsg.id = count;
julyMsg.detail = param_string; //"hello julay new";
kk_pub_new.publish(julyMsg);

loop_rate.sleep();

}
}
CmakeList
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
julay_msgs
)
catkin_package(
CATKIN_DEPENDS roscpp std_msgs julay_msgs
)
include_directories(
${catkin_INCLUDE_DIRS}
)
add_executable(${PROJECT_NAME}_node src/julay_say_node.cpp)
add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

target_link_libraries(${PROJECT_NAME}_node
${catkin_LIBRARIES}
)
Package.xml
1
2
<build_depend>julay_msgs</build_depend>
<exec_depend>julay_msgs</exec_depend>

RUN

1
2
3
4
roscore
rosrun julay_say julay_say_node
rostopic echo /kk_topic_new
rosparam set myparam "OK"

2.7 Decker

todo

3、感知基础

4、动态环境感知与2D检测

5、动态环境感知与3D检测

6、动态环境感知与跟踪

7、高精地图V2X HD MAP

8、无人车定位系统

9、预测系统

10、道路规划

11、控制理论

12、强化学习

系列大纲

王博Kings:无人驾驶系列知识入门到提高0-总体目录

王博Kings -无人驾驶系列知识入门到提高1–总体概述

王博Kings -无人驾驶系列知识入门到提高2–软件环境

王博Kings:无人驾驶系列知识入门到提高3–感知基础

王博Kings:无人驾驶系列知识入门到提高4–动态环境感知与2D检测

王博Kings:无人驾驶系列知识入门到提高5–动态环境感知与3D检测

王博Kings:无人驾驶系列知识入门到提高6-动态环境感知与跟踪

王博Kings:无人驾驶系列知识入门到提高7-高精度地图 V2X HD MAP

王博Kings:无人驾驶系列知识入门到提高8-无人车定位系统

王博Kings:无人驾驶系列知识入门到提高9-预测系统