rospy rviz markers [closed]
Hi!
I'm having some difficulty getting my MarkerArray to show up in rviz. When I run the code, no namespace nor markers appear under the visualization_marker_array
topic. I'm using 3 arrays: x_points
, y_points
, and yaw_points
and this function:
import tf
import visualization_msgs
from visualization_msgs.msg import MarkerArray, Marker
from geometry_msgs.msg import Point, Quaternion, Vector3
from std_msgs.msg import ColorRGBA
def show_markers(x_points, y_points, yaw_points):
array = MarkerArray()
pub = rospy.Publisher('/visualization_marker_array', MarkerArray, queue_size=100)
for i in range(0, len(x_points)):
mk = Marker()
mk.header.frame_id = '/map'
mk.header.stamp = rospy.Time()
mk.ns = 'goals'
mk.id = i
mk.type = 2
mk.action = 0
quat = tf.transformations.quaternion_from_euler(0.0, 0.0, yaw_points[i])
mk.pose.orientation = Quaternion(*quat)
mk.pose.position = Point(x_points[i], y_points[i], 0.0)
mk.scale = Vector3(1.0, 1.0, 1.0)
mk.color = ColorRGBA(0.0, 1.0, 0.0, 1.0)
array.markers.append(mk)
pub.publish(array)
Thank you for any suggestions!
What is this a duplicate of?
Please always link to the duplicate.