前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ROS2机器人f1tenth之CLI工具基础

ROS2机器人f1tenth之CLI工具基础

作者头像
zhangrelay
发布2022-06-30 15:03:03
4100
发布2022-06-30 15:03:03
举报
文章被收录于专栏:机器人课程与技术

案例适用于ROS2如下三个版本:

  1. humble
  2. galactic
  3. foxy

适用于win/linux/macos。

为何选择f1tenth,延续性,之前使用f1tenth的ros1进行案例讲解。

具体可以参考如下链接:

蓝桥ROS之f1tenth简单PID沿墙跑起来(Python)


ROS2基础教程可以参考:

ROS2机器人个人教程博客汇总(2021共6套)


课程教程迭代更新只有进行时,没有完成时。 f1tenth资源需求量非常小,适合课程教学,并无缝支持云端实践,以此为主。


善于使用各类帮助文档,例如:

ros2 -h

命令会列出所有ros2的CLI命令:

代码语言:javascript
复制
zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 -h
usage: ros2 [-h] [--use-python-default-buffering] Call `ros2 <command> -h` for more detailed usage. ...

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

options:
  -h, --help            show this help message and exit
  --use-python-default-buffering
                        Do not force line buffering in stdout and instead use the python default buffering, which
                        might be affected by PYTHONUNBUFFERED/-u and depends on whatever stdout is interactive or not

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
  topic      Various topic related sub-commands
  wtf        Use `wtf` as alias to `doctor`

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

默认系统环境导入:

source /opt/ros/humble/setup.bash

自定义功能包环境导入,在对应文件夹下:

~/ros_ws/f1tenth_gym_ros$ source install/setup.sh

查看系统变量:

printenv | grep -i ROS 


使用F1tenth和rqt:

~/ros_ws/f1tenth_gym_ros$ ros2 launch f1tenth_gym_ros gym_bridge_launch.py

试一试如下命令:

  • ros2 node list
  • ros2 topic list
  • ros2 service list
  • ros2 action list 
代码语言:javascript
复制
zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 topic list
/bond
/clicked_point
/clock
/cmd_vel
/diagnostics
/drive
/ego_racecar/odom
/ego_robot_description
/goal_pose
/initialpose
/joint_states
/map
/map_server/transition_event
/map_updates
/parameter_events
/rosout
/scan
/tf
/tf_static
zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 service list
/bridge/describe_parameters
/bridge/get_parameter_types
/bridge/get_parameters
/bridge/list_parameters
/bridge/set_parameters
/bridge/set_parameters_atomically
/ego_robot_state_publisher/describe_parameters
/ego_robot_state_publisher/get_parameter_types
/ego_robot_state_publisher/get_parameters
/ego_robot_state_publisher/list_parameters
/ego_robot_state_publisher/set_parameters
/ego_robot_state_publisher/set_parameters_atomically
/lifecycle_manager_localization/describe_parameters
/lifecycle_manager_localization/get_parameter_types
/lifecycle_manager_localization/get_parameters
/lifecycle_manager_localization/is_active
/lifecycle_manager_localization/list_parameters
/lifecycle_manager_localization/manage_nodes
/lifecycle_manager_localization/set_parameters
/lifecycle_manager_localization/set_parameters_atomically
/map_server/change_state
/map_server/describe_parameters
/map_server/get_available_states
/map_server/get_available_transitions
/map_server/get_parameter_types
/map_server/get_parameters
/map_server/get_state
/map_server/get_transition_graph
/map_server/list_parameters
/map_server/load_map
/map_server/map
/map_server/set_parameters
/map_server/set_parameters_atomically
/rviz/describe_parameters
/rviz/get_parameter_types
/rviz/get_parameters
/rviz/list_parameters
/rviz/set_parameters
/rviz/set_parameters_atomically
zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 node list
/bridge
/ego_robot_state_publisher
/lifecycle_manager_localization
/map_server
/rviz
/transform_listener_impl_55c114fc5430
zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 action list

rqt 或 rqt --force-discover

 rqt --help usage: main.py -b BINDING -f -h -l                --perspective-file PERSPECTIVE_FILE -s PLUGIN -v--args PLUGIN_ARGS ...] --list-perspectives --command-pid PID --command-switch-perspective PERSPECTIVE Options for GUI instance:   -b BINDING, --qt-binding BINDING                         choose Qt bindings to be used pyqt|pyside   --clear-config        clear the configuration (including all perspectives and plugin settings)   -f, --freeze-layout   freeze the layout of the GUI (prevent rearranging widgets, disable undock/redock)   --force-discover      force a rediscover of plugins   -h, --help            show this help message and exit   -ht, --hide-title     hide the title label, the icon, and the help button (combine with -l and -f to eliminate the                         entire title bar and reclaim the space)   -l, --lock-perspective                         lock the GUI to the used perspective (hide menu bar and close buttons of plugins)   -p PERSPECTIVE, --perspective PERSPECTIVE                         start with this named perspective   --perspective-file PERSPECTIVE_FILE                         start with a perspective loaded from a file   --reload-import       reload every imported module   -s PLUGIN, --standalone PLUGIN                         start only this plugin (implies -l). To pass arguments to the plugin use --args   -t, --on-top          set window mode to always on top   -v, --verbose         output qDebug messages   --args PLUGIN_ARGS ...                         arbitrary arguments which are passes to the plugin (only with -s, --command-start-plugin or                         --embed-plugin). It must be the last option since it collects all following options. Options to query information without starting a GUI instance:   These options can be used to query information about valid arguments for various options.   --list-perspectives   list available perspectives   --list-plugins        list available plugins Options to operate on a running GUI instance:   These options can be used to perform actions on a running GUI instance.   --command-pid PID     pid of the GUI instance to operate on, defaults to oldest running GUI instance   --command-start-plugin PLUGIN                         start plugin   --command-switch-perspective PERSPECTIVE                         switch perspective Special options for embedding widgets from separate processes:   These options should never be used on the CLI but only from the GUI code itself.




本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022-06-29,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档