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

Revision history [back]

You could certainly use a std_msgs::Float32MultiArray to publish the data you are trying to publish. See the following answers for some examples on how to use:

  • https://answers.ros.org/question/37185/how-to-initialize-a-uint8multiarray-message/
  • https://answers.ros.org/question/325559/how-can-we-actually-use-float32multiarray-to-publish-2d-array-using-python/
  • https://answers.ros.org/question/211502/mathematical-calculation-on-2d-matriximplementation-of-2-nested-for-loop/
  • https://answers.ros.org/question/234028/how-to-publish-a-2-dimensional-array-of-known-values/
  • https://answers.ros.org/question/226726/push-vector-into-multiarray-message-and-publish-it/

The better question is if you actually _need_ to be publishing a multidimensional array. It might actually be much easier to work with a custom message that had 2 arrays (one for x and one for y).