在ROS中编译自定义消息时发生以下错误

在ROS中编译自定义消息时发生以下错误,ros,Ros,下面是关于如何创建ROS自定义消息的“WS-Newman”教程。编译“邮件/服务'example\u msg/Num'的依赖项已更改。请重新运行cmake”时发生以下错误 Num.msg有 Header header int32 demo_int float64 demo_double Cmakelists.txt project(example_msg) find_package(catkin REQUIRED COMPONENTS roscpp std_msgs messag

下面是关于如何创建ROS自定义消息的“WS-Newman”教程。编译“邮件/服务'example\u msg/Num'的依赖项已更改。请重新运行cmake”时发生以下错误

Num.msg有

Header header
int32 demo_int
float64 demo_double
Cmakelists.txt

project(example_msg)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  message_generation
)
add_message_files(
   FILES
   Num.msg
#   Message2.msg
)
generate_messages(
 DEPENDENCIES
 std_msgs
 )
catkin_package(

CATKIN_DEPENDS message_runtime
)
include_directories(
  include ${catkin_INCLUDE_DIRS}
# include
  ${catkin_INCLUDE_DIRS}
)
add_executable(example_ros_message_publisher
  src/example_ros_message_publisher.cpp
)
add_dependencies(example_ros_message_publisher ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(example_ros_message_publisher
  ${catkin_LIBRARIES}
)
package.xml

<package format="2">
  <name>example_msg</name>
  <version>0.0.0</version>
  <description>The example_msg package</description>
    <maintainer email="asiri@todo.todo">asiri</maintainer>
  <license>TODO</license>
    <build_depend>message_generation</build_depend>
     <exec_depend>message_runtime</exec_depend> 
   <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <export>
     </export>
</package>

示例\u msg
0.0.0
示例_msg包
阿西里
待办事项
消息生成
消息运行时
柳絮
roscpp
标准msgs
roscpp
标准msgs
roscpp
标准msgs
示例\u ros\u message\u publisher.cpp

#include <ros/ros.h>
#include <example_msg/Num.h>
#include <math.h>

int main(int argc, char **argv) {
    ros::init(argc, argv, "example_ros_message_publisher"); // name of this node 
    ros::NodeHandle n; // two lines to create a publisher object that can talk to ROS
    ros::Publisher my_publisher_object = n.advertise<example_msg::Num>("example_topic", 1);
    //"example_topic" is the name of the topic to which we will publish
    // the "1" argument says to use a buffer size of 1; could make larger, if expect network backups

    example_msg::Num  my_new_message;
    //create a variable of type "example_msg", 
    // as defined in this package

   ros::Rate naptime(1.0); //create a ros object from the ros “Rate” class; 
   //set the sleep timer for 1Hz repetition rate (arg is in units of Hz)

   // put some data in the header.  Do: rosmsg show std_msgs/Header
   //  to see the definition of "Header" in std_msgs
    my_new_message.header.stamp = ros::Time::now(); //set the time stamp in the header;
    my_new_message.header.seq=0; // call this sequence number zero
    my_new_message.header.frame_id = "base_frame"; // would want to put true reference frame name here, if needed for coord transforms
    my_new_message.demo_int= 1;
    my_new_message.demo_double=100.0;

    double sqrt_arg;
    // do work here in infinite loop (desired for this example), but terminate if detect ROS has faulted
    while (ros::ok()) 
    {
       my_new_message.header.seq++; //increment the sequence counter
       my_new_message.header.stamp = ros::Time::now(); //update the time stamp
       my_new_message.demo_int*=2.0; //double the integer in this field
       sqrt_arg = my_new_message.demo_double;
       my_new_message.demo_double = sqrt(sqrt_arg);

        my_publisher_object.publish(my_new_message); // publish the data in new message format on topic "example_topic"
    //the next line will cause the loop to sleep for the balance of the desired period 
        // to achieve the specified loop frequency 
    naptime.sleep(); 
    }
}
#包括
#包括
#包括
int main(int argc,字符**argv){
ros::init(argc,argv,“示例ros消息发布者”);//此节点的名称
ros::NodeHandle n;//两行代码创建一个可以与ros对话的发布者对象
ros::Publisher my\u Publisher\u object=n.adversed(“示例主题”,1);
//“example_topic”是我们将发布到的主题的名称
//“1”参数表示使用1的缓冲区大小;如果需要网络备份,则可能会使缓冲区变大
示例_msg::Num my_new_消息;
//创建类型为“example_msg”的变量,
//如本文件包中所定义
ros::Rate naptime(1.0);//从ros“Rate”类创建一个ros对象;
//将睡眠计时器设置为1Hz重复频率(arg以Hz为单位)
//在标题中放入一些数据。Do:rosmsg show std_msgs/header
//查看std_msgs中“标题”的定义
my_new_message.header.stamp=ros::Time::now();//在头中设置时间戳;
my_new_message.header.seq=0;//将此序列号称为零
my_new_message.header.frame_id=“base_frame”;//如果需要进行坐标变换,则希望在此处输入真实的参考帧名称
my_new_message.demo_int=1;
my_new_message.demo_double=100.0;
双sqrt_参数;
//在无限循环中工作(本例中需要),但如果检测ROS出现故障,则终止
while(ros::ok())
{
my_new_message.header.seq++;//递增序列计数器
my_new_message.header.stamp=ros::Time::now();//更新时间戳
my_new_message.demo_int*=2.0;//此字段中的整数加倍
sqrt_arg=my_new_message.demo_double;
my_new_message.demo_double=sqrt(sqrt_arg);
my_publisher_object.publish(my_new_message);//以新消息格式发布主题“example_topic”上的数据
//下一行将使循环休眠到所需周期的平衡
//以达到指定的环路频率
午睡时间;
}
}
当我运行catkin_使安装出现以下错误。 “邮件/服务'example\u msg/Num'的依赖项已更改。请重新运行cmake。”

catkin中的错误。 要触发更深层次的重建,可以触摸包含
示例消息/Num
的包的
CMakeLists.txt
文件