zl程序教程

您现在的位置是:首页 >  其他

当前栏目

机器人编程趣味实践18-他山之石(功能包)

2023-03-31 10:31:37 时间

机器人操作系统功能包可以使用如下两种方式使用:

  1. sudo apt install xxx
  2. colcon build xxx

第一种是打包的安装文件,第二种是源代码编译。

如何自己编写功能包后续细说,本节介绍如何使用github下载的功能包源码编译使用。

先上一个思考题:

模型之简

模型之细

代码也是类似,有极简风,也有全家福

现在很多APP界面很精美,但其内核其实并不复杂,大量的工作放在了如何吸引用户的眼球上。

github下载速度?

  • git clone https://github.com/ros-planning/moveit2_tutorials.git
  • git clone https://github.com.cnpmjs.org/ros-planning/moveit2_tutorials.git

编译工具

colcon

zhangrelay@ros2fun:~$ colcon -h
usage: colcon [-h] [--log-base LOG_BASE] [--log-level LOG_LEVEL]
              {build,extension-points,extensions,graph,info,list,metadata,test,test-result,version-check} ...

optional arguments:
  -h, --help            show this help message and exit
  --log-base LOG_BASE   The base path for all log directories (default: ./log, to disable: /dev/null)
  --log-level LOG_LEVEL
                        Set log level for the console output, either by numeric or string value (default: warning)

colcon verbs:
  build                 Build a set of packages
  extension-points      List extension points
  extensions            List extensions
  graph                 Generate a visual representation of the dependency graph
  info                  Package information
  list                  List packages, optionally in topological ordering
  metadata              Manage metadata of packages
  test                  Test a set of packages
  test-result           Show the test results generated when testing a set of
                        packages
  version-check         Compare local package versions with PyPI

  {build,extension-points,extensions,graph,info,list,metadata,test,test-result,version-check}
                        call `colcon VERB -h` for specific help

Environment variables:
  CMAKE_COMMAND         The full path to the CMake executable
  COLCON_ALL_SHELLS     Flag to enable all shell extensions
  COLCON_COMPLETION_LOGFILE
                        Set the logfile for completion time
  COLCON_DEFAULTS_FILE  Set path to the yaml file containing the default values
                        for the command line arguments (default:
                        $COLCON_HOME/defaults.yaml)
  COLCON_DEFAULT_EXECUTOR
                        Select the default executor extension
  COLCON_EXTENSION_BLOCKLIST
                        Block extensions which should not be used
  COLCON_HOME           Set the configuration directory (default: ~/.colcon)
  COLCON_LOG_LEVEL      Set the log level (debug|10, info|20, warn|30,
                        error|40, critical|50, or any other positive numeric
                        value)
  COLCON_WARNINGS       Set the warnings filter similar to PYTHONWARNINGS
                        except that the module entry is implicitly set to
                        'colcon.*'
  CTEST_COMMAND         The full path to the CTest executable
  POWERSHELL_COMMAND    The full path to the PowerShell executable

For more help and usage tips, see https://colcon.readthedocs.io

colcon build

完成后显示:

如果要使用自编译功能包中的程序,需要:

. install/local_setup.bash

运行

ros2 launch nav2_bringup tb3_simulation_launch.py slam:=True

好不好用呢?

非常稀烂!

特别容易挂

为何呢?是算法不行,还是参数不合适?换个地图试一试?

调参也是一门学问呢^_^

-End-