Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a request field for a ROS service.
ROS
int32 [1]Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved keywords as field names
Leaving out the field name
✗ Incorrect
In ROS .srv files, the request fields are defined by specifying the type and the field name. 'data' is a common simple field name.
2fill in blank
mediumComplete the code to separate request and response parts in a .srv file.
ROS
int32 data
---
[1]Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the field name in response
Using invalid syntax for response fields
✗ Incorrect
The '---' separates request and response. The response fields are defined similarly to request fields, with type and name.
3fill in blank
hardFix the error in the service definition by completing the missing separator.
ROS
string command
[1]
bool successAttempts:
3 left
💡 Hint
Common Mistakes
Using comment symbols instead of separator
Omitting the separator line
✗ Incorrect
The '---' line separates the request and response parts in a .srv file.
4fill in blank
hardFill both blanks to define a service with a float request and a string response.
ROS
float32 [1] --- string [2]
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up request and response field names
Using invalid field names
✗ Incorrect
The request field is named 'temperature' with type float32, and the response field is named 'message' with type string.
5fill in blank
hardFill all three blanks to define a service with int request, bool flag, and string response.
ROS
int32 [1] bool [2] --- string [3]
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing field names between request and response
Using invalid types or missing separator
✗ Incorrect
The request has 'count' as int32 and 'flag' as bool, and the response has 'result' as string.
