(一)PX4 仿真开发
搭建仿真环境
运行案例(C++)
(二)添加键盘控制
(三)添加相机
(四)基于ar_track_alvar的二维码识别
/home/yehuo/project_ws/src/install/ar_track_alvar/share/ar_track_alvar/launch/ar_track_camera.launch
xml
<launch>
<node pkg="tf" type="static_transform_publisher" name="world_to_cam" args="0 0 0.5 0 1.57 0 world camera_link 10" />
<arg name="marker_size" default="5" />
<arg name="max_new_marker_error" default="0.08" />
<arg name="max_track_error" default="0.2" />
<arg name="cam_image_topic" default="/camera/rgb/image_raw" />
<arg name="cam_info_topic" default="/camera/rgb/camera_info" />
<arg name="output_frame" default="/camera_link" />
<node name="ar_track_alvar" pkg="ar_track_alvar" type="individualMarkersNoKinect" respawn="false" output="screen">
<param name="marker_size" type="double" value="$(arg marker_size)" />
<param name="max_new_marker_error" type="double" value="$(arg max_new_marker_error)" />
<param name="max_track_error" type="double" value="$(arg max_track_error)" />
<param name="output_frame" type="string" value="$(arg output_frame)" />
<remap from="camera_image" to="$(arg cam_image_topic)" />
<remap from="camera_info" to="$(arg cam_info_topic)" />
</node>
<!--rviz view /-->
<node pkg="rviz" type="rviz" name="rviz" args="-d /home/yehuo/project_ws/src/ar_track_alvar/ar_track_alvar/config/ar_track_camera.rviz"/>
</launch>
/home/yehuo/project_ws/src/ar_track_alvar/ar_track_alvar/config/ar_track_camera.rviz
Panels:
- Class: rviz/Displays
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded: ~
Splitter Ratio: 0.5
Tree Height: 298
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679016
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: Camera
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.0299999993
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: <Fixed Frame>
Value: true
- Class: rviz/TF
Enabled: true
Frame Timeout: 15
Frames:
All Enabled: true
ar_marker_0:
Value: true
ar_marker_1:
Value: true
ar_marker_192:
Value: true
ar_marker_2:
Value: true
ar_marker_4:
Value: true
ar_marker_5:
Value: true
ar_marker_7:
Value: true
ar_marker_8:
Value: true
usb_cam:
Value: true
world:
Value: true
Marker Scale: 0.300000012
Name: TF
Show Arrows: true
Show Axes: true
Show Names: true
Tree:
world:
usb_cam:
ar_marker_0:
{}
ar_marker_1:
{}
ar_marker_192:
{}
ar_marker_2:
{}
ar_marker_4:
{}
ar_marker_5:
{}
ar_marker_7:
{}
ar_marker_8:
{}
Update Interval: 0
Value: true
- Class: rviz/Marker
Enabled: true
Marker Topic: /visualization_marker
Name: Marker
Namespaces:
basic_shapes: true
Queue Size: 100
Value: true
- Class: rviz/Camera
Enabled: true
Image Rendering: background and overlay
Image Topic: /camera/rgb/image_raw
Name: Camera
Overlay Alpha: 0.5
Queue Size: 2
Transport Hint: raw
Unreliable: false
Value: true
Visibility:
Grid: true
Marker: true
TF: true
Value: true
Zoom Factor: 1
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: world
Frame Rate: 30
Name: root
Tools:
- Class: rviz/Interact
Hide Inactive Objects: true
- Class: rviz/MoveCamera
- Class: rviz/Select
- Class: rviz/FocusCamera
- Class: rviz/Measure
- Class: rviz/SetInitialPose
Topic: /initialpose
- Class: rviz/SetGoal
Topic: /move_base_simple/goal
- Class: rviz/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Class: rviz/Orbit
Distance: 1.3831408
Enable Stereo Rendering:
Stereo Eye Separation: 0.0599999987
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0.158190101
Y: -0.0226284917
Z: 0.342923284
Focal Shape Fixed Size: true
Focal Shape Size: 0.0500000007
Invert Z Axis: false
Name: Current View
Near Clip Distance: 0.00999999978
Pitch: 0.484797359
Target Frame: <Fixed Frame>
Value: Orbit (rviz)
Yaw: 2.52039075
Saved: ~
Window Geometry:
Camera:
collapsed: false
Displays:
collapsed: false
Height: 846
Hide Left Dock: false
Hide Right Dock: true
QMainWindow State: 000000ff00000000fd000000040000000000000231000002c4fc0200000009fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c00610079007301000000280000016b000000dd00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000c00430061006d0065007200610100000199000001530000001600ffffff000000010000010f000002c4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730000000028000002c4000000b000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005b60000003efc0100000002fb0000000800540069006d00650100000000000005b60000030000fffffffb0000000800540069006d006501000000000000045000000000000000000000037f000002c400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 1462
X: 268
Y: 154
Rviz 界面截图

(五)在gazebo中贴图二维码
终端运行指令罗列
bash
~$ roscore
bash
~$ rosrun usb_cam usb_cam_node
bash
~$ roslaunch px4 mavros_posix_sitl.launch
bash
~$ rosrun usb_cam usb_cam_node
bash
~/project_ws$ ./change_mode.sh
bash
~$ roslaunch ar_track_alvar ar_track_camera.launch
问题汇总
- suffix can only be used with
==
or!=
operators torch (>=1.9.*) ~~~~~~^Please us - 如何在Ubuntu系统下正确安装并配置Python 2.7环境
- Ubuntu修改默认Python版本
- 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-f"的问题
- python:ImportError: No module named 'setuptools'
- python 2.7 安装pip.(解决No module named typing 问题)
- PX4报错FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-configure解决
- PX4 & gazebo仿真 offboard模式无法起飞解决思路
- ubuntu20.04安装ar_track_alvar
- 【学习笔记】AR码(二维码)识别