当前位置: 首页 > news >正文

ROS2进阶:基本指令与RVIZ2介绍

基于windows的ROS2。

在学习ROS的时候,你很可能已经习惯了这个

rosrun rviz rviz

而在ROS2,你只需要直接输入

rviz2

就可以了。

一些基本指令

你可以通过ros2 --help查询所有的的指令,

D:\>ros2 --help
usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...

ros2 is an extensible command-line tool for ROS 2.

optional arguments:
  -h, --help            show this help message and exit

Commands:
  action     Various action related sub-commands
  bag        Various rosbag related sub-commands
  component  Various component related sub-commands
  daemon     Various daemon related sub-commands
  doctor     Check ROS setup and other potential issues
  interface  Show information about ROS interfaces
  launch     Run a launch file
  lifecycle  Various lifecycle related sub-commands
  multicast  Various multicast related sub-commands
  node       Various node related sub-commands
  param      Various param related sub-commands
  pkg        Various package related sub-commands
  run        Run a package specific executable
  security   Various security related sub-commands
  service    Various service related sub-commands
  test       Run a ROS2 launch test
  topic      Various topic related sub-commands
  trace      Trace ROS nodes to get information on their execution
  wtf        Use `wtf` as alias to `doctor`

  Call `ros2 <command> -h` for more detailed usage.

其中有些指令是极常用的,以turtlesim的教学为例,官方开始连续几章教学的主要内容包含的指令大致罗列如下,

ros2 node list
ros2 node info /turtlesim
ros2 node info /teleop_turtle

ros2 topic list
ros2 topic echo <topic_name>
ros2 topic echo /turtle1/cmd_vel
ros2 topic echo /turtle1/pose
ros2 topic hz /turtle1/pose   #注:hz表示频率
ros2 topic info /turtle1/cmd_vel
ros2 interface show geometry_msgs/msg/Twist
ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
ros2 topic pub --rate 1 /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"

ros2 service list
ros2 service type /clear
ros2 service list -t
ros2 service find <type_name>
ros2 service find std_srvs/srv/Empty
ros2 interface show std_srvs/srv/Empty
ros2 interface show turtlesim/srv/Spawn
ros2 service call <service_name> <service_type> <arguments>
ros2 service call /clear std_srvs/srv/Empty
ros2 service call /spawn turtlesim/srv/Spawn "{x: 2, y: 2, theta: 0.2, name: ''}"

ros2 param list
ros2 param get <node_name> <parameter_name>
ros2 param get /turtlesim background_g
ros2 param set <node_name> <parameter_name> <value>
ros2 param set /turtlesim background_r 150
ros2 param dump <node_name>
ros2 param dump /turtlesim  #这在当前目录下会生成一个叫turtlesim.yaml的文件
ros2 param load <node_name> <parameter_file>
ros2 param load /turtlesim ./turtlesim.yaml
ros2 run turtlesim turtlesim_node --ros-args --params-file ./turtlesim.yaml

ros2 action list
ros2 action list -t #注:-t 表示type
ros2 action info /turtle1/rotate_absolute
ros2 interface show turtlesim/action/RotateAbsolute
ros2 action send_goal <action_name> <action_type> <values>
ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}"
ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: -1.57}" --feedback

ROS在官网上对这些指令有详细的介绍,因为很简单,所以这里也不重复。

RVIZ2

未完待续

相关文章:

  • Windows控制台cmd默认代码页修改的办法【GBK、UTF-8】
  • ROS2 ERROR: qt.qpa.plugin: Could not find the Qt platform plugin “windows“ in
  • ROS2 Warning: RosPluginProvider._parse_plugin_xml() plugin file rqt_gui_cpp/plugin.xml not found
  • ROS2进阶:turtlesim与rqt
  • TCP/UDP常见的端口号
  • ROS2进阶:基于cmake创建自己的开发包
  • ROS2进阶:如何查找特定的包(package)并列出包中所有节点(node)
  • ROS2进阶:VS2019调试ROS2-examples程序
  • Python Error: 系统找不到指定的文件。: ‘c:\\python38\\Scripts\\pep8.exe‘ -> ‘c:\\python38\\Scripts\\pep8.exe.del
  • Ubuntu中如何处理难缠的软件包升级
  • 3D进阶之OSG:从VS2019编译osgEarth开始
  • vcpkg如何全面卸载和重新安装包
  • 3D进阶之OSG: VS2019编译OpenSceneGraph
  • 3D进阶之OSG: 编译osgQt(附:Qt的下载与安装)
  • 3D进阶之OSG:如何让vs2019识别不带“.h”的osg头文件
  • ES6系列(二)变量的解构赋值
  • HashMap ConcurrentHashMap
  • JavaWeb(学习笔记二)
  • java第三方包学习之lombok
  • jquery ajax学习笔记
  • Laravel Mix运行时关于es2015报错解决方案
  • Quartz实现数据同步 | 从0开始构建SpringCloud微服务(3)
  • React-flux杂记
  • windows下使用nginx调试简介
  • 产品三维模型在线预览
  • 从地狱到天堂,Node 回调向 async/await 转变
  • 等保2.0 | 几维安全发布等保检测、等保加固专版 加速企业等保合规
  • 力扣(LeetCode)965
  • 面试遇到的一些题
  • 深入浅出webpack学习(1)--核心概念
  • 移动端 h5开发相关内容总结(三)
  • 用Visual Studio开发以太坊智能合约
  • 云栖大讲堂Java基础入门(三)- 阿里巴巴Java开发手册介绍
  • 最简单的无缝轮播
  • hi-nginx-1.3.4编译安装
  • 翻译 | The Principles of OOD 面向对象设计原则
  • # Panda3d 碰撞检测系统介绍
  • #每天一道面试题# 什么是MySQL的回表查询
  • (2)STM32单片机上位机
  • (2022 CVPR) Unbiased Teacher v2
  • (k8s中)docker netty OOM问题记录
  • (vue)el-checkbox 实现展示区分 label 和 value(展示值与选中获取值需不同)
  • (ZT)一个美国文科博士的YardLife
  • (蓝桥杯每日一题)love
  • (蓝桥杯每日一题)平方末尾及补充(常用的字符串函数功能)
  • (十五)devops持续集成开发——jenkins流水线构建策略配置及触发器的使用
  • (循环依赖问题)学习spring的第九天
  • (转)详解PHP处理密码的几种方式
  • *setTimeout实现text输入在用户停顿时才调用事件!*
  • .NET 4.0中的泛型协变和反变
  • .Net 6.0 处理跨域的方式
  • .net 8 发布了,试下微软最近强推的MAUI
  • .NET C#版本和.NET版本以及VS版本的对应关系
  • .NET Project Open Day(2011.11.13)
  • .NET(C#、VB)APP开发——Smobiler平台控件介绍:Bluetooth组件