ROS基础——自定义话题消息

记录自己的BUG,BUG心路历程。

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~$ cd ros
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
Traceback (most recent call last):
  File "/home/warmtree/anaconda3/bin/catkin", line 11, in <module>
    load_entry_point('catkin-tools', 'console_scripts', 'catkin')()
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/commands/catkin.py", line 272, in main
    catkin_main(sysargs)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/commands/catkin.py", line 267, in catkin_main
    sys.exit(args.main(args) or 0)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/verbs/catkin_build/cli.py", line 422, in main
    summarize_build=opts.summarize  # Can be True, False, or None
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/verbs/catkin_build/build.py", line 296, in build_isolated_workspace
    workspace_packages = find_packages(context.source_space_abs, exclude_subspaces=True, warnings=[])
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/packages.py", line 89, in find_packages
    packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/packages.py", line 150, in find_packages_allowing_duplicates
    xml, filename=filename, warnings=warnings)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/package.py", line 771, in parse_package_string
    raise InvalidPackage('Error(s):%s' % (''.join(['\n- %s' % e for e in errors])), filename)
catkin_pkg.package.InvalidPackage: Error(s) in package '/home/warmtree/ros/src/swarm/package.xml':
Error(s):
- The manifest of package "swarm" (with format version 1) must not contain the following tags: exec_depend
- Either update to a newer format or replace <exec_depend> tags with <run_depend> tags.
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
Traceback (most recent call last):
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/package.py", line 596, in parse_package_string
    root = dom.parseString(data)
  File "/home/warmtree/anaconda3/lib/python3.7/xml/dom/minidom.py", line 1968, in parseString
    return expatbuilder.parseString(string)
  File "/home/warmtree/anaconda3/lib/python3.7/xml/dom/expatbuilder.py", line 925, in parseString
    return builder.parseString(string)
  File "/home/warmtree/anaconda3/lib/python3.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 48, column 31

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/warmtree/anaconda3/bin/catkin", line 11, in <module>
    load_entry_point('catkin-tools', 'console_scripts', 'catkin')()
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/commands/catkin.py", line 272, in main
    catkin_main(sysargs)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/commands/catkin.py", line 267, in catkin_main
    sys.exit(args.main(args) or 0)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/verbs/catkin_build/cli.py", line 422, in main
    summarize_build=opts.summarize  # Can be True, False, or None
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_tools/verbs/catkin_build/build.py", line 296, in build_isolated_workspace
    workspace_packages = find_packages(context.source_space_abs, exclude_subspaces=True, warnings=[])
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/packages.py", line 89, in find_packages
    packages = find_packages_allowing_duplicates(basepath, exclude_paths=exclude_paths, exclude_subspaces=exclude_subspaces, warnings=warnings)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/packages.py", line 150, in find_packages_allowing_duplicates
    xml, filename=filename, warnings=warnings)
  File "/home/warmtree/anaconda3/lib/python3.7/site-packages/catkin_pkg/package.py", line 598, in parse_package_string
    raise InvalidPackage('The manifest contains invalid XML:\n%s' % ex, filename)
catkin_pkg.package.InvalidPackage: Error(s) in package '/home/warmtree/ros/src/swarm/package.xml':
The manifest contains invalid XML:
mismatched tag: line 48, column 31
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 1.3 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:check /home/warmtree/ros/logs/swarm/build.check.009.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:69 (generate_messages)


make: *** [cmake_check_build_system] Error 1
cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/make cmake_check_build_system; cd -
...............................................................................
Failed     << swarm:check                [ Exited with code 2 ]                
Failed    <<< swarm                      [ 3.7 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 3.8 seconds total.   

第一次,几何类型Pose在.msg 文件中定义Invalid declaration: geometry_msgs/Point出错,然而当时我没有发现,我以为是在CMakeLists.txt 文件中出错了,BUG在查找中

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ source devel/setup.bash
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:check /home/warmtree/ros/logs/swarm/build.check.010.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:69 (generate_messages)


make: *** [cmake_check_build_system] Error 1
cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/make cmake_check_build_system; cd -
...............................................................................
Failed     << swarm:check                [ Exited with code 2 ]                
Failed    <<< swarm                      [ 0.7 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.7 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:             [env] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Updating package table.                                                
Warning: generated devel space setup files have been deleted.
Starting  >>> catkin_tools_prebuild                                            
Finished  <<< catkin_tools_prebuild                [ 6.0 seconds ]             
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.001.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:69 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                          [ Exited with code 1 ]      
Failed    <<< swarm                                [ 2.4 seconds ]             
Finished  <<< capture_key                          [ 11.1 seconds ]            
[build] Summary: 2 of 3 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 17.3 seconds total.             
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.002.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.8 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.8 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.003.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.7 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.7 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.004.log    
/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
Traceback (most recent call last):
  File "/usr/bin/empy", line 3302, in <module>
    if __name__ == '__main__': main()
  File "/usr/bin/empy", line 3300, in main
    invoke(sys.argv[1:])
  File "/usr/bin/empy", line 3283, in invoke
    interpreter.wrap(interpreter.file, (file, name))
  File "/usr/bin/empy", line 2295, in wrap
    self.fail(e)
  File "/usr/bin/empy", line 2284, in wrap
    callable(*args)
  File "/usr/bin/empy", line 2359, in file
    self.safe(scanner, done, locals)
  File "/usr/bin/empy", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/bin/empy", line 2421, in parse
    token.run(self, locals)
  File "/usr/bin/empy", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/bin/empy", line 2595, in execute
    _exec(statements, self.globals, locals)
  File "/usr/bin/empy", line 42, in _exec
    exec("""exec code in globals""")
  File "", line 1, in <module>
  File "", line 38, in <module>
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/deps.py", line 45, in find_msg_dependencies_with_type
    spec = genmsg.msg_loader.load_msg_from_file(msg_context, msg_file, full_type_name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/genmsg/msg_loader.py", line 289, in load_msg_from_file
    raise InvalidMsgSpec('%s: %s'%(file_path, e))
genmsg.base.InvalidMsgSpec: /home/warmtree/ros/src/swarm/msg/NameAndPose.msg: Invalid declaration: geometry_msgs/Point
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

  execute_process(/home/warmtree/ros/build/swarm/catkin_generated/env_cached.sh
  "/usr/bin/python2" "/usr/bin/empy" "--raw-errors" "-F"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg-context.py" "-o"
  "/home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake"
  "/opt/ros/melodic/share/genmsg/cmake/pkg-genmsg.cmake.em") returned error
  code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:303 (em_expand)
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.7 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.7 seconds total.   

就这样反复更改了N回,每次运行的错误并没有改变。终于,我意识到是.msg 文件写了变量类型却没有给变量名字(,时间浪费中

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.005.log    
CMake Error at /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:263 (message):
  Messages depends on unknown pkg: geometry_msgs/Point (Missing
  'find_package(geometry_msgs/Point)'?)
Call Stack (most recent call first):
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.6 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.6 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.006.log    
CMake Error at /home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake:3 (message):
  Could not find messages which
  '/home/warmtree/ros/src/swarm/msg/NameAndPose.msg' depends on.  Did you
  forget to specify generate_messages(DEPENDENCIES ...)?

  Cannot locate message [geometry_msgs] in package [swarm] with paths
  [['/home/warmtree/ros/src/swarm/msg']]
Call Stack (most recent call first):
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.8 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.8 seconds total.

这回,我学聪明了,观察错误提示Could not find messages which’/home/warmtree/ros/src/swarm/msg/NameAndPose.msg’ depends on. Did you forget to specify generate_messages(DEPENDENCIES …)? catkin build你真善良,原来错误不只有一个,在依赖配置上出错了,回找CMake文件添加

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.007.log    
CMake Error at /home/warmtree/ros/build/swarm/cmake/swarm-genmsg.cmake:3 (message):
  Could not find messages which
  '/home/warmtree/ros/src/swarm/msg/NameAndPose.msg' depends on.  Did you
  forget to specify generate_messages(DEPENDENCIES ...)?

  Cannot locate message [geometry_msgs] in package [swarm] with paths
  [['/home/warmtree/ros/src/swarm/msg']]
Call Stack (most recent call first):
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  CMakeLists.txt:70 (generate_messages)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.8 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.8 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.008.log    
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:196 (message):
  catkin_package() the catkin package 'geometry_msgs' has been
  find_package()-ed but is not listed as a build dependency in the
  package.xml
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:86 (catkin_package)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.9 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.9 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.009.log    
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:196 (message):
  catkin_package() the catkin package 'rospy' has been find_package()-ed but
  is not listed as a build dependency in the package.xml
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:86 (catkin_package)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.8 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.8 seconds total.                                            
(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
_______________________________________________________________________________
Errors     << swarm:cmake /home/warmtree/ros/logs/swarm/build.cmake.010.log    
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:224 (message):
  catkin_package() DEPENDS on the catkin package 'rospy' which must therefore
  be listed as a run dependency in the package.xml
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package)
  CMakeLists.txt:85 (catkin_package)


cd /home/warmtree/ros/build/swarm; catkin build --get-env swarm | catkin env -si  /usr/bin/cmake /home/warmtree/ros/src/swarm --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/warmtree/ros/devel/.private/swarm -DCMAKE_INSTALL_PREFIX=/home/warmtree/ros/install; cd -
...............................................................................
Failed     << swarm:cmake                [ Exited with code 1 ]                
Failed    <<< swarm                      [ 0.9 seconds ]                       
[build] Summary: 1 of 2 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    1 packages failed.                                        
[build] Runtime: 0.9 seconds total.                                            

我多添加了一个rospy,那么相应的CMake文件和.xml 文件都要有相应配套的声明才行,把所有含有stg_msgs 的代码行都重新用rospy写一回才行(,太麻烦了,我干脆就给删了,痛快!!!

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ catkin build
-------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/melodic
Workspace:                   /home/warmtree/ros
-------------------------------------------------------
Build Space:        [exists] /home/warmtree/ros/build
Devel Space:        [exists] /home/warmtree/ros/devel
Install Space:      [unused] /home/warmtree/ros/install
Log Space:          [exists] /home/warmtree/ros/logs
Source Space:       [exists] /home/warmtree/ros/src
DESTDIR:            [unused] None
-------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------
Workspace configuration appears valid.
-------------------------------------------------------
[build] Found '2' packages in 0.0 seconds.                                     
[build] Package table is up to date.                                           
Starting  >>> capture_key                                                      
Starting  >>> swarm                                                            
Finished  <<< capture_key                [ 0.2 seconds ]                       
Finished  <<< swarm                      [ 10.9 seconds ]                      
[build] Summary: All 2 packages succeeded!                                     
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: None.                                                     
[build]   Failed:    None.                                                     
[build] Runtime: 10.9 seconds total.

配置工作终于正确完成了,使用rosmsg show swarm/NameAndPose查看

(base) warmtree@warmtree-HP-Pavilion-Laptop-15-cc5xx:~/ros$ rosmsg show NameAndPose
[swarm/NameAndPose]:
string name
geometry_msgs/Pose Point
  geometry_msgs/Point position
    float64 x
    float64 y
    float64 z
  geometry_msgs/Quaternion orientation
    float64 x
    float64 y
    float64 z
    float64 w 

解决Could not find messages
CMakeLists.txt文件
generate_messages(
DEPENDENCIES geometry_msgs …
)

.xml文件

  >catkin>
  >roscpp>
  >std_msgs>
  >geometry_msgs>
  >roscpp>
  >std_msgs>
  >geometry_msgs>

  >message_generation>
  >message_runtime>

你可能感兴趣的:(ROS基础)