赞
踩
仅为学习记录和一些自己的思考,不具有参考意义。
(1)gazebo仿真
roslaunch why_simulation why_slam.launch
- <launch>
-
- <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
- <include file="$(find gazebo_ros)/launch/empty_world.launch">
- <arg name="world_name" value="$(find why_simulation)/worlds/slam_simple.world"/>
- <arg name="paused" value="false"/>
- <arg name="use_sim_time" value="true"/>
- <arg name="gui" value="true"/>
- <arg name="recording" value="false"/>
- <arg name="debug" value="false"/>
- </include>
-
- <!-- Spawn a robot into Gazebo -->
- <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/wpb_home.model -urdf -x -0.0 -y -0.0 -model wpb_home" />
-
- <!-- tf -->
- <arg name="model" default="$(find why_simulation)/models/wpb_home.model"/>
- <param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
- <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
- <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
-
- </launch>
(2)启动建图节点
rosrun hector_mapping hector_mapping
(3)rviz
rviz
将所需要的模块添加进去之后,保存为hector.rviz文件。
(4)控制机器人运动
rosrun rqt_robot_steering rqt_robot_steering
新建一个launch文件,将以上四条指令添加到launch文件中。
- <launch>
-
- <include file="$(find why_simulation)/launch/why_slam.launch"/>
- <node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" />
- <node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/hector.rviz"/>
- <node name="rqt_robot_steering" pkg="rqt_robot_steering " type="rqt_robot_steering " />
-
- </launch>
ROS Indexa community-maintained index of robotics softwarehttps://index.ros.org/
(1)搜索hector_mapping
(2)选择Website
即可查看到有哪些参数可以设置
- <launch>
-
- <include file="$(find why_simulation)/launch/why_slam.launch"/>
-
- <node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" output="screen">
- <param name="map_update_distance_thresh" value="0.1"/>
- <param name="map_update_angle_thresh " value="0.1"/>
- <param name="map_pub_period " value="0.1"/>
- </node>
-
- <node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/hector.rviz"/>
- <node name="rqt_robot_steering" pkg="rqt_robot_steering " type="rqt_robot_steering " />
-
- </launch>
(1)gazebo环境
roslaunch why_simulation why_robocup.launch
- <launch>
-
- <!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
- <include file="$(find gazebo_ros)/launch/empty_world.launch">
- <arg name="world_name" value="$(find why_simulation)/worlds/why_robocup.world"/>
- <arg name="paused" value="false"/>
- <arg name="use_sim_time" value="true"/>
- <arg name="gui" value="true"/>
- <arg name="recording" value="false"/>
- <arg name="debug" value="false"/>
- </include>
-
- <!-- Spawn the objects into Gazebo -->
- <node name="bed" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/bed.model -x 5.0 -y -3.9 -z 0 -Y 3.14159 -urdf -model bed" />
- <node name="sofa" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/sofa.model -x -1.0 -y -3.9 -z 0 -Y 1.57 -urdf -model sofa" />
- <node name="tea_table" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/tea_table.model -x -2.1 -y -2.2 -z 0 -Y 1.57 -urdf -model tea_table" />
- <node name="bookshelft" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/bookshelft.model -x 2.0 -y -0.55 -z 0 -Y -1.57 -urdf -model bookshelft" />
-
- <node name="kitchen_table" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x -3.5 -y 3.7 -z 0 -Y 1.57 -urdf -model kitchen_table" />
-
- <node name="cupboard_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/cupboard.model -x -2.0 -y 0.7 -z 0 -Y 1.57 -urdf -model cupboard_0" />
- <node name="cupboard_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/cupboard.model -x -1.3 -y 3.7 -z 0 -Y -1.57 -urdf -model cupboard_1" />
-
- <node name="dinning_table_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 1.5 -y 1.5 -z 0 -Y 1.57 -urdf -model dinning_table_0" />
- <node name="dinning_table_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 1.5 -y 2.0 -z 0 -Y 1.57 -urdf -model dinning_table_1" />
- <node name="dinning_table_2" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 2.7 -y 1.5 -z 0 -Y 1.57 -urdf -model dinning_table_2" />
- <node name="dinning_table_3" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 2.7 -y 2.0 -z 0 -Y 1.57 -urdf -model dinning_table_3" />
-
- <node name="chair_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 1.5 -y 1.2 -z 0 -Y 1.57 -urdf -model chair_0" />
- <node name="chair_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 1.5 -y 2.3 -z 0 -Y -1.57 -urdf -model chair_1" />
- <node name="chair_2" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 2.7 -y 1.2 -z 0 -Y 1.57 -urdf -model chair_2" />
- <node name="chair_3" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 2.7 -y 2.3 -z 0 -Y -1.57 -urdf -model chair_3" />
-
- <!-- Spawn a robot into Gazebo -->
- <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/wpb_home.model -urdf -x 0.0 -y -0.0 -model wpb_home" />
-
- <!-- tf -->
- <arg name="model" default="$(find why_simulation)/models/wpb_home.model"/>
- <param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
- <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
- <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
-
- <!-- lidar filter-->
- <node pkg="why_simulation" type="lidar_filter" name="lidar_filter" />
-
- </launch>
(2)启动gmapping节点
rosrun gmapping slam_gmapping
(3)rviz
rviz
保存成gmapping.rviz
(4)控制机器人移动
rosrun why_simulation keyboard_vel_ctrl
新建launch文件gmapping.launch,接上述指令添加到launch文件里
- <launch>
-
- <include file="$(find why_simulation)/launch/why_robocup.launch"/>
-
- <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping"/>
-
- <node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/gmapping.rviz"/>
- <node name="why_simulation" pkg="keyboard_vel_ctrl " type="keyboard_vel_ctrl " />
-
- </launch>
- <launch>
-
- <include file="$(find why_simulation)/launch/why_robocup.launch"/>
-
- <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping">
- <param name="map_update_interval" value="0.5"/>
- <param name="linearUpdate " value="0.1"/>
- </node>
-
- <node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/gmapping.rviz"/>
- <node name="why_simulation" pkg="keyboard_vel_ctrl " type="keyboard_vel_ctrl " />
-
- </launch>
rosrun map_server map_saver -f map
roscore
rosrun map_server map_server map.yaml
rviz
hector_mapping不使用里程计,长直的路径存在建图错误,gmapping使用里程计。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。