当前位置:   article > 正文

主从机部署ROS,并运行 VINS-Fusion_ros主从机

ros主从机

首先将工作站(主机)和无人机(从机)连接到同一个路由器上,并保证他们的IP地址在同一个网段。

主机(工作站)IP

192.168.1.201

从机(无人机)IP

192.168.1.211

连接成功后在主机端测试是否能连上从机:输入

lilabws01@lilabws01:~$ ping 192.168.1.211

如下结果为连接成功

  1. PING 192.168.1.211 (192.168.1.211) 56(84) bytes of data.
  2. 64 字节,来自 192.168.1.211: icmp_seq=1 ttl=64 时间=44.7 毫秒
  3. 64 字节,来自 192.168.1.211: icmp_seq=2 ttl=64 时间=66.0 毫秒
  4. 64 字节,来自 192.168.1.211: icmp_seq=3 ttl=64 时间=89.2 毫秒
  5. 64 字节,来自 192.168.1.211: icmp_seq=4 ttl=64 时间=111 毫秒
  6. 64 字节,来自 192.168.1.211: icmp_seq=5 ttl=64 时间=31.4 毫秒

接下来在从机中命令行输入 ssh -X 主机账号@主机IP地址,然后输入主机密码进入主机终端

  1. lilabws01@lilabws01:~/桌面$ ssh -X nvidia@192.168.1.211
  2. nvidia@192.168.1.211's password:
  3. Welcome to Ubuntu 18.04.4 LTS (GNU/Linux 4.9.140-tegra aarch64)
  4. * Documentation: https://help.ubuntu.com
  5. * Management: https://landscape.canonical.com
  6. * Support: https://ubuntu.com/advantage
  7. * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
  8. just raised the bar for easy, resilient and secure K8s cluster deployment.
  9. https://ubuntu.com/engage/secure-kubernetes-at-the-edge
  10. This system has been minimized by removing packages and content that are
  11. not required on a system that users do not log into.
  12. To restore this content, you can run the 'unminimize' command.
  13. 709 packages can be updated.
  14. 509 updates are security updates.
  15. Last login: Mon Jun 26 20:47:29 2023 from 192.168.1.201
  16. Xlib: extension "NV-GLX" missing on display "localhost:10.0".
  17. Xlib: extension "NV-GLX" missing on display "localhost:10.0".
  18. Xlib: extension "NV-GLX" missing on display "localhost:10.0".

分别设置主机和从机的ROS_MASTER_URI(用于主机和从机的ROS通信)

设置主机 ROS_MASTER_URI

首先进入~/.bashrc界面

lilabws01@lilabws01:~$ sudo gedit ~/.bashrc

在文本最后加入(如果已有则修改),并保存

  1. export ROS_MASTER_URI=http://192.168.1.201:11311 # 主机IP
  2. export ROS_HOSTNAME=192.168.1.201 # 本地IP
  3. export ROS_IP=192.168.1.201 # 本地IP

source 当前该文件

lilabws01@lilabws01:~$ source ~/.bashrc 

设置从机 ROS_MASTER_URI

首先进入~/.bashrc界面

nvidia@NXX-02:~$ sudo gedit ~/.bashrc

在文本最后加入(如果已有则修改),并保存

  1. export ROS_MASTER_URI=http://192.168.1.201:11311 # 主机IP
  2. export ROS_HOSTNAME=192.168.1.211 # 本地IP
  3. export ROS_IP=192.168.1.211 # 本地IP

 source 当前该文件

nvidia@NXX-02:~$ source ~/.bashrc 

在从机终端启动相机(二选一)

  1. nvidia@NXX-02:~$ roslaunch realsense2_camera rs_camera.launch
  2. nvidia@NXX-02:~$ roslaunch realsense2_camera rs_camera_vinsgpu.launch

在主机终端查看是否能够搜到 ROS 话题

lilabws01@lilabws01:~$ rostopic list 

可以从机已经接受到从机传过来的话题了

  1. lilabws01@lilabws01:~$ rostopic list
  2. /camera/accel/imu_info
  3. /camera/color/camera_info
  4. /camera/color/image_raw
  5. /camera/color/metadata
  6. /camera/depth/camera_info
  7. /camera/depth/image_rect_raw
  8. /camera/depth/metadata
  9. /camera/extrinsics/depth_to_color
  10. /camera/extrinsics/depth_to_infra1
  11. /camera/extrinsics/depth_to_infra2
  12. /camera/gyro/imu_info
  13. /camera/imu
  14. /camera/infra1/camera_info
  15. /camera/infra1/image_rect_raw
  16. /camera/infra1/metadata
  17. /camera/infra2/camera_info
  18. /camera/infra2/image_rect_raw
  19. /camera/infra2/metadata
  20. /camera/motion_module/parameter_descriptions
  21. /camera/motion_module/parameter_updates
  22. /camera/realsense2_camera_manager/bond
  23. /camera/rgb_camera/auto_exposure_roi/parameter_descriptions
  24. /camera/rgb_camera/auto_exposure_roi/parameter_updates
  25. /camera/rgb_camera/parameter_descriptions
  26. /camera/rgb_camera/parameter_updates
  27. /camera/stereo_module/auto_exposure_roi/parameter_descriptions
  28. /camera/stereo_module/auto_exposure_roi/parameter_updates
  29. /camera/stereo_module/parameter_descriptions
  30. /camera/stereo_module/parameter_updates
  31. /diagnostics
  32. /rosout
  33. /rosout_agg
  34. /tf
  35. /tf_static

运行 vins-fusion 相关 launch 配置文件,使用vins-fusion算法估计无人机位姿

  1. source ~/catkin_ws/devel/setup.bash
  2. rosrun vins vins_node /root/catkin_ws/src/VINS-Fusion/config/realsense_d435i/realsense_stereo_imu_config.yaml

调用rviz可视化运动轨迹和地图

rviz -d ~/catkin_ws/src/VINS-Fusion/config/vins_rviz_config.rviz
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/1002888
推荐阅读
相关标签
  

闽ICP备14008679号