Professional Documents
Culture Documents
Prof. Ning Xi
1
Objective: Simple understanding of ROS: ROS is
the publish/subscribe middle-ware itself
Tasks:
Build a simulation world and build a map based on it (group)
Write a simple publisher and subscriber with python (individual)
2
Simulate hkubot in Gazebo
Install simulation model
• Run “sudo apt-get install ros-kinetic-
controller-manager ros-kinetic-gmapping
ros-kinetic-move-base ros-kinetic-map-
server ros-kinetic-navigation ros-kinetic-
teb-local-planner”
• Run “sudo apt-get install ros-kinetic-
gazebo-ros-control”
• Run “sudo apt-get install ros-kinetic- 3
kobuki”
Simulate hkubot in Gazebo
Install simulation model
• Run “cd ~/.gazebo/”
• Run “mkdir -p models”
• Run “cd models”
• Run “wget
http://file.ncnynl.com/ros/gazebo_models.txt”
• Run “wget -i gazebo_models.txt”
• Uncompress szarobotsim.tar.gz to Home folder
• Run “cd szarobotsim”
4
• Run “catkin_make”
Build simulation environment
• Run “source ~/szarobotsim/devel/setup.bash”
• Run “roslaunch my_simrobot my_simrobot_bringup.launch”
• Open a new terminal and run “source
~/szarobotsim/devel/setup.bash”
• Run “rosrun teleop_twist_keyboard
teleop_twist_keyboard.py” and move your robot
• Open a new terminal and run “source
~/szarobotsim/devel/setup.bash”
• Run “roslaunch my_simrobot robot_test_rviz.launch”
• Add Image to show rgb camera data and depth camera data
• Add LaserScan to show Lidar data during navigation
5
Build a map
• Run “source ~/szarobotsim/devel/setup.bash”
I
• Run “roslaunch my_simrobot gmappingsim_bringup.launch”
• Run “rosrun teleop_twist_keyboard teleop_twist_keyboard.py” J K L
6
Write a publisher to publish velocity (python)
7
Write a publisher to publish velocity (python)
11
Step4: examine publisher nodes
• Run “roscore”
• Run “cd ~/catkin_ws”
• Run “source devel/setup.bash”
• Run “rosrun turtlesim turtlesim_node”
• Open new terminal
• Run “source catkin_ws/devel/setup.bash”
• Run “rosrun beginner_tutorials_py talker.py”
12
/cmd_vel
Step4: examine publisher and subscriber nodes
15
Tests:
• Load the robot model in simulation, create
your own simulation environment, put the
screenshot in your report. (Group Report)
• Scan the map of your created environment in
simulation, put the screenshot in your report.
(Group Report)
• Control the robot to follow a circle in the
simulation environment. (Group Report)
• Drive your turtle and hkurobot to draw a “9”
as shown on the right. (Individual Report)
(Tips: you can change the value of msg.linear.x and
msg.angular.z to drive your turtle)
Assignment:
◼ Write a report after class to finish your group report and answer
the following questions individually:
• Take “hkubot” as an example to describe the working process of
ROS.
• Control the “hkubot” to draw “9” in the simulation environment,
with codes and screenshots in your report.
• Explain how you realize the publisher and subscriber in this
experiment.
• Please present a method to transmit the real-time position/velocity
data of the hkubot to another program running in your computer.17