A .action file defines a goal, feedback, and result structure for asynchronous tasks in ROS, enabling communication between nodes for long-running operations.
Click to reveal answer
beginner
Name the three main parts of a ROS .action file.
The three parts are: Goal (input to the action), Feedback (updates during execution), and Result (final output after completion).
Click to reveal answer
beginner
How are the sections in a .action file separated?
Sections are separated by three dashes (---). The order is Goal, then Feedback, then Result.
Click to reveal answer
intermediate
Why is feedback important in a ROS action?
Feedback lets the client know the progress of the action while it is running, which helps in monitoring and reacting to long tasks.
Click to reveal answer
intermediate
Give an example of a simple Goal definition in a .action file.
The file has goal fields first, then feedback fields, then result fields, separated by --- lines.
Step 2: Verify field types in each section
Goal has int32, feedback has float32, result has int32. However, the correct order is goal, result, feedback.
Final Answer:
Result section must come before feedback -> Option A
Quick Check:
Correct order is goal, result, feedback [OK]
Hint: Check section order and field types carefully [OK]
Common Mistakes:
Thinking feedback must come last
Assuming feedback cannot have fields
Mixing up result and feedback order
5. You want to define an action for a robot to move to a position with feedback on distance left and a result indicating success. Which .action file snippet correctly defines this?
The goal should specify the target position (target_x, target_y). Feedback should provide ongoing info (distance_left). Result should indicate success (bool success).
Step 2: Match the correct order in the .action file
The order is goal fields first, then feedback fields, then result fields. float64 target_x
float64 target_y
---
float64 distance_left
---
bool success matches this order correctly.