蓝桥ROS机器人之ROS1和ROS2切换

举报
zhangrelay 发表于 2022/03/28 00:30:21 2022/03/28
【摘要】 首先,确保完成配置: ☞  蓝桥ROS机器人系统更新和功能包安装记录 为了确保安装速度,请使用国内源: sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_rel...

首先,确保完成配置:

☞  蓝桥ROS机器人系统更新和功能包安装记录


为了确保安装速度,请使用国内源:

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
 

如果功能包不全:

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
 

 

ROS1:

source /opt/ros/kinetic/setup.bash

source /opt/ros/kinetic/setup.zsh

ROS2:

source /opt/ros/ardent/setup.bash

source /opt/ros/ardent/setup.zsh

 

如果弄成开启终端可切换的模式使用:


  
  1. echo "ros1 kinetic(1) or ros2 ardent(2)?"
  2. read edition
  3. if [ "$edition" -eq "1" ];then
  4. source /opt/ros/kinetic/setup.bash
  5. else
  6. source /opt/ros/ardent/setup.bash
  7. fi

zsh


  
  1. echo "ros1 kinetic(1) or ros2 ardent(2)?"
  2. read edition
  3. if [ "$edition" -eq "1" ];then
  4. source /opt/ros/kinetic/setup.zsh
  5. else
  6. source /opt/ros/ardent/setup.zsh
  7. fi

1


  
  1. ros1 kinetic(1) or ros2 ardent(2)?
  2. 1
  3. shiyanlou:~/ $ roscore [12:42:50]
  4. ... logging to /home/shiyanlou/.ros/log/416da02c-ad02-11ec-a8a5-0242c0a82a04/roslaunch-5a0e7854a36d-27253.log
  5. Checking log directory for disk usage. This may take awhile.
  6. Press Ctrl-C to interrupt
  7. Done checking log file disk usage. Usage is <1GB.
  8. started roslaunch server http://5a0e7854a36d:34373/
  9. ros_comm version 1.12.17
  10. SUMMARY
  11. ========
  12. PARAMETERS
  13. * /rosdistro: kinetic
  14. * /rosversion: 1.12.17
  15. NODES
  16. auto-starting new master
  17. process[master]: started with pid [27263]
  18. ROS_MASTER_URI=http://5a0e7854a36d:11311/
  19. setting /run_id to 416da02c-ad02-11ec-a8a5-0242c0a82a04
  20. process[rosout-1]: started with pid [27276]
  21. started core service [/rosout]

2


  
  1. ros1 kinetic(1) or ros2 ardent(2)?
  2. 2
  3. shiyanlou:~/ $ ros2 [12:48:42]
  4. usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
  5. ros2: error: the following arguments are required: Call `ros2 <command> -h` for more detailed usage.
  6. shiyanlou:~/ $ ros2 -h [12:48:46]
  7. usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
  8. ros2 is an extensible command-line tool for ROS 2.
  9. optional arguments:
  10. -h, --help show this help message and exit
  11. Commands:
  12. daemon Various daemon related sub-commands
  13. msg Various msg related sub-commands
  14. node Various node related sub-commands
  15. pkg Various package related sub-commands
  16. run Run a package specific executable
  17. security Various security related sub-commands
  18. service Various service related sub-commands
  19. srv Various srv related sub-commands
  20. topic Various topic related sub-commands
  21. Call `ros2 <command> -h` for more detailed usage.
  22. shiyanlou:~/ $ [12:48:51]

 

printenv | grep ROS
 

ROS1:

 

ROS2:

 

 


指令记录如下:


  
  1. 26 gedit .bashrc
  2. 27 gedit .zshrc
  3. 28 roscore
  4. 29 ros2
  5. 30 ros2 -h
  6. 31 printenv | grep ROS

 

 

文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。

原文链接:zhangrelay.blog.csdn.net/article/details/123762448

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。