使用catkin_create_pkg命令创建rospkg时出现错误: argument --rosdistro is required 的解决方法

文章目录

  • 1 问题描述
  • 2 解决方法

1 问题描述

创建一个ros包时需要用到catkin_create_pkg命令,其语法为:

catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

但是当我按照这个方式进行操作时出现以下错误:

$ catkin_create_pkg trans_msg std_msgs rospy roscpp
usage: catkin_create_pkg [-h] [--meta] [-s [SYS_DEPS [SYS_DEPS ...]]]
                         [-b [BOOST_COMPS [BOOST_COMPS ...]]] [-V PKG_VERSION]
                         [-D DESCRIPTION] [-l LICENSE] [-a AUTHOR]
                         [-m MAINTAINER] --rosdistro ROSDISTRO
                         name [dependencies [dependencies ...]]
catkin_create_pkg: error: argument --rosdistro is required

2 解决方法

根据错误提示,我们需要在命令中添加指示ros 版本的一个参数,也就是系统认可的命令格式变为:

catkin_create_pkg --rosdistro <rosdistro> name [dependencies [dependencies ...]]

我的ros版本为kinetic,所以我的命令相应变为:

catkin_create_pkg --rosdistro kinetic trans_msg std_msgs rospy roscpp

然后就成功创建一个rospkg了:

msg std_msgs rospy roscpp
Created file trans_msg/package.xml
Created file trans_msg/CMakeLists.txt
Created folder trans_msg/include/trans_msg
Created folder trans_msg/src
Successfully created files in /home/jk/catkin_ws/src/trans_msg. Please adjust the values in package.xml.

你可能感兴趣的:(ROS)