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

defining array size in custom message using constant

asked 2012-12-12 07:12:22 -0500

emdr gravatar image

updated 2012-12-12 07:13:42 -0500

I'd like to define the size of an array in a message definition using a constant like this:

int32 NUM_NODES = 128

int32[NUM_NODES]  nodes

This doesn't work. I get the following error:

  [  5%] Generating ../msg_gen/lisp/RAW_CONFIG.lisp, ../msg_gen/lisp/_package.lisp, ../msg_gen/lisp/_package_RAW_CONFIG.lisp
  Traceback (most recent call last):
    File "/opt/ros/fuerte/share/roslisp/rosbuild/scripts/", line 871, in <module>
    File "/opt/ros/fuerte/share/roslisp/rosbuild/scripts/", line 725, in generate_msg
      (_, spec) = roslib.msgs.load_from_file(msg_path, package)
    File "/opt/ros/fuerte/lib/python2.7/dist-packages/roslib/", line 669, in load_from_file
      raise MsgSpecException('%s: %s'%(file_name, e))
  roslib.msgs.MsgSpecException: RAW_CONFIG.msg: int32[NUM_NODES] is not a legal message type

Is there a workaround?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-12-12 23:05:26 -0500

Lorenz gravatar image

The message generators do not support this feature. You cannot define the array size using a constant.

edit flag offensive delete link more

Question Tools


Asked: 2012-12-12 07:12:22 -0500

Seen: 1,592 times

Last updated: Dec 12 '12