蓝桥ROS机器人之古月居ROS入门21讲

Posted zhangrelay

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了蓝桥ROS机器人之古月居ROS入门21讲相关的知识,希望对你有一定的参考价值。

ROS1入门经典课程,在其官网和B站等都有详细介绍和视频讲解。


古月居校园行

 


直接在蓝桥云课下载就可以学习和使用啦。

文档部分:

 

源码等:

将源码复制到demo_ws/src下,并编译后使用:

catkin build 


ros1 kinetic(1) or ros2 ardent(2)?
1
shiyanlou:Code/ $ git clone https://gitcode.net/ZhangRelay/ros_book.git
\\u6b63\\u514b\\u9686\\u5230 'ros_book'...
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 3), reused 0 (delta 0), pack-reused 0
\\u5c55\\u5f00\\u5bf9\\u8c61\\u4e2d: 100% (15/15), \\u5b8c\\u6210.
\\u68c0\\u67e5\\u8fde\\u63a5... \\u5b8c\\u6210\\u3002
shiyanlou:Code/ $ unzip ros_book/ros_21_tutorials-master.zip         [13:45:05]
Archive:  ros_book/ros_21_tutorials-master.zip
a5296958c8b73476ebffe12d2aa4c8049e6c177f
   creating: ros_21_tutorials-master/
  inflating: ros_21_tutorials-master/README.md  
   creating: ros_21_tutorials-master/docs/
 extracting: ros_21_tutorials-master/docs/poster.png  
  inflating: ros_21_tutorials-master/docs/poster2.png  
  inflating: ros_21_tutorials-master/docs/schedule.png  
   creating: ros_21_tutorials-master/docs/slides/
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_1.\\u8bfe\\u7a0b\\u4ecb\\u7ecd.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_10.\\u53d1\\u5e03\\u8005Publisher\\u7684\\u7f16\\u7a0b\\u5b9e\\u73b0.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_11.\\u8ba2\\u9605\\u8005Subscriber\\u7684\\u7f16\\u7a0b\\u5b9e\\u73b0.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_12.\\u8bdd\\u9898\\u6d88\\u606f\\u7684\\u5b9a\\u4e49\\u4e0e\\u4f7f\\u7528.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_13.\\u5ba2\\u6237\\u7aefClient\\u7684\\u7f16\\u7a0b\\u5b9e\\u73b0.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_14.\\u670d\\u52a1\\u7aefServer\\u7684\\u7f16\\u7a0b\\u5b9e\\u73b0.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_15.\\u670d\\u52a1\\u6570\\u636e\\u7684\\u5b9a\\u4e49\\u4e0e\\u4f7f\\u7528.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_16.\\u53c2\\u6570\\u7684\\u4f7f\\u7528\\u4e0e\\u7f16\\u7a0b\\u65b9\\u6cd5.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_17.ROS\\u4e2d\\u7684\\u5750\\u6807\\u7cfb\\u7ba1\\u7406\\u7cfb\\u7edf.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_18.tf\\u5750\\u6807\\u7cfb\\u5e7f\\u64ad\\u4e0e\\u76d1\\u542c\\u7684\\u7f16\\u7a0b\\u5b9e\\u73b0.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_19.launch\\u542f\\u52a8\\u6587\\u4ef6\\u7684\\u4f7f\\u7528\\u65b9\\u6cd5.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_2.Linux\\u7cfb\\u7edf\\u4ecb\\u7ecd\\u53ca\\u5b89\\u88c5.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_20.\\u5e38\\u7528\\u53ef\\u89c6\\u5316\\u5de5\\u5177\\u7684\\u4f7f\\u7528.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_21.\\u8bfe\\u7a0b\\u603b\\u7ed3\\u4e0e\\u8fdb\\u9636\\u653b\\u7565.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_3.Linux\\u7cfb\\u7edf\\u57fa\\u7840\\u64cd\\u4f5c.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_4.\\u7f16\\u7a0b\\u6781\\u7b80\\u57fa\\u7840.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_5.\\u5b89\\u88c5ROS\\u7cfb\\u7edf.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_6.ROS\\u662f\\u4ec0\\u4e48.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_7.ROS\\u7684\\u6838\\u5fc3\\u6982\\u5ff5.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_8.ROS\\u547d\\u4ee4\\u884c\\u5de5\\u5177\\u7684\\u4f7f\\u7528.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_9.\\u521b\\u5efa\\u5de5\\u4f5c\\u7a7a\\u95f4\\u4e0e\\u529f\\u80fd\\u5305.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_\\u52a01.\\u5b66\\u5b8c21\\u8bb2\\uff0c\\u8be5\\u5b66\\u4ec0\\u4e48.pdf  
  inflating: ros_21_tutorials-master/docs/slides/\\u53e4\\u6708 · ROS\\u5165\\u95e821\\u8bb2_\\u52a02.ROS\\u5728\\u673a\\u5668\\u4eba\\u4e2d\\u662f\\u5982\\u4f55\\u8fd0\\u884c\\u7684.pdf  
   creating: ros_21_tutorials-master/learning_launch/
  inflating: ros_21_tutorials-master/learning_launch/CMakeLists.txt  
   creating: ros_21_tutorials-master/learning_launch/config/
  inflating: ros_21_tutorials-master/learning_launch/config/param.yaml  
   creating: ros_21_tutorials-master/learning_launch/launch/
  inflating: ros_21_tutorials-master/learning_launch/launch/simple.launch  
  inflating: ros_21_tutorials-master/learning_launch/launch/start_tf_demo_c++.launch  
  inflating: ros_21_tutorials-master/learning_launch/launch/start_tf_demo_py.launch  
  inflating: ros_21_tutorials-master/learning_launch/launch/turtlesim_parameter_config.launch  
  inflating: ros_21_tutorials-master/learning_launch/launch/turtlesim_remap.launch  
  inflating: ros_21_tutorials-master/learning_launch/package.xml  
   creating: ros_21_tutorials-master/learning_parameter/
  inflating: ros_21_tutorials-master/learning_parameter/CMakeLists.txt  
   creating: ros_21_tutorials-master/learning_parameter/config/
  inflating: ros_21_tutorials-master/learning_parameter/config/turtle_param.yaml  
  inflating: ros_21_tutorials-master/learning_parameter/package.xml  
   creating: ros_21_tutorials-master/learning_parameter/scripts/
  inflating: ros_21_tutorials-master/learning_parameter/scripts/parameter_config.py  
   creating: ros_21_tutorials-master/learning_parameter/src/
  inflating: ros_21_tutorials-master/learning_parameter/src/parameter_config.cpp  
   creating: ros_21_tutorials-master/learning_service/
  inflating: ros_21_tutorials-master/learning_service/CMakeLists.txt  
  inflating: ros_21_tutorials-master/learning_service/package.xml  
   creating: ros_21_tutorials-master/learning_service/scripts/
  inflating: ros_21_tutorials-master/learning_service/scripts/person_client.py  
  inflating: ros_21_tutorials-master/learning_service/scripts/person_server.py  
  inflating: ros_21_tutorials-master/learning_service/scripts/turtle_command_server.py  
  inflating: ros_21_tutorials-master/learning_service/scripts/turtle_spawn.py  
   creating: ros_21_tutorials-master/learning_service/src/
  inflating: ros_21_tutorials-master/learning_service/src/person_client.cpp  
  inflating: ros_21_tutorials-master/learning_service/src/person_server.cpp  
  inflating: ros_21_tutorials-master/learning_service/src/turtle_command_server.cpp  
  inflating: ros_21_tutorials-master/learning_service/src/turtle_spawn.cpp  
   creating: ros_21_tutorials-master/learning_service/srv/
  inflating: ros_21_tutorials-master/learning_service/srv/Person.srv  
   creating: ros_21_tutorials-master/learning_tf/
  inflating: ros_21_tutorials-master/learning_tf/CMakeLists.txt  
   creating: ros_21_tutorials-master/learning_tf/launch/
  inflating: ros_21_tutorials-master/learning_tf/launch/start_tf_demo_c++.launch  
  inflating: ros_21_tutorials-master/learning_tf/launch/start_tf_demo_py.launch  
  inflating: ros_21_tutorials-master/learning_tf/package.xml  
   creating: ros_21_tutorials-master/learning_tf/scripts/
  inflating: ros_21_tutorials-master/learning_tf/scripts/turtle_tf_broadcaster.py  
  inflating: ros_21_tutorials-master/learning_tf/scripts/turtle_tf_listener.py  
   creating: ros_21_tutorials-master/learning_tf/src/
  inflating: ros_21_tutorials-master/learning_tf/src/turtle_tf_broadcaster.cpp  
  inflating: ros_21_tutorials-master/learning_tf/src/turtle_tf_listener.cpp  
   creating: ros_21_tutorials-master/learning_topic/
  inflating: ros_21_tutorials-master/learning_topic/CMakeLists.txt  
   creating: ros_21_tutorials-master/learning_topic/msg/
  inflating: ros_21_tutorials-master/learning_topic/msg/Person.msg  
  inflating: ros_21_tutorials-master/learning_topic/package.xml  
   creating: ros_21_tutorials-master/learning_topic/scripts/
  inflating: ros_21_tutorials-master/learning_topic/scripts/person_publisher.py  
  inflating: ros_21_tutorials-master/learning_topic/scripts/person_subscriber.py  
  inflating: ros_21_tutorials-master/learning_topic/scripts/pose_subscriber.py  
  inflating: ros_21_tutorials-master/learning_topic/scripts/velocity_publisher.py  
   creating: ros_21_tutorials-master/learning_topic/src/
  inflating: ros_21_tutorials-master/learning_topic/src/person_publisher.cpp  
  inflating: ros_21_tutorials-master/learning_topic/src/person_subscriber.cpp  
  inflating: ros_21_tutorials-master/learning_topic/src/pose_subscriber.cpp  
  inflating: ros_21_tutorials-master/learning_topic/src/velocity_publisher.cpp  
   creating: ros_21_tutorials-master/linux/
  inflating: ros_21_tutorials-master/linux/c++_class.cpp  
  inflating: ros_21_tutorials-master/linux/c++_for.cpp  
  inflating: ros_21_tutorials-master/linux/c++_while.cpp  
  inflating: ros_21_tutorials-master/linux/python_class.py  
  inflating: ros_21_tutorials-master/linux/python_for.py  
  inflating: ros_21_tutorials-master/linux/python_while.py  
  inflating: ros_21_tutorials-master/\\u300aROS\\u5165\\u95e821\\u8bb2\\u300b\\u6559\\u7a0b\\u8865\\u5145\\u8d44\\u6599.pdf  
shiyanlou:Code/ $ cd demo_ws                                         [13:45:43]
shiyanlou:demo_ws/ $ catkin build                                    [13:46:49]
-----------------------------------------------------------------
Profile:                     default
Extending:             [env] /opt/ros/kinetic
Workspace:                   /home/shiyanlou/Code/demo_ws
-----------------------------------------------------------------
Build Space:        [exists] /home/shiyanlou/Code/demo_ws/build
Devel Space:        [exists] /home/shiyanlou/Code/demo_ws/devel
Install Space:      [unused] /home/shiyanlou/Code/demo_ws/install
Log Space:         [missing] /home/shiyanlou/Code/demo_ws/logs
Source Space:       [exists] /home/shiyanlou/Code/demo_ws/src
DESTDIR:            [unused] None
-----------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-----------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-----------------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
-----------------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
-----------------------------------------------------------------
[build] Found '5' packages in 0.0 seconds.                                     
[build] Updating package table.                                                
Starting  >>> catkin_tools_prebuild                                            
Finished  <<< catkin_tools_prebuild                [ 2.3 seconds ]             
Starting  >>> learning_launch                                                  
Starting  >>> learning_parameter                                               
Starting  >>> learning_service                                                 
Starting  >>> learning_tf                                                      
Finished  <<< learning_launch                      [ 10.8 seconds ]            
Starting  >>> learning_topic                                                   
Finished  <<< learning_parameter                   [ 24.6 seconds ]            
Finished  <<< learning_tf                          [ 47.4 seconds ]            
Finished  <<< learning_service                     [ 56.3 seconds ]            
Finished  <<< learning_topic                       [ 46.4 seconds ]            
[build] Summary: All 6 packages succeeded!                                     
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    None.                                                     
[build] Runtime: 59.6 seconds total.                                           
[build] Note: Workspace packages have changed, please re-source setup files to use them.
Exception ignored in: <bound method BaseEventLoop.__del__ of <_UnixSelectorEventLoop running=False closed=True debug=False>>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/base_events.py", line 431, in __del__
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 58, in close
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 139, in remove_signal_handler
  File "/usr/lib/python3.5/signal.py", line 47, in signal
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
shiyanlou:demo_ws/ $ source devel/setup.bash                         [13:47:55]
devel/setup.bash:.:8: \\u6ca1\\u6709\\u90a3\\u4e2a\\u6587\\u4ef6\\u6216\\u76ee\\u5f55: /home/shiyanlou/Code/demo_ws/setup.sh
shiyanlou:demo_ws/ $ source devel/setup.zsh                          [13:48:31]
shiyanlou:demo_ws/ $ roslaunch learning_launch start_tf_demo_c++.launch 
... logging to /home/shiyanlou/.ros/log/8ba90254-ad0b-11ec-bf40-0242c0a82a04/roslaunch-5a0e7854a36d-30370.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://5a0e7854a36d:36559/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.17

NODES
  /
    listener (learning_tf/turtle_tf_listener)
    sim (turtlesim/turtlesim_node)
    teleop (turtlesim/turtle_teleop_key)
    turtle1_tf_broadcaster (learning_tf/turtle_tf_broadcaster)
    turtle2_tf_broadcaster (learning_tf/turtle_tf_broadcaster)

auto-starting new master
process[master]: started with pid [30380]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 8ba90254-ad0b-11ec-bf40-0242c0a82a04
process[rosout-1]: started with pid [30393]
started core service [/rosout]
process[sim-2]: started with pid [30396]
process[teleop-3]: started with pid [30407]
process[turtle1_tf_broadcaster-4]: started with pid [30409]
process[turtle2_tf_broadcaster-5]: started with pid [30418]
process[listener-6]: started with pid [30422]
Reading from keyboard
---------------------------
Use arrow keys to move the turtle.


以上是关于蓝桥ROS机器人之古月居ROS入门21讲的主要内容,如果未能解决你的问题,请参考以下文章

ROS2机器人中文教程分享-小鱼动手学和古月居

机器人开发相关博客论坛等

ROS2机器人中文教程分享-小鱼动手学和古月居

ROS学习笔记3.(理论)什么是ROS以及一些核心概念

ROS1学习笔记:ROS命令行工具的使用(ubuntu20.04)

ROS概述