Challenge - 5 Problems
ROS Custom Message Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediateWhat is the output when publishing a custom message with an uninitialized field?
Consider a ROS custom message defined as:
If a node publishes this message but does not set the
int32 id string name float64 value
If a node publishes this message but does not set the
value field, what will be the value received by a subscriber?Attempts:
2 left
💡 Hint
Think about how ROS initializes primitive fields in messages.
✗ Incorrect
In ROS, primitive fields like float64 are initialized to zero if not explicitly set. So the value field will be 0.0 by default.
📝 Syntax
intermediateWhich custom message definition is syntactically correct?
Select the valid ROS custom message definition syntax:
Attempts:
2 left
💡 Hint
ROS message definitions do not use semicolons or brackets after the type name.
✗ Incorrect
ROS message files list fields as type name without semicolons. Arrays use type[] name syntax.
🔧 Debug
advancedWhy does this custom message fail to build?
Given this message definition:
and
int32 id string name CustomType data
and
CustomType is defined in another package but not imported, why does the build fail?Attempts:
2 left
💡 Hint
Check how ROS handles dependencies between message types across packages.
✗ Incorrect
ROS requires that custom message types from other packages be declared as dependencies in the package manifest and imported properly. Missing this causes build errors.
❓ state_output
advancedWhat is the value of the array field after publishing this message?
Given the message definition:
and the publisher sets
int32[] numbers
and the publisher sets
numbers = [1, 2, 3], what will the subscriber receive if the publisher later sets numbers = [] and publishes again?Attempts:
2 left
💡 Hint
Think about how ROS messages handle empty arrays.
✗ Incorrect
When a publisher sends an empty array, the subscriber receives exactly that empty array.
🧠 Conceptual
expertWhat happens if you change a custom message definition after building and do not rebuild dependent packages?
You modify a ROS custom message by adding a new field but do not rebuild the packages that use it. What is the likely outcome when running nodes that use the old build?
Attempts:
2 left
💡 Hint
Consider how message serialization depends on exact definitions.
✗ Incorrect
ROS messages are serialized based on their definitions. Changing a message without rebuilding dependent packages causes mismatches leading to crashes or errors.
