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

Revision history [back]

click to hide/show revision 1
initial version

According to this page on the wiki, you can use in-order or keyword arguments to initialize the values during construction. Your code would then look like this:

from geometry_msgs.msg import Pose
from std_msgs.msg import ColorRGBA, Header
from visualization_msgs.msg import Marker

red   = ColorRGBA(0.98, 0.30, 0.30, 1.00)
fixed_frame = 'base'
my_marker = Marker(id  = 0,
                   ns = 'my_marker',
                   color = red,
                   action = Marker.ADD,
                   type = Marker.LINE_STRIP,
                   scale = Pose(x=float(line_width)),
                   header = Header(stamp = time, frame_id = fixed_frame))

If you're generating a lot of markers, you might want to look at David Lu!!'s easy_markers package.