ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Trouble Building Messages: Invalid Declaration 'float32'

asked 2019-07-30 13:38:28 -0600

teddybouch gravatar image

I'm trying to define a simple message for a larger suite of messages that just defines the limits of some attribute by containing a maximum and a minimum value. So I defined the following message as Limits.msg:

float32 minimum
float32 maximum

The CMakeLists.txt is very simple right now while I debug this issue:

cmake_minimum_required(VERSION 2.8.3)
project(test_msgs)

find_package(catkin REQUIRED
  COMPONENTS
    std_msgs
    message_generation
)

add_message_files(
  FILES
  Limits.msg
  GPSFix.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

catkin_package(
  CATKIN_DEPENDS
  std_msgs
)

I'm keeping GPSFix.msg in there because it's another simple message that builds just fine for some reason. In any case, if I catkin_make from the catkin workspace, I get this:

ava@3b97b310abf0:~/workspace/test_msgs$ catkin_make
Base path: /home/ava/workspace/test_msgs
Source space: /home/ava/workspace/test_msgs/src
Build space: /home/ava/workspace/test_msgs/build
Devel space: /home/ava/workspace/test_msgs/devel
Install space: /home/ava/workspace/test_msgs/install
####
#### Running command: "cmake /home/ava/workspace/test_msgs/src -DCATKIN_DEVEL_PREFIX=/home/ava/workspace/test_msgs/devel -DCMAKE_INSTALL_PREFIX=/home/ava/workspace/test_msgs/install -G Unix Makefiles" in "/home/ava/workspace/test_msgs/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ava/workspace/test_msgs/devel
-- Using CMAKE_PREFIX_PATH: /home/ava/workspace/sci288ava/devel;/home/ava/workspace/ava_ros/devel;/home/ava/workspace/ros_ivp/devel;/opt/ros/kinetic;/home/ava/CMake/Modules/
-- This workspace overlays: /home/ava/workspace/sci288ava/devel;/home/ava/workspace/ava_ros/devel;/home/ava/workspace/ros_ivp/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ava/workspace/test_msgs/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - test_msgs
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'test_msgs'
-- ==> add_subdirectory(test_msgs/test_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
/opt/ros/kinetic/share/genmsg/cmake/pkg-genmsg.cmake.em:56: error: <class 'genmsg.base.InvalidMsgSpec'>: /home/ava/workspace/test_msgs/src/test_msgs/test_msgs/msg/Limits.msg: Invalid declaration: float32 minimum
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 "<string>", line 1, in <module>
  File "<string> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-07-31 06:55:35 -0600

teddybouch gravatar image

Apparently the problem was that I used tabs in my msg file rather than spaces; as soon as I replaced the tabs, it compiled just fine. I don't understand why this would be an issue, but for anyone else who might run into this, it's something to try.

edit flag offensive delete link more

Comments

It solved my problem too. Thanks.

I also wonder why this would be a problem.

j.clownz gravatar image j.clownz  ( 2020-01-31 06:27:18 -0600 )edit

Crazy, but true, thank you 8). I also noticed that the first whitespace after the type has to be space, after which you can use tabs.

gbohus gravatar image gbohus  ( 2020-09-01 08:18:38 -0600 )edit

Question Tools

Stats

Asked: 2019-07-30 13:38:28 -0600

Seen: 1,112 times

Last updated: Jul 31 '19