jsk-ros-pkg / geneus

3 stars 16 forks source link

when array_len is nil, do not run dotimes... #55

Closed k-okada closed 4 years ago

k-okada commented 7 years ago

to avoid consuing like https://github.com/jsk-ros-pkg/jsk_roseus/issues/544

Message like

MultiArrayDimension[] dim # Array of dimension properties
uint32 data_offset        # padding elements at front of data

is converted to

(defmethod std_msgs::MultiArrayLayout
  (:init
   (&key
    ((:dim __dim) (let (r) (dotimes (i 0) (push (instance std_msgs::MultiArrayDimension :init) r)) r)) 
;;何もしていない
    ((:data_offset __data_offset) 0)
    )

which seems we can write something like

(instnace std_msgs::MultiArrayLayout :init :dim 10)

but this is not correct, we should write something like

(instance std_msgs::MultiArrayLayout :init :dim (let (r) (dotimes (i 10) (push (instance std_msgs::MultiArrayDimension :init) r))))