使用機(jī)器人操作系統(tǒng)ROS 2和仿真軟件Gazebo 9命令遙控可視化教程(二)

      網(wǎng)友投稿 17574 2025-04-03

      上一篇,已經(jīng)在Gazebo 9中放入了一個(gè)支持ROS 2的仿真機(jī)器人,具體參考:


      使用機(jī)器人操作系統(tǒng)ROS 2和仿真軟件Gazebo 9搭建機(jī)器人教程(一)

      本篇,通過此案例學(xué)習(xí)并熟練掌握ROS2的如下內(nèi)容:

      ROS2常用命令回顧

      遙控機(jī)器人在環(huán)境中運(yùn)動(dòng)

      rqt和rviz2

      攝像頭圖像顯示和激光數(shù)據(jù)可視化

      ROS2入門介紹參考:https://zhuanlan.zhihu.com/p/96940278

      $ ros2 launch mobot world.launch.py

      具體流程參考下圖,配置不同會(huì)有路徑和目錄的差異:

      節(jié)點(diǎn)

      $ ros2 node

      usage: ros2 node [-h]

      Call `ros2 node -h` for more detailed usage. ...

      Various node related sub-commands

      optional arguments:

      -h, --help ? ? ? ? ? ?show this help message and exit

      Commands:

      info ?Output information about a node

      list ?Output a list of available nodes

      Call `ros2 node -h` for more detailed usage.

      使用其中l(wèi)ist:

      $ ros2 node list

      /launch_ros

      /gazebo

      /mobot/camera_controller

      /mobot/gazebo_ros_head_hokuyo_controller

      /mobot/skid_steer_drive_controller

      第一個(gè)為ros接口,第二個(gè)為gazebo,第三到五個(gè),為Gazebo插件的控制器對(duì)應(yīng)攝像頭、激光測(cè)距和運(yùn)動(dòng)驅(qū)動(dòng)。

      如果需要查看更具體的節(jié)點(diǎn)信息,如camera:

      $ ros2 node info /mobot/camera_controller

      /mobot/camera_controller

      Subscribers:

      /clock: rosgraph_msgs/msg/Clock

      /mobot/parameter_events: rcl_interfaces/msg/ParameterEvent

      Publishers:

      /mobot/camera/image: sensor_msgs/msg/Image

      /mobot/camera/image/camera_info: sensor_msgs/msg/CameraInfo

      /mobot/parameter_events: rcl_interfaces/msg/ParameterEvent

      /mobot/rosout: rcl_interfaces/msg/Log

      Services:

      /mobot/camera_controller/describe_parameters: rcl_interfaces/srv/DescribeParameters

      /mobot/camera_controller/get_parameter_types: rcl_interfaces/srv/GetParameterTypes

      /mobot/camera_controller/get_parameters: rcl_interfaces/srv/GetParameters

      /mobot/camera_controller/list_parameters: rcl_interfaces/srv/ListParameters

      /mobot/camera_controller/set_parameters: rcl_interfaces/srv/SetParameters

      /mobot/camera_controller/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically

      /mobot/set_camera_info: sensor_msgs/srv/SetCameraInfo

      此處需要注意,Dashing和Eloquent信息有一些的差異哦!

      如果使用是Eloquent,如下:

      $ ros2 node info /mobot/camera_controller

      /mobot/camera_controller

      Subscribers:

      /clock: rosgraph_msgs/msg/Clock

      /mobot/parameter_events: rcl_interfaces/msg/ParameterEvent

      Publishers:

      /mobot/camera/image: sensor_msgs/msg/Image

      /mobot/camera/image/camera_info: sensor_msgs/msg/CameraInfo

      /mobot/parameter_events: rcl_interfaces/msg/ParameterEvent

      /mobot/rosout: rcl_interfaces/msg/Log

      使用機(jī)器人操作系統(tǒng)ROS 2和仿真軟件Gazebo 9命令遙控可視化教程(二)

      Service Servers:

      /mobot/camera_controller/describe_parameters: rcl_interfaces/srv/DescribeParameters

      /mobot/camera_controller/get_parameter_types: rcl_interfaces/srv/GetParameterTypes

      /mobot/camera_controller/get_parameters: rcl_interfaces/srv/GetParameters

      /mobot/camera_controller/list_parameters: rcl_interfaces/srv/ListParameters

      /mobot/camera_controller/set_parameters: rcl_interfaces/srv/SetParameters

      /mobot/camera_controller/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically

      /mobot/set_camera_info: sensor_msgs/srv/SetCameraInfo

      Service Clients:

      Action Servers:

      Action Clients:

      如上所見,該節(jié)點(diǎn)正在發(fā)布、訂閱和由該節(jié)點(diǎn)提供的服務(wù)以及該節(jié)點(diǎn)充當(dāng)客戶端的服務(wù)的所有主題都會(huì)列出。

      主題

      $ ros2 topic

      usage: ros2 topic [-h] [--include-hidden-topics]

      Call `ros2 topic -h` for more detailed usage. ...

      Various topic related sub-commands

      optional arguments:

      -h, --help ? ? ? ? ? ?show this help message and exit

      --include-hidden-topics

      Consider hidden topics as well

      Commands:

      bw ? ? Display bandwidth used by topic

      delay ?Display delay of topic from timestamp in header

      echo ? Output messages from a topic

      find ? Output a list of available topics of a given type

      hz ? ? Print the average publishing rate to screen

      info ? Print information about a topic

      list ? Output a list of available topics

      pub ? ?Publish a message to a topic

      type ? Print a topic's type

      Call `ros2 topic -h` for more detailed usage.

      例如list:

      $ ros2 topic list

      /clock

      /mobot/camera/image

      /mobot/camera/image/camera_info

      /mobot/cmd_vel

      /mobot/odom

      /mobot/parameter_events

      /mobot/rosout

      /mobot/scan

      /parameter_events

      /rosout

      /tf

      來看看圖像數(shù)據(jù)和激光數(shù)據(jù)需要的帶寬吧?

      $ ros2 topic bw /mobot/camera/image

      Subscribed to [/mobot/camera/image]

      average: 27.89MB/s

      mean: 1.92MB/s min: 1.92MB/s max: 1.92MB/s window: 12

      average: 28.39MB/s

      mean: 1.92MB/s min: 1.92MB/s max: 1.92MB/s window: 27

      average: 25.82MB/s

      mean: 1.92MB/s min: 1.92MB/s max: 1.92MB/s window: 38

      average: 26.60MB/s

      mean: 1.92MB/s min: 1.92MB/s max: 1.92MB/s window: 53

      ros2 topic bw /mobot/scan

      Subscribed to [/mobot/scan]

      average: 169.85KB/s

      mean: 5.83KB/s min: 5.83KB/s max: 5.83KB/s window: 29

      average: 163.58KB/s

      mean: 5.83KB/s min: 5.83KB/s max: 5.83KB/s window: 56

      average: 163.45KB/s

      mean: 5.83KB/s min: 5.83KB/s max: 5.83KB/s window: 84

      average: 164.86KB/s

      mean: 5.83KB/s min: 5.83KB/s max: 5.83KB/s window: 100

      再比如:

      $ ros2 topic info /mobot/cmd_vel

      Type: geometry_msgs/msg/Twist

      Publisher count: 0

      Subscriber count: 1

      如果發(fā)布消息告知機(jī)器人運(yùn)動(dòng)呢?

      /mobot/skid_steer_drive_controller訂閱/mobot/cmd_vel

      目前,沒有消息發(fā)布,使用teleop_twist_keyboard。

      服務(wù)

      此部分教程不涉及,后續(xù)補(bǔ)充^_^

      基礎(chǔ)知識(shí)參考:https://blog.csdn.net/zhangrelay/article/details/103493612

      參數(shù)

      默認(rèn)節(jié)點(diǎn)通過修改參數(shù)可提高通用性!

      Dashing:

      sudo apt install ros-dashing-teleop-twist-keyboard

      Eloquent:

      sudo apt install ros-eloquent-teleop-twist-keyboard

      命令:

      $ ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/mobot

      This node takes keypresses from the keyboard and publishes them

      as Twist messages. It works best with a US keyboard layout.

      ---------------------------

      Moving around:

      u ? ?i ? ?o

      j ? ?k ? ?l

      m ? ?, ? ?.

      For Holonomic mode (strafing), hold down the shift key:

      ---------------------------

      U ? ?I ? ?O

      J ? ?K ? ?L

      M ? ?< ? ?>

      t : up (+z)

      b : down (-z)

      anything else : stop

      q/z : increase/decrease max speeds by 10%

      w/x : increase/decrease only linear speed by 10%

      e/c : increase/decrease only angular speed by 10%

      CTRL-C to quit

      currently:?? ?speed 0.5?? ?turn 1.0

      這部分和工具同步給出示例。

      使用鍵盤可以控制機(jī)器人在環(huán)境中運(yùn)動(dòng),觀察rqt和rviz2的變化。

      遙控靠近白色球體,轉(zhuǎn)到工具章節(jié)。

      行動(dòng)

      此部分教程不涉及,后續(xù)補(bǔ)充^_^

      基礎(chǔ)知識(shí)參考:https://blog.csdn.net/zhangrelay/article/details/103496999

      啟動(dòng)

      此部分教程不涉及,后續(xù)補(bǔ)充^_^

      基礎(chǔ)知識(shí)參考:https://blog.csdn.net/ZhangRelay/article/details/103498784

      工具

      rqt和rviz2。

      節(jié)點(diǎn)圖

      攝像頭圖像(Gazebo時(shí)間2:31:57)

      激光數(shù)據(jù)可視化(Gazebo時(shí)間2:31:57)

      攝像頭圖像(Gazebo時(shí)間2:46:31)

      激光數(shù)據(jù)可視化(Gazebo時(shí)間2:46:31)

      接下來,將會(huì)繼續(xù)介紹使用C++節(jié)點(diǎn)編寫程序處理激光和圖像信息,自主驅(qū)動(dòng)mobot。

      機(jī)器人

      版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。

      版權(quán)聲明:本文內(nèi)容由網(wǎng)絡(luò)用戶投稿,版權(quán)歸原作者所有,本站不擁有其著作權(quán),亦不承擔(dān)相應(yīng)法律責(zé)任。如果您發(fā)現(xiàn)本站中有涉嫌抄襲或描述失實(shí)的內(nèi)容,請(qǐng)聯(lián)系我們jiasou666@gmail.com 處理,核實(shí)后本網(wǎng)站將在24小時(shí)內(nèi)刪除侵權(quán)內(nèi)容。

      上一篇:這個(gè)稻殼模板太先進(jìn)了,居然半天都找不到分欄符號(hào)在哪(稻殼文本框在哪)
      下一篇:騰訊一面:內(nèi)存滿了,會(huì)發(fā)生什么?
      相關(guān)文章
      亚洲av永久综合在线观看尤物| 4480yy私人影院亚洲| 久久亚洲私人国产精品vA| 亚洲AV永久无码精品| 亚洲精品成人片在线播放| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 亚洲色欲色欲www在线丝| 亚洲情侣偷拍精品| 亚洲人成无码网WWW| 亚洲免费视频一区二区三区| 亚洲а∨天堂久久精品| 亚洲国产中文字幕在线观看| 亚洲国产精品尤物YW在线观看| 国产天堂亚洲国产碰碰| 国产亚洲精品精品精品| 亚洲AV无码一区二区三区在线观看| 国产成人亚洲精品电影| 亚洲精品456播放| 国产亚洲AV手机在线观看| 亚洲色婷婷综合久久| 亚洲大成色www永久网站| 久久久综合亚洲色一区二区三区 | 亚洲精品无码乱码成人| 国产AV无码专区亚洲精品| 亚洲成a人片在线观看无码专区| 国产亚洲欧洲精品| 亚洲精品高清视频| 亚洲成年人免费网站| 色婷五月综激情亚洲综合| 亚洲精品无码久久久久A片苍井空 亚洲精品无码久久久久YW | 亚洲午夜精品国产电影在线观看| 亚洲乱码卡三乱码新区| 亚洲字幕AV一区二区三区四区| 亚洲精品美女久久久久久久| 无码天堂va亚洲va在线va| 亚洲美女在线国产| 亚洲av一综合av一区| 亚洲视屏在线观看| ASS亚洲熟妇毛茸茸PICS| 亚洲AV永久无码精品网站在线观看 | 亚洲午夜国产片在线观看|