Robotics StackExchange | Archived questions

Quick way to construct a large ROS message (with a lot of fields)

Hey everyone,

Consider a ROS message type like visualization_msgs/Marker which has a lot of fields. Is there any quick way to construct this message by just passing arguments directly like:
marker = Marker(0, 1, 2, 3 ...)

instead of

marker = Marker()
marker.header.ns = 0
marker.header.id = 1
marker.header.type = 2
marker.header.action = 3

Asked by electrophod on 2022-07-14 03:09:12 UTC

Comments

Refer to rospy Message Initialization.

Asked by abhishek47 on 2022-07-14 08:24:23 UTC

Answers