这是一篇真博客,LZ三月中旬开始接触ROS,当然中间也有七七八八一些事情,有所耽搁,所以进度不是很快.一开始是朝着三维建图方向,后面导师说还要加上导航,恩(^o^)/~ 那就学ros当中的navigation的部分呗.后来发现,LZ还是太年轻了,通常情况下navigation要包括move_base部分,然后就开始了参数的配置.
后来LZ发现,如果想要基本用起来ROS,launch文件特别重要,所以之前LZ写了一篇关于launch文件的介绍,如果小伙伴不是很清楚,可以看下https://blog.csdn.net/felaim/article/details/80244232,这篇文章还是蛮重要的.
对大神来说这篇博客可能很简单,LZ是ROS新手,所以事无巨细,能记录下来就记录下来.而且LZ的机器人是Pioneer3at,网上都是turblet的教程,对LZ来说并不适用.所以配置文件需要修改参数.下面就一步一步进行记录.
首先第一步
roscore
第二步:
到对应的ros工作空间下运行,LZ的是如下,嘿嘿,有felaim的标签啦:
roslaunch felaim_2dnav felaim_robot.launch
felaim_robot.launch,使用rosaria节点的时候要加上之前进行线速度和角速度校正的系数
<launch>
<node name="rosaria" pkg="rosaria" type="RosAria" args="_port:=/dev/ttyUSB0">
<param name="DriftFactor" value="0"/>
<param name="TicksMM" value="138"/>
<param name="RevCount" value="16485"/>
<remap from="rosaria/cmd_vel" to="cmd_vel"/>
<remap from="rosaria/pose" to="odom"/>
node>
<include file="$(find felaim_2dnav)/launch/pioneer3at_urdf.launch"/>
launch>
这个launch是连接pioneer3at和电脑的,并且下载对应的pioneer3at和kinect的模型
第三步:
启动kinect,并把对应的点云转换成对应的laser
roslaunch felaim_2dnav pioneer3at_fake_laser
pioneer3at_fake_laser_freenect.launch
<launch>
<include file="$(find freenect_launch)/launch/freenect.launch">
<arg name="publish_tf" value="false" />
<arg name="depth_registration" value="true" />
<arg name="rgb_processing" value="true" />
<arg name="ir_processing" value="false" />
<arg name="depth_processing" value="false" />
<arg name="depth_registered_processing" value="true" />
<arg name="disparity_processing" value="false" />
<arg name="disparity_registered_processing" value="false" />
<arg name="sw_registered_processing" value="false" />
<arg name="hw_registered_processing" value="true" />
include>
<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan" output="screen">
<remap from="image" to="/camera/depth_registered/image_raw" />
<remap from="camera_info" to="/camera/depth_registered/camera_info" />
<remap from="scan" to="/scan" />
<param name="output_frame_id" value="/camera_depth_frame" />
node>
launch>
第四步:
启动move_base节点
roslaunch felaim_2dnav tb_move_base_link_map.launch
tb_move_base_blank_map.launch
<launch>
<include file="$(find felaim_2dnav)/launch/tb_move_base.launch" />
<node name="map_server" pkg="map_server" type="map_server" args="$(find rbx1_nav)/maps/blank_map.yaml" />
<node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 /map /odom 100" />
launch>
第五步:
对导航进行可视化:
rosrun rviz rviz -d `rospack felaim_2dnav`/launch/pioneer3at_kinect.rviz
pioneer3at_kinect.rviz
Panels:
- Class: rviz/Displays
Help Height: 78
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Inflated Obstacles1
Splitter Ratio: 0.5
Tree Height: 565
- Class: rviz/Selection
Name: Selection
- Class: rviz/Tool Properties
Expanded:
- /2D Pose Estimate1
- /2D Nav Goal1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679
- Class: rviz/Views
Expanded:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: rviz/Time
Experimental: false
Name: Time
SyncMode: 0
SyncSource: LaserScan
Visualization Manager:
Class: ""
Displays:
- Alpha: 0.5
Cell Size: 1
Class: rviz/Grid
Color: 160; 160; 164
Enabled: true
Line Style:
Line Width: 0.03
Value: Lines
Name: Grid
Normal Cell Count: 0
Offset:
X: 0
Y: 0
Z: 0
Plane: XY
Plane Cell Count: 10
Reference Frame: Frame>
Value: true
- Alpha: 1
Autocompute Intensity Bounds: true
Autocompute Value Bounds:
Max Value: 10
Min Value: -10
Value: true
Axis: Z
Channel Name: intensity
Class: rviz/LaserScan
Color: 255; 255; 255
Color Transformer: Intensity
Decay Time: 0
Enabled: true
Invert Rainbow: false
Max Color: 255; 255; 255
Max Intensity: 4096
Min Color: 0; 0; 0
Min Intensity: 0
Name: LaserScan
Position Transformer: XYZ
Queue Size: 10
Selectable: true
Size (Pixels): 3
Size (m): 0.01
Style: Flat Squares
Topic: /scan
Unreliable: false
Use Fixed Frame: true
Use rainbow: true
Value: true
- Alpha: 1
Class: rviz/RobotModel
Collision Enabled: false
Enabled: true
Links:
All Links Enabled: true
Expand Joint Details: false
Expand Link Details: false
Expand Tree: false
Link Tree Style: Links in Alphabetic Order
base_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_depth_frame:
Alpha: 1
Show Axes: false
Show Trail: false
camera_depth_optical_frame:
Alpha: 1
Show Axes: false
Show Trail: false
camera_link:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
camera_rgb_frame:
Alpha: 1
Show Axes: false
Show Trail: false
camera_rgb_optical_frame:
Alpha: 1
Show Axes: false
Show Trail: false
p3at_back_left_axle:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_back_left_hub:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_back_left_wheel:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_back_right_axle:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_back_right_hub:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_back_right_wheel:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_left_axle:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_left_hub:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_left_wheel:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_right_axle:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_right_hub:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
p3at_front_right_wheel:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
top_plate:
Alpha: 1
Show Axes: false
Show Trail: false
Value: true
Name: RobotModel
Robot Description: robot_description
TF Prefix: ""
Update Interval: 0
Value: true
Visual Enabled: true
- Alpha: 0.7
Class: rviz/Map
Color Scheme: map
Draw Behind: false
Enabled: true
Name: Map
Topic: ""
Unreliable: false
Value: true
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 25; 255; 0
Enabled: true
Head Diameter: 0.3
Head Length: 0.2
Length: 0.3
Line Style: Lines
Line Width: 0.03
Name: Global_Plan
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Radius: 0.03
Shaft Diameter: 0.1
Shaft Length: 0.1
Topic: /move_base/TrajectoryPlannerROS/global_plan
Unreliable: false
Value: true
- Alpha: 1
Buffer Length: 1
Class: rviz/Path
Color: 25; 255; 0
Enabled: true
Head Diameter: 0.3
Head Length: 0.2
Length: 0.3
Line Style: Lines
Line Width: 0.03
Name: Local_Plan
Offset:
X: 0
Y: 0
Z: 0
Pose Color: 255; 85; 255
Pose Style: None
Radius: 0.03
Shaft Diameter: 0.1
Shaft Length: 0.1
Topic: /move_base/TrajectoryPlannerROS/local_plan
Unreliable: false
Value: true
- Angle Tolerance: 0.1
Class: rviz/Odometry
Color: 255; 25; 0
Enabled: true
Keep: 100
Length: 1
Name: Odometry
Position Tolerance: 0.1
Topic: /odom
Value: true
- Arrow Length: 0.3
Class: rviz/PoseArray
Color: 255; 25; 0
Enabled: true
Name: PoseArray
Topic: ""
Unreliable: false
Value: true
- Alpha: 1
Class: rviz/Map
Color Scheme: costmap
Draw Behind: false
Enabled: true
Name: Inflated Obstacles
Topic: /move_base/local_costmap/costmap
Unreliable: false
Value: true
- Alpha: 1
Axes Length: 1
Axes Radius: 0.1
Class: rviz/Pose
Color: 255; 25; 0
Enabled: true
Head Length: 0.3
Head Radius: 0.1
Name: Mouse Goal
Shaft Length: 1
Shaft Radius: 0.05
Shape: Arrow
Topic: /move_base/current_goal
Unreliable: false
Value: true
Enabled: true
Global Options:
Background Color: 48; 48; 48
Fixed Frame: map
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: 2.1996
Enable Stereo Rendering:
Stereo Eye Separation: 0.06
Stereo Focal Distance: 1
Swap Stereo Eyes: false
Value: false
Focal Point:
X: 0
Y: 0
Z: 0
Name: Current View
Near Clip Distance: 0.01
Pitch: 0.484797
Target Frame: Frame>
Value: Orbit (rviz)
Yaw: 1.85538
Saved: ~
Window Geometry:
Displays:
collapsed: false
Height: 846
Hide Left Dock: false
Hide Right Dock: true
QMainWindow State: 000000ff00000000fd0000000400000000000001c5000002c4fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006400fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000028000002c4000000dd00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002c4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730000000028000002c4000000b000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b0000002f600fffffffb0000000800540069006d00650100000000000004500000000000000000000002e5000002c400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Time:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 1200
X: 76
Y: 181
白色的是转换的laser数据, 蓝色的是膨胀后的安全距离,pioneer3at的模型如图所示,仔细看还可以发现kinect,模型中的tf变化和实际的测量相同.
哈哈,如果小伙伴有耐心,应该就能看到最后的效果图~(≧▽≦)/~啦啦啦,虽然简单,但是还是成就感满满^_^