双目
代表:图漾, Astro Dabai, ZED
结构光
代表: OAK, 奥比中光, Realsense
统一的代码规范对于整个团队来说十分重要,通过git/svn在提交前进行统一的 ClangFormat 格式化,可以有效避免由于人工操作带来的代码格式问题。1
2
3
4
5
6
7// 以 LLVM 代码风格格式化main.cpp, 结果输出到 stdout
clang-format -style=LLVM main.cpp
// 以 LLVM 风格格式化 main.cpp, 结果直接写到 main.cpp
clang-format -style=LLVM -i main.cpp
// 以 Google 风格格式化 main.cpp, 结果直接写到 main.cpp
clang-format -style=google -i main.cpp
除了LLVM
和Google
外,还有 Chromium, Mozilla, WebKit
find . -path '*/src/*.cpp' -o -path '*/include/*.h' ! -name 'sigslot.h' | xargs clang-format -style=file -i
在使用时,出现一个奇怪的bug,clang-format
把我修改的文件的所有者都改成了root,再修改时还得先把用户改回来,极其不方便,不过我是在VMware里遇到的bug
安装 colcon : sudo apt install python3-colcon-common-extensions
colcon build 编译所有包
colcon build —packages-select pkg 只编译一个包
colcon build —cmake-args -DCMAKE_BUILD_TYPE=Release
不编译测试单元
colcon test--packages-select YOUR_PKG_NAME--cmake-args -DBUILD_TESTING=0
colcon test
colcon build --symlink-install
colcon build —symlink-install pkg
colcon build —symlink-install —packages-ignore pkg
ROS2的build没有了ROS1中的devel概念
可以使用以下JSON格式的示例进行配置:1
2
3
4
5
6
7
8
9{
"search.exclude": {
"**/node_modules": true,
"**/build": true,
"**/dist": true,
"**/.git": true,
"**/.vscode": true
}
}
上面的示例中,我们配置了五个排除规则:
"**/node_modules"
: true - 这将排除项目中的node_modules文件夹,通常包含依赖库。
"**/build": true
- 这将排除build文件夹,如果您的项目使用构建工具生成构建文件,可以排除它。
"**/dist": true
- 这将排除dist文件夹,如果您的项目包含编译后的分发文件,可以排除它。
"**/.git": true
- 这将排除.git文件夹,以防止搜索Git版本控制文件。
"**/.vscode": true
- 这将排除.vscode文件夹,以防止搜索Visual Studio Code配置文件。
VS Code 按快捷键 ctrl+p
可以弹出一个小窗,在上面的 输入框输入文件名,下拉框点击一个文件
设置VsCode 多文件分行(栏)排列显示,打开vscode的设置,搜索wrap tabs,勾选上就可以了
修改鼠标滚轮效果: VSCode 设置页面搜索 mouseWheelScrollSensitivity
,放大前两个系数
只记录ROS2 和 ROS1 不同的命令
1 | # 列出某个包的所有可执行文件 |
现在必须加/
了1
2
3
4
5
6
7user :~$ ros2 topic info imu
Unknown topic 'imu'
user :~$ ros2 topic info /imu
Type: sensor_msgs/msg/Imu
Publisher count: 1
Subscription count: 1
1 | Type: nav_msgs/msg/Odometry |
显示 Topic 发送的消息定义 ros2 interface show sensor_msgs/msg/Imu
获知某个消息类型是谁在用1
2user :~$ ros2 topic find sensor_msgs/msg/Imu
/imu
1 | ros2 topic pub /chatter std_msgs/msg/String 'data:"123" |
分类显示消息、动作、服务的所有类型
1 | userinterface package action_msgs :~$ ros2 |
获知某个消息类型是谁在用,可以这样查1
2
3
4
5
6
7
8userinterface packages | grep pendulum_msgs :~$ ros2
pendulum_msgs
user@robot:~$ ros2 interface package pendulum_msgs
pendulum_msgs/msg/RttestResults
pendulum_msgs/msg/JointState
pendulum_msgs/msg/JointCommand
user@robot:~$ ros2 topic find pendulum_msgs/msg/RttestResults
1 | userinterface proto std_msgs/msg/String :~$ ros2 |
可以看到服务的定义。
找出指定类型的所有服务
ros2 service find std_srvs/srv/Empty
ros2 interface show
显示服务的定义
1 | ros2 param describe /turtlesim background_r |
1 | ros2 param get /turtlesim background_r |
ros2 param set (省略)
ros2 run + param
ros2 run
rqt_graph
能够可视化节点和主题之间的连接。这个命令和ROS1一样,也是ROS2为数不多的GUI可视界面
ros2 run tf2_tools view_frames.py
ros2 run tf2_ros static_transform_publisher 1 2 3 0.5 0.1 -1.0 foo bar
ros2 run tf2_ros tf2_echo foo bar
运行结果:1
2
3
4
5
6
7
8
9
10At time 197.27000000
- Translation: [0.008, -0.000, 0.064]
- Rotation: in Quaternion [-0.000, -0.001, -0.010, 1.000]
- Rotation: in RPY (radian) [-0.000, -0.002, -0.020]
- Rotation: in RPY (degree) [-0.001, -0.092, -1.160]
- Matrix:
1.000 0.020 -0.002 0.008
-0.020 1.000 0.000 -0.000
0.002 -0.000 1.000 0.064
0.000 0.000 0.000 1.000
用GIMP等工具来进行地图的常规清理和编辑是一项费时费力的任务,为了解决这种情况,项目ros_map_editor提供一个强大而灵活的工具,使机器人领域的从业者和研究人员能够更轻松地编辑导航地图,以满足他们的特定碧求。
特点:
ros map editor
进行地图清理更加高效ubuntu 20.04 编译 opencv3.2 相关问题 1
ubuntu 20.04 编译 opencv3.2 相关问题 2
ubuntu 20.04 编译 opencv3.2 相关问题 3
编译OpenCV 3.2 出现 #include_next
ROS编译时报错Project ‘cv_bridge‘ specifies ‘/usr/include/opencv‘ as an include dir, which is not found