Hi,
I'm trying to plot a number of sphere markers at a time, appending them to a MarkerArray and then publishing it, using python. Here's part of my code:
topic = 'visualization_marker_array'
publisher = rospy.Publisher(topic, MarkerArray)
rospy.init_node('register')
markerArray = MarkerArray()
while not rospy.is_shutdown():
# ... here I get the data I want to plot into a vector called trans
marker = Marker()
marker.header.frame_id = "/neck"
marker.type = marker.SPHERE
marker.action = marker.ADD
marker.scale.x = 0.2
marker.scale.y = 0.2
marker.scale.z = 0.2
marker.color.a = 1.0
marker.pose.orientation.w = 1.0
marker.pose.position.x = trans[0]
marker.pose.position.y = trans[1]
marker.pose.position.z = trans[2]
# We add the new marker to the MarkerArray, removing the oldest marker from it when necessary
if(count > MARKERS_MAX):
markerArray.markers.pop(0)
else:
count += 1
markerArray.markers.append(marker)
# Publish the MarkerArray
publisher.publish(markerArray)
However, I'm getting the following warning and no markers are being shown in rviz:
"Could not process inbound connection: topic types do not match: [visualization_msgs/Marker] vs. [visualization_msgs/MarkerArray]{'topic': '/visualization_marker_array', 'tcp_nodelay': '0', 'md5sum': 'bc7602ad2ba78f4cbe1c23250683bdc0', 'type': 'visualization_msgs/Marker', 'callerid': '/rviz_1315381483544111031'}"
Does anyone know how to properly rend a MarkerArray like this?
Thanks in advance
Originally posted by tomurillo on ROS Answers with karma: 55 on 2011-09-06
Post score: 5