Challenge - 5 Problems
Marker Visualization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat will this ROS Marker display code show in RViz?
Consider this ROS Python snippet that publishes a visualization marker. What shape and color will appear in RViz?
ROS
import rospy from visualization_msgs.msg import Marker rospy.init_node('marker_test') pub = rospy.Publisher('visualization_marker', Marker, queue_size=10) marker = Marker() marker.header.frame_id = 'map' marker.type = Marker.SPHERE marker.action = Marker.ADD marker.pose.position.x = 1.0 marker.pose.position.y = 2.0 marker.pose.position.z = 0.0 marker.scale.x = 0.5 marker.scale.y = 0.5 marker.scale.z = 0.5 marker.color.r = 1.0 marker.color.g = 0.0 marker.color.b = 0.0 marker.color.a = 1.0 rate = rospy.Rate(1) while not rospy.is_shutdown(): marker.header.stamp = rospy.Time.now() pub.publish(marker) rate.sleep()
Attempts:
2 left
💡 Hint
Check the marker type and color values carefully.
✗ Incorrect
The marker type is SPHERE, scale sets the size, and color is red with full opacity (alpha=1). Position is set at (1, 2, 0).
📝 Syntax
intermediateWhich option fixes the syntax error in this ROS Marker message setup?
This code snippet tries to set a marker's scale but has a syntax error. Which option corrects it?
ROS
marker.scale.x = 1.0 marker.scale.y = 1.0 marker.scale.z = 1.0 marker.color.r = 0.0 marker.color.g = 1.0 marker.color.b = 0.0 marker.color.a = 1.0 marker.type = Marker.CUBE marker.action = Marker.ADD marker.pose.position.x = 0.0 marker.pose.position.y = 0.0 marker.pose.position.z = 0.0 marker.header.frame_id = 'base_link' marker.header.stamp = rospy.Time.now() pub.publish(marker)
Attempts:
2 left
💡 Hint
Look carefully at the parentheses in the last line.
✗ Incorrect
The publish call is missing a closing parenthesis. Adding it fixes the syntax error.
❓ state_output
advancedWhat is the effect of changing marker.action to Marker.DELETE in this ROS Marker publisher?
Given a marker published repeatedly with action Marker.ADD, what happens if you publish the same marker with action Marker.DELETE?
ROS
marker.action = Marker.DELETE pub.publish(marker)
Attempts:
2 left
💡 Hint
Think about what DELETE action means for visualization markers.
✗ Incorrect
Marker.DELETE removes the marker with the same namespace and ID from the display.
🔧 Debug
advancedWhy does this ROS Marker not appear in RViz despite publishing?
This code publishes a marker but nothing shows in RViz. What is the most likely cause?
ROS
marker = Marker() marker.header.frame_id = 'map' marker.type = Marker.CUBE marker.action = Marker.ADD marker.pose.position.x = 0 marker.pose.position.y = 0 marker.pose.position.z = 0 marker.scale.x = 1 marker.scale.y = 1 marker.scale.z = 1 marker.color.r = 0 marker.color.g = 0 marker.color.b = 1 marker.color.a = 0 marker.id = 0 marker.ns = 'test' pub.publish(marker)
Attempts:
2 left
💡 Hint
Check the color alpha channel carefully.
✗ Incorrect
Alpha=0 means fully transparent, so the marker is invisible even though published.
🧠 Conceptual
expertHow does the 'frame_id' in a ROS Marker affect its visualization in RViz?
Why is setting the correct 'frame_id' in a Marker message crucial for proper visualization in RViz?
Attempts:
2 left
💡 Hint
Think about how RViz uses coordinate frames to place objects in 3D space.
✗ Incorrect
The frame_id tells RViz which coordinate system to use for the marker's pose, so it appears in the right place relative to other data.
