genmsg.base.InvalidMsgSpec: array is not a legal constant type
According to http://wiki.ros.org/msg , "With the exception of time
and duration
, you may declare any built-in type as a constant."
However, when I try this:
uint8[3] color
uint8[3] BLACK = {0,0,0}
I get:
genmsg.base.InvalidMsgSpec: [...] uint8[3] is not a legal constant type
I've also tried [0,0,0]
and (0,0,0)
but it didn't make a difference. The error is about the the type, not the value. std_msgs/UInt8[3]
didn't work either.
Am I messing up the syntax or is it just that ROS msg constants cannot be arrays?
PS1. My goal here is to create constants for common RGB colors, such as BLACK, RED, GREEN, BLUE.
PS2. Can I somehow leverage std_msgs/ColorRGBA
in order to define these constants in my custom message?
Update: As Dirk's answer points out, arrays of built-in types are not built-in types themselves. For my usecase (RGB colors), I ended up using a single integer to represent the 3 RGB values. See, for example, http://www.shodor.org/stella2java/rgb...