• ROS2机器人f1tenth之CLI工具基础


    案例适用于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命令:

    1. zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 -h
    2. usage: ros2 [-h] [--use-python-default-buffering] Call `ros2 <command> -h` for more detailed usage. ...
    3. ros2 is an extensible command-line tool for ROS 2.
    4. options:
    5. -h, --help show this help message and exit
    6. --use-python-default-buffering
    7. Do not force line buffering in stdout and instead use the python default buffering, which
    8. might be affected by PYTHONUNBUFFERED/-u and depends on whatever stdout is interactive or not
    9. Commands:
    10. action Various action related sub-commands
    11. bag Various rosbag related sub-commands
    12. component Various component related sub-commands
    13. daemon Various daemon related sub-commands
    14. doctor Check ROS setup and other potential issues
    15. interface Show information about ROS interfaces
    16. launch Run a launch file
    17. lifecycle Various lifecycle related sub-commands
    18. multicast Various multicast related sub-commands
    19. node Various node related sub-commands
    20. param Various param related sub-commands
    21. pkg Various package related sub-commands
    22. run Run a package specific executable
    23. security Various security related sub-commands
    24. service Various service related sub-commands
    25. topic Various topic related sub-commands
    26. wtf Use `wtf` as alias to `doctor`
    27. 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 
    1. zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 topic list
    2. /bond
    3. /clicked_point
    4. /clock
    5. /cmd_vel
    6. /diagnostics
    7. /drive
    8. /ego_racecar/odom
    9. /ego_robot_description
    10. /goal_pose
    11. /initialpose
    12. /joint_states
    13. /map
    14. /map_server/transition_event
    15. /map_updates
    16. /parameter_events
    17. /rosout
    18. /scan
    19. /tf
    20. /tf_static
    21. zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 service list
    22. /bridge/describe_parameters
    23. /bridge/get_parameter_types
    24. /bridge/get_parameters
    25. /bridge/list_parameters
    26. /bridge/set_parameters
    27. /bridge/set_parameters_atomically
    28. /ego_robot_state_publisher/describe_parameters
    29. /ego_robot_state_publisher/get_parameter_types
    30. /ego_robot_state_publisher/get_parameters
    31. /ego_robot_state_publisher/list_parameters
    32. /ego_robot_state_publisher/set_parameters
    33. /ego_robot_state_publisher/set_parameters_atomically
    34. /lifecycle_manager_localization/describe_parameters
    35. /lifecycle_manager_localization/get_parameter_types
    36. /lifecycle_manager_localization/get_parameters
    37. /lifecycle_manager_localization/is_active
    38. /lifecycle_manager_localization/list_parameters
    39. /lifecycle_manager_localization/manage_nodes
    40. /lifecycle_manager_localization/set_parameters
    41. /lifecycle_manager_localization/set_parameters_atomically
    42. /map_server/change_state
    43. /map_server/describe_parameters
    44. /map_server/get_available_states
    45. /map_server/get_available_transitions
    46. /map_server/get_parameter_types
    47. /map_server/get_parameters
    48. /map_server/get_state
    49. /map_server/get_transition_graph
    50. /map_server/list_parameters
    51. /map_server/load_map
    52. /map_server/map
    53. /map_server/set_parameters
    54. /map_server/set_parameters_atomically
    55. /rviz/describe_parameters
    56. /rviz/get_parameter_types
    57. /rviz/get_parameters
    58. /rviz/list_parameters
    59. /rviz/set_parameters
    60. /rviz/set_parameters_atomically
    61. zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 node list
    62. /bridge
    63. /ego_robot_state_publisher
    64. /lifecycle_manager_localization
    65. /map_server
    66. /rviz
    67. /transform_listener_impl_55c114fc5430
    68. zhangrelay@LAPTOP-5REQ7K1L:~$ ros2 action list

    rqt 或 rqt --force-discover

     rqt --help
    usage: main.py [-b BINDING] [--clear-config] [-f] [--force-discover] [-h] [-ht] [-l] [-p PERSPECTIVE]
                   [--perspective-file PERSPECTIVE_FILE] [--reload-import] [-s PLUGIN] [-t] [-v]
                   [--args [PLUGIN_ARGS ...]] [--list-perspectives] [--list-plugins] [--command-pid PID]
                   [--command-start-plugin PLUGIN] [--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.


    ---


     

  • 相关阅读:
    MIUI查看当前手机电池容量
    【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
    云课五分钟-0B快速排序C++示例代码-注释和编译指令
    HTML下雪/烟花
    FW Read protection in code level
    设计模式之访问者模式
    FPGA学习笔记(十三)负数运算
    Fiddler - The system proxy was changed. Click to reenable capturing.
    自学(网络安全)黑客——高效学习2024
    神经网络如何避免过拟合,神经网络过度拟合
  • 原文地址:https://blog.csdn.net/ZhangRelay/article/details/125513972