rosrun使用错误导致的迷惑行为

rosrun 使用

rosrun [功能包名称] [节点名称]
eg.
rosrun turtlesim turtlesim_node

我的一个错误行为:

rosrun cpoint filter_test.cpp

我让rosrun运行了cpp文件
于是奇怪的事情发生了
我如此运行,catkin_make编译成功了,但是再执行以上命令,会检查到注释错误,莫名的语法错误,会很奇怪,最后发现是rosrun应该运行的是节点,而不是cpp文件。
报错如下:

/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 1: /bin: Is a directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 2: 关于使用sensor_msgs/PointCloud2,: No such file or directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 3: build/: Is a directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 6: //: Is a directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 11: //滤波的头文件: No such file or directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 13: //申明发布器: No such file or directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 14: ros::Publisher: command not found
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 15: //回调函数: No such file or directory
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 16: void: command not found
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 17: syntax error near unexpected token `const'
/home/twilight/project/catkin_ws/src/cpoint/src/filter_test.cpp: line 17: `cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)  //特别注意的是这里面形参的数据格式'

我的cmakelist

cmake_minimum_required(VERSION 3.0.2)
project(cpoint)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  sensor_msgs
  std_msgs
  cv_bridge
  image_transport
  pcl_conversions
  pcl_ros
)
find_package(PCL 1.3 REQUIRED COMPONENTS common io)

################################################
## Declare ROS messages, services and actions ##
################################################

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

###################################
## catkin specific configuration ##
###################################
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES test_pkg
#  CATKIN_DEPENDS roscpp rospy sensor_msgs std_msgs
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

include_directories(
  ${PCL_INCLUDE_DIRS}
)

link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
## add_executable(cpoint src/PointCloud2_to_pcl_node.cpp src/filter_test.cpp)

add_executable(cpoint src/filter_test.cpp)

target_link_libraries(cpoint ${PCL_COMMON_LIBRARIES} ${PCL_IO_LIBRARIES})
target_link_libraries(cpoint ${catkin_LIBRARIES})

给自己气笑了

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值