< >
Home » Turtlebot4入门教程 » Turtlebot4入门教程-设置Discovery Server

Turtlebot4入门教程-设置Discovery Server

说明:

  • 介绍如何在ROS2 humble中设置Discovery Server

步骤:

在create 3的设置:

请输入图片描述

  • Create® 3 现在处于AP模式,使用笔记本或手机连接到名为“Create-XXXX”的WiFi网络

  • 在浏览器中进入192.168.10.1的页面

  • 点击左上面的菜单栏的Update标签页

  • 点击选择文件,选择对应的固件

  • 点击Upload file and update,更新固件

请输入图片描述

  • 更新完固件后,点击菜单栏的About,在页面底部找到Factory Reset,点击它,执行恢复出厂设置,断开Create3与任何Wi-Fi网络的连接

  • 点击左上面的菜单栏的Application标签页

  • 点击选择Configuration,配置

  • RMW_IMPLEMENTATION设置为:rmw_fastrtps_cpp

  • 勾选 Enable Fast DDS discovery server

  • Address and port of Fast DDS discovery server设置为:192.168.186.3:11811

请输入图片描述

turtlebot4 树莓派的设置:

  • 启动树莓派

  • 连接wifi时,需要手动在树莓派的桌面上连接wifi。不能使用turtlebot4-setup来设置wifi,要不然使用不了usb0网口

  • 使用命令ifconfig查看一下网口信息,看一下是否有usb0网口

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.185.3  netmask 255.255.255.0  broadcast 192.168.185.255
        inet6 fe80::e65f:1ff:fe7d:5432  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:7d:54:32  txqueuelen 1000  (Ethernet)
        RX packets 16781  bytes 11777494 (11.7 MB)
        RX errors 0  dropped 4  overruns 0  frame 0
        TX packets 2283  bytes 363248 (363.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 229595  bytes 296256792 (296.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 229595  bytes 296256792 (296.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.186.3  netmask 255.255.255.0  broadcast 192.168.186.255
        inet6 fe80::5475:35ff:fee2:81cf  prefixlen 64  scopeid 0x20<link>
        ether 56:75:35:e2:81:cf  txqueuelen 1000  (Ethernet)
        RX packets 5498754  bytes 1261814343 (1.2 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 15850  bytes 2570388 (2.5 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.210  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::2dad:4ead:dd2c:f928  prefixlen 64  scopeid 0x20<link>
        ether e4:5f:01:7d:54:33  txqueuelen 1000  (Ethernet)
        RX packets 15605  bytes 10459690 (10.4 MB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 362  bytes 106040 (106.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 看一下是否ping通create3
ping 192.168.186.2

PING 192.168.186.2 (192.168.186.2) 56(84) bytes of data.
64 bytes from 192.168.186.2: icmp_seq=1 ttl=64 time=0.406 ms
64 bytes from 192.168.186.2: icmp_seq=2 ttl=64 time=0.341 ms
64 bytes from 192.168.186.2: icmp_seq=3 ttl=64 time=0.639 ms

--- 192.168.186.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2043ms
rtt min/avg/max/mdev = 0.341/0.462/0.639/0.127 ms
  • 运行 TurtleBot 4 设置工具
turtlebot4-setup


  _____         _   _     ___      _   _ _    ___      _
 |_   _|  _ _ _| |_| |___| _ ) ___| |_| | |  / __| ___| |_ _  _ _ __
   | || || | '_|  _| / -_) _ \/ _ \  _|_  _| \__ \/ -_)  _| || | '_ \
   |_| \_,_|_|  \__|_\___|___/\___/\__| |_|  |___/\___|\__|\_,_| .__/
                                                               |_|

Press Q, Esc, or CTRL+C to go back.
---------------------------------------------------------------------
> ROS Setup
  Wi-Fi Setup
  Bluetooth Setup

  View Settings
  Apply Settings

  About
  Help
  Exit
  • 选择ROS Setup
  ___  ___  ___   ___      _
 | _ \/ _ \/ __| / __| ___| |_ _  _ _ __
 |   / (_) \__ \ \__ \/ -_)  _| || | '_ \
 |_|_\\___/|___/ |___/\___|\__|\_,_| .__/
                                   |_|

Press Q, Esc, or CTRL+C to go back.
-----------------------------------------
  Bash Setup
> Discovery Server
  Robot Upstart
  • 选择Discovery Server
  ___  _                               ___
 |   \(_)___ __ _____ _____ _ _ _  _  / __| ___ _ ___ _____ _ _
 | |) | (_-</ _/ _ \ V / -_) '_| || | \__ \/ -_) '_\ V / -_) '_|
 |___/|_/__/\__\___/\_/\___|_|  \_, | |___/\___|_|  \_/\___|_|
                                |__/

Press Q, Esc, or CTRL+C to go back.
----------------------------------------------------------------
> Enabled     [True]
  IP          [127.0.0.1]
  Port        [11811]

  Apply Defaults
  Save
  • 选择EnabledTrue

  • 选择Save,按q退出上一层,再按q退出上一层,回到首页

  • 选择Apply Settings

  • 打开终端,输入命令。让刚才的设置生效

turtlebot4-source
  • 重启ROS2 daemon
turtlebot4-daemon-restart
  • 查看话题
ros2 topic list

/battery_state
/cmd_audio
/cmd_lightring
/cmd_vel
/color/preview/image
/diagnostics
/diagnostics_agg
/diagnostics_toplevel_state
/dock_status
/function_calls
/hazard_detection
/imu
/interface_buttons
/ip
/ir_intensity
/ir_opcode
/joint_states
/joy
/joy/set_feedback
/kidnap_status
/mobility_monitor/transition_event
/mouse
/odom
/parameter_events
/robot_description
/robot_state/transition_event
/rosout
/scan
/slip_status
/static_transform/transition_event
/stereo/depth
/stop_status
/tf
/tf_static
/wheel_status
/wheel_ticks
/wheel_vels
  • 看一下是否能查看电池状态的话题的数据信息
ros2 topic echo /battery_state

header:
  stamp:
    sec: 1684395660
    nanosec: 227231811
  frame_id: ''
voltage: 15.291999816894531
temperature: 47.95000076293945
current: 0.48899999260902405
charge: 1.309000015258789
capacity: 1.9520000219345093
design_capacity: 1.9520000219345093
percentage: 0.6700000166893005
power_supply_status: 0
power_supply_health: 0
power_supply_technology: 0
present: true
cell_voltage: []
cell_temperature: []
location: ''
serial_number: ''
---

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: none